Skip to content

Commit

Permalink
NoSuperfluousPhpdocTagsFixer - Index invalid or out of range
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored and keradus committed Aug 1, 2018
1 parent f75251b commit b511032
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php
Expand Up @@ -139,7 +139,7 @@ private function findDocumentedFunction(Tokens $tokens, $index)
do {
$index = $tokens->getNextMeaningfulToken($index);

if ($tokens[$index]->isGivenKind(T_FUNCTION)) {
if (null === $index || $tokens[$index]->isGivenKind(T_FUNCTION)) {
return $index;
}
} while ($tokens[$index]->isGivenKind([T_ABSTRACT, T_FINAL, T_STATIC, T_PRIVATE, T_PROTECTED, T_PUBLIC]));
Expand Down
6 changes: 6 additions & 0 deletions tests/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixerTest.php
Expand Up @@ -264,6 +264,12 @@ class Foo {
public function doFoo(array $bar, callable $baz) {}
}',
],
'PHPDoc at the end of file' => [
'<?php
/**
* Foo
*/',
],
];
}

Expand Down

0 comments on commit b511032

Please sign in to comment.