diff --git a/Magento2/Sniffs/Classes/AbstractApiSniff.php b/Magento2/Sniffs/Classes/AbstractApiSniff.php index ac5836d8..13947186 100644 --- a/Magento2/Sniffs/Classes/AbstractApiSniff.php +++ b/Magento2/Sniffs/Classes/AbstractApiSniff.php @@ -48,6 +48,9 @@ public function process(File $phpcsFile, $stackPtr) } $commentStartPtr = $phpcsFile->findPrevious(T_DOC_COMMENT_OPEN_TAG, $stackPtr - 1, 0); + if ($commentStartPtr === false) { + return; + } $commentCloserPtr = $tokens[$commentStartPtr]['comment_closer']; for ($i = $commentStartPtr; $i <= $commentCloserPtr; $i++) { diff --git a/Magento2/Tests/Classes/AbstractApiUnitTest.inc b/Magento2/Tests/Classes/AbstractApiUnitTest.1.inc similarity index 99% rename from Magento2/Tests/Classes/AbstractApiUnitTest.inc rename to Magento2/Tests/Classes/AbstractApiUnitTest.1.inc index 92d5edee..178611fb 100644 --- a/Magento2/Tests/Classes/AbstractApiUnitTest.inc +++ b/Magento2/Tests/Classes/AbstractApiUnitTest.1.inc @@ -28,7 +28,6 @@ class FooBar implements FooInterface } - /** * Class Bar */ diff --git a/Magento2/Tests/Classes/AbstractApiUnitTest.2.inc b/Magento2/Tests/Classes/AbstractApiUnitTest.2.inc new file mode 100644 index 00000000..5cd3d5b0 --- /dev/null +++ b/Magento2/Tests/Classes/AbstractApiUnitTest.2.inc @@ -0,0 +1,6 @@ + 1, - 23 => 1 - ]; + if ($testFile === 'AbstractApiUnitTest.1.inc') { + return [ + 14 => 1, + 23 => 1 + ]; + } + + return []; } }