Skip to content

Commit

Permalink
PhpdocNoIncorrectVarAnnotationFixer - fix for annotation as last token (
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Jul 2, 2021
1 parent 552d9d1 commit 02145a9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -3,7 +3,7 @@
[![Latest stable version](https://img.shields.io/packagist/v/kubawerlos/php-cs-fixer-custom-fixers.svg?label=current%20version)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
[![PHP version](https://img.shields.io/packagist/php-v/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://php.net)
[![License](https://img.shields.io/github/license/kubawerlos/php-cs-fixer-custom-fixers.svg)](LICENSE)
![Tests](https://img.shields.io/badge/tests-2831-brightgreen.svg)
![Tests](https://img.shields.io/badge/tests-2832-brightgreen.svg)
[![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)

[![CI Status](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/workflows/CI/badge.svg?branch=main&event=push)](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions)
Expand Down
3 changes: 1 addition & 2 deletions src/Fixer/PhpdocNoIncorrectVarAnnotationFixer.php
Expand Up @@ -70,8 +70,7 @@ public function fix(\SplFileInfo $file, Tokens $tokens): void

if ($nextIndex === null) {
$this->removeVarAnnotationNotMatchingPattern($tokens, $index, null);

return;
continue;
}

/** @var Token $nextToken */
Expand Down
11 changes: 11 additions & 0 deletions tests/Fixer/PhpdocNoIncorrectVarAnnotationFixerTest.php
Expand Up @@ -342,6 +342,17 @@ public function hello()
foreach ($b as $x) {}
}
}
',
];

yield [
'<?php
$x = 0;
',
'<?php
/** @var this is incorrect */
$x = 0;
/** @var this is incorrect */
',
];
}
Expand Down

0 comments on commit 02145a9

Please sign in to comment.