Skip to content

Commit 29dd54b

Browse files
authored
Fix iterator type mallform (#53)
* add failing iterator fixture * fix
1 parent 8a14f92 commit 29dd54b

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/TokenRunner/DocBlock/MalformWorker/SwitchedTypeAndNameMalformWorker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class SwitchedTypeAndNameMalformWorker implements MalformWorkerInterface
1616
* @var string
1717
* @see https://regex101.com/r/4us32A/1
1818
*/
19-
private const NAME_THEN_TYPE_REGEX = '#@((?:psalm-|phpstan-)?(?:param|var))(\s+)(?<name>\$\w+)(\s+)(?<type>[|\\\\\w\[\]]+)#';
19+
private const NAME_THEN_TYPE_REGEX = '#@((?:psalm-|phpstan-)?(?:param|var))(\s+)(?<name>\$\w+)(\s+)(?<type>[|\\\\\w\[\]\<\>]+)#';
2020

2121
/**
2222
* @param Tokens<Token> $tokens
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
function test($value): string
4+
{
5+
/* @var $value Iterator<SomeType> */
6+
return $value;
7+
}
8+
9+
?>
10+
-----
11+
<?php
12+
13+
function test($value): string
14+
{
15+
/** @var Iterator<SomeType> $value */
16+
return $value;
17+
}
18+
19+
?>

tests/Fixer/Commenting/ParamReturnAndVarTagMalformsFixer/ParamReturnAndVarTagMalformsFixerTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
use PHPUnit\Framework\Attributes\DataProvider;
99
use Symplify\EasyCodingStandard\Testing\PHPUnit\AbstractCheckerTestCase;
1010

11-
/**
12-
* @mimic https://github.com/rectorphp/rector/pull/807/files
13-
*/
1411
final class ParamReturnAndVarTagMalformsFixerTest extends AbstractCheckerTestCase
1512
{
1613
#[DataProvider('provideData')]

0 commit comments

Comments
 (0)