diff --git a/packages/coding-standard/src/Fixer/Commenting/SwitchedTypeAndNameFixer.php b/packages/coding-standard/src/Fixer/Commenting/SwitchedTypeAndNameFixer.php index 4cb2131ff2..59bd632ff7 100644 --- a/packages/coding-standard/src/Fixer/Commenting/SwitchedTypeAndNameFixer.php +++ b/packages/coding-standard/src/Fixer/Commenting/SwitchedTypeAndNameFixer.php @@ -21,7 +21,7 @@ final class SwitchedTypeAndNameFixer extends AbstractDocBlockFixer /** * @see https://regex101.com/r/4us32A/1 */ - private const string NAME_THEN_TYPE_REGEX = '#@((?:psalm-|phpstan-)?(?:param|var))(\s+)(?\$\w+)(\s+)(?[|\\\\\w\[\]\<\>]+)#'; + private const string NAME_THEN_TYPE_REGEX = '#@((?:psalm-|phpstan-)?(?:param|var))(\s+)(?\$\w+)(\s+)(?(?:[|\\\\\w\[\]]|<[^<>]*>)+)#'; public function getDefinition(): FixerDefinitionInterface { diff --git a/packages/coding-standard/tests/Fixer/Commenting/SwitchedTypeAndNameFixer/Fixture/wrong4.php.inc b/packages/coding-standard/tests/Fixer/Commenting/SwitchedTypeAndNameFixer/Fixture/wrong4.php.inc new file mode 100644 index 0000000000..a86a6ca19a --- /dev/null +++ b/packages/coding-standard/tests/Fixer/Commenting/SwitchedTypeAndNameFixer/Fixture/wrong4.php.inc @@ -0,0 +1,21 @@ + + */ +function test($submittedArray): void +{ +} + +?> +----- + $submittedArray + */ +function test($submittedArray): void +{ +} + +?>