diff --git a/SlevomatCodingStandard/Sniffs/Typehints/ReturnTypehintSpacingSniff.php b/SlevomatCodingStandard/Sniffs/Typehints/ReturnTypehintSpacingSniff.php index b5e6b4ee1..077fe367c 100644 --- a/SlevomatCodingStandard/Sniffs/Typehints/ReturnTypehintSpacingSniff.php +++ b/SlevomatCodingStandard/Sniffs/Typehints/ReturnTypehintSpacingSniff.php @@ -43,6 +43,8 @@ public function process(\PHP_CodeSniffer_File $phpcsFile, $returnTypePointer) $phpcsFile->addError($afterColonMessage, $returnTypePointer, self::CODE_MULTIPLE_SPACES_BETWEEN_COLON_AND_TYPE); } $colonPointer = $phpcsFile->findPrevious(T_COLON, $beforeNamePointer - 1); + } else { + return; } $previousPointer = $colonPointer - 1;