Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iterator type mallform #53

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class SwitchedTypeAndNameMalformWorker implements MalformWorkerInterface
* @var string
* @see https://regex101.com/r/4us32A/1
*/
private const NAME_THEN_TYPE_REGEX = '#@((?:psalm-|phpstan-)?(?:param|var))(\s+)(?<name>\$\w+)(\s+)(?<type>[|\\\\\w\[\]]+)#';
private const NAME_THEN_TYPE_REGEX = '#@((?:psalm-|phpstan-)?(?:param|var))(\s+)(?<name>\$\w+)(\s+)(?<type>[|\\\\\w\[\]\<\>]+)#';

/**
* @param Tokens<Token> $tokens
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

function test($value): string
{
/* @var $value Iterator<SomeType> */
return $value;
}

?>
-----
<?php

function test($value): string
{
/** @var Iterator<SomeType> $value */
return $value;
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
use PHPUnit\Framework\Attributes\DataProvider;
use Symplify\EasyCodingStandard\Testing\PHPUnit\AbstractCheckerTestCase;

/**
* @mimic https://github.com/rectorphp/rector/pull/807/files
*/
final class ParamReturnAndVarTagMalformsFixerTest extends AbstractCheckerTestCase
{
#[DataProvider('provideData')]
Expand Down
Loading