Skip to content

Commit

Permalink
bug #3954 NoSuperfluousPhpdocTagsFixer - Index invalid or out of rang…
Browse files Browse the repository at this point in the history
…e (kubawerlos)

This PR was squashed before being merged into the 2.12 branch (closes #3954).

Discussion
----------

NoSuperfluousPhpdocTagsFixer - Index invalid or out of range

Fixes #3953

Commits
-------

b511032 NoSuperfluousPhpdocTagsFixer - Index invalid or out of range
  • Loading branch information
keradus committed Aug 1, 2018
2 parents c342bad + b511032 commit 1c10240
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 1c10240

Please sign in to comment.