Skip to content

Commit a717536

Browse files
committed
Skip @param comment text mistaken as switched type
1 parent 9575ed4 commit a717536

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

packages/coding-standard/src/Fixer/Commenting/SwitchedTypeAndNameFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class SwitchedTypeAndNameFixer extends AbstractDocBlockFixer
2121
/**
2222
* @see https://regex101.com/r/4us32A/1
2323
*/
24-
private const string NAME_THEN_TYPE_REGEX = '#@((?:psalm-|phpstan-)?(?:param|var))(\s+)(?<name>\$\w+)(\s+)(?<type>(?:[|\\\\\w\[\]]|<[^<>]*>)+)#';
24+
private const string NAME_THEN_TYPE_REGEX = '#@((?:psalm-|phpstan-)?(?:param|var))(\s+)(?<name>\$\w+)(\s+)(?<type>(?:[|\\\\\w\[\]]|<[^<>]*>)+)(?=\s*$)#';
2525

2626
public function getDefinition(): FixerDefinitionInterface
2727
{
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
/**
4+
* @param $extra Can be used by model to determine what to unlock
5+
*/
6+
function test($extra): void
7+
{
8+
}

0 commit comments

Comments
 (0)