Skip to content

Commit f65e2d3

Browse files
authored
[Symfony73] Use class constant for use of Symfony\Component\Validator\Constraints\Collection (#852)
1 parent 3d39f6b commit f65e2d3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

rules/Symfony73/Rector/Class_/ConstraintOptionsToNamedArgumentsRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use PhpParser\Node\Name\FullyQualified;
1616
use Rector\PhpParser\Node\Value\ValueResolver;
1717
use Rector\Rector\AbstractRector;
18+
use Rector\Symfony\Enum\SymfonyClass;
1819
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
1920
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
2021

@@ -89,7 +90,7 @@ public function refactor(Node $node): ?Node
8990
}
9091

9192
$args = $node->getArgs();
92-
if ($className === 'Symfony\Component\Validator\Constraints\Collection'
93+
if ($className === SymfonyClass::SYMFONY_VALIDATOR_CONSTRAINTS_COLLECTION
9394
&& count($args) === 1
9495
&& $args[0]->value instanceof Array_) {
9596

src/Enum/SymfonyClass.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,9 @@ final class SymfonyClass
150150
* @var string
151151
*/
152152
public const LOGOUT_SUCCESS_HANDLER = 'Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface';
153+
154+
/**
155+
* @var string
156+
*/
157+
public const SYMFONY_VALIDATOR_CONSTRAINTS_COLLECTION = 'Symfony\Component\Validator\Constraints\Collection';
153158
}

0 commit comments

Comments
 (0)