Skip to content

Commit c8e974c

Browse files
committed
Remove safeguards deemed unnecessary
1 parent 892327d commit c8e974c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Standards/PSR12/Sniffs/Functions/ReturnTypeDeclarationSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function process(File $phpcsFile, int $stackPtr)
5858

5959
$returnType = $methodProperties['return_type_token'];
6060
if ($methodProperties['nullable_return_type'] === true) {
61-
$returnType = $phpcsFile->findPrevious(T_NULLABLE, ($returnType - 1), $tokens[$stackPtr]['parenthesis_closer']);
61+
$returnType = $phpcsFile->findPrevious(T_NULLABLE, ($returnType - 1));
6262
}
6363

6464
$colon = $phpcsFile->findPrevious(T_COLON, $returnType, $tokens[$stackPtr]['parenthesis_closer']);
@@ -92,7 +92,7 @@ public function process(File $phpcsFile, int $stackPtr)
9292

9393
if ($tokens[($colon - 1)]['code'] !== T_CLOSE_PARENTHESIS) {
9494
$error = 'There must not be a space before the colon in a return type declaration';
95-
$prev = $phpcsFile->findPrevious(T_WHITESPACE, ($colon - 1), $tokens[$stackPtr]['parenthesis_closer'], true);
95+
$prev = $phpcsFile->findPrevious(T_WHITESPACE, ($colon - 1), null, true);
9696
if ($tokens[$prev]['code'] === T_CLOSE_PARENTHESIS) {
9797
$fix = $phpcsFile->addFixableError($error, $colon, 'SpaceBeforeColon');
9898
if ($fix === true) {

0 commit comments

Comments
 (0)