Skip to content

Squiz/ClosingDeclarationComment: fix a non-problematic bug plus some other small improvements #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Squiz/ClosingDeclarationComment: remove unreachable condition
This commit removes an if condition that cannot be true. The
`$closingBracket` variable can never be null as the sniff already bows
out before setting the variable when checking if
`isset($tokens[$stackPtr]['scope_closer']) === false`.
  • Loading branch information
rodrigoprimo authored and jrfnl committed Apr 9, 2024
commit 579f08138ba159f199af9df079b7fb41b4649b1a
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ public function process(File $phpcsFile, $stackPtr)

$closingBracket = $tokens[$stackPtr]['scope_closer'];

if ($closingBracket === null) {
// Possible inline structure. Other tests will handle it.
return;
}

$data = [$comment];
if (isset($tokens[($closingBracket + 1)]) === false || $tokens[($closingBracket + 1)]['code'] !== T_COMMENT) {
$next = $phpcsFile->findNext(T_WHITESPACE, ($closingBracket + 1), null, true);
Expand Down