Skip to content

Commit

Permalink
Fix PHP Notice
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Dec 13, 2023
1 parent 040f675 commit 34c7c05
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function process(File $phpcsFile, $stackPtr)
}

$colon = $phpcsFile->findPrevious(T_COLON, $returnType);
if ($tokens[($colon - 1)]['code'] !== T_CLOSE_PARENTHESIS) {
if (isset($colon, $tokens[($colon - 1)]) === true && $tokens[($colon - 1)]['code'] !== T_CLOSE_PARENTHESIS) {
$error = 'There must not be a space before the colon in a return type declaration';
$prev = $phpcsFile->findPrevious(T_WHITESPACE, ($colon - 1), null, true);
if ($tokens[$prev]['code'] === T_CLOSE_PARENTHESIS) {
Expand Down

0 comments on commit 34c7c05

Please sign in to comment.