From 0e08dbabe6352720f184478ea5128b7cc989ae2b Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Wed, 13 Dec 2023 13:03:11 +0000 Subject: [PATCH] Fix PHP Notice --- src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php b/src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php index f4bffff75a..7f9b983e4e 100644 --- a/src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php +++ b/src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php @@ -109,7 +109,7 @@ public function process(File $phpcsFile, $stackPtr) $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); if ($tokens[$next]['code'] === T_SEMICOLON) { $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true); - if ($tokens[$next]['code'] === T_CLOSE_CURLY_BRACKET) { + if ($tokens[$next]['code'] === T_CLOSE_CURLY_BRACKET && isset($tokens[$next]['scope_condition']) === true) { // If this is the closing brace of a function // then this return statement doesn't return anything // and is not required anyway.