From fb4c807895da3283110fef84c7c9cd90395cb052 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 26 Jun 2026 12:11:32 +0200 Subject: [PATCH 1/3] apply cs --- .github/workflows/code_analysis.yaml | 2 +- .github/workflows/rector.yaml.yml | 2 +- composer.json | 2 +- .../symfony/symfony8/symfony81/symfony81-validator.php | 4 +--- ...raintValidatorValidateToValidateInContextRector.php | 10 +--------- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 50793dd6..3fe0a724 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -52,7 +52,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - uses: "ramsey/composer-install@v2" diff --git a/.github/workflows/rector.yaml.yml b/.github/workflows/rector.yaml.yml index 267bab2c..065a3d3b 100644 --- a/.github/workflows/rector.yaml.yml +++ b/.github/workflows/rector.yaml.yml @@ -23,7 +23,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - uses: "ramsey/composer-install@v2" diff --git a/composer.json b/composer.json index 83f587ea..9c492e01 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "MIT", "description": "Rector upgrades rules for Symfony Framework", "require": { - "php": ">=8.3", + "php": ">=8.4", "ext-xml": "*" }, "require-dev": { diff --git a/config/sets/symfony/symfony8/symfony81/symfony81-validator.php b/config/sets/symfony/symfony8/symfony81/symfony81-validator.php index 04c83151..19b79b2e 100644 --- a/config/sets/symfony/symfony8/symfony81/symfony81-validator.php +++ b/config/sets/symfony/symfony8/symfony81/symfony81-validator.php @@ -6,7 +6,5 @@ use Rector\Symfony\Symfony81\Rector\MethodCall\ConstraintValidatorValidateToValidateInContextRector; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->rules([ - ConstraintValidatorValidateToValidateInContextRector::class, - ]); + $rectorConfig->rules([ConstraintValidatorValidateToValidateInContextRector::class]); }; diff --git a/rules/Symfony81/Rector/MethodCall/ConstraintValidatorValidateToValidateInContextRector.php b/rules/Symfony81/Rector/MethodCall/ConstraintValidatorValidateToValidateInContextRector.php index 58aa0f08..2e7b7df9 100644 --- a/rules/Symfony81/Rector/MethodCall/ConstraintValidatorValidateToValidateInContextRector.php +++ b/rules/Symfony81/Rector/MethodCall/ConstraintValidatorValidateToValidateInContextRector.php @@ -140,17 +140,9 @@ private function refactorConstraintValidatorCall(MethodCall $node): ?Node return $node; } - /** - * @param Arg $firstArg - * @param Arg $secondArg - */ private function createThisValidateMethodCall(Arg $firstArg, Arg $secondArg): MethodCall { - return new MethodCall( - new Variable('this'), - new Identifier('validate'), - [$firstArg, $secondArg], - ); + return new MethodCall(new Variable('this'), new Identifier('validate'), [$firstArg, $secondArg]); } private function isThisValidatorPropertyFetch(Expr $node): bool From 147786b269bd1616abd11c4e70b7fdee1876e356 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 26 Jun 2026 12:14:10 +0200 Subject: [PATCH 2/3] re-run rector --- .../ParameterBagToAutowireAttributeRector.php | 8 +- ...onstraintOptionsToNamedArgumentsRector.php | 7 +- .../Class_/RemoveEraseCredentialsRector.php | 12 +- ...datorValidateToValidateInContextRector.php | 44 ++-- ...dentialsFromAuthenticatorManagerRector.php | 4 - src/Annotation/AnnotationAnalyzer.php | 16 +- .../Symfony/ContainerServiceProvider.php | 3 + src/NodeAnalyzer/ClassAnalyzer.php | 12 +- src/Set/SymfonySetList.php | 202 +++++++++--------- src/ValueObjectFactory/ServiceMapFactory.php | 10 +- 10 files changed, 152 insertions(+), 166 deletions(-) diff --git a/rules/Configs/Rector/Class_/ParameterBagToAutowireAttributeRector.php b/rules/Configs/Rector/Class_/ParameterBagToAutowireAttributeRector.php index e5f0a86a..79d0053c 100644 --- a/rules/Configs/Rector/Class_/ParameterBagToAutowireAttributeRector.php +++ b/rules/Configs/Rector/Class_/ParameterBagToAutowireAttributeRector.php @@ -157,13 +157,7 @@ public function provideMinPhpVersion(): int private function hasParameterBagInterfaceDependency(ClassMethod $classMethod): bool { - foreach ($classMethod->getParams() as $param) { - if ($this->isParameterBagParam($param)) { - return true; - } - } - - return false; + return array_any($classMethod->getParams(), fn (Param $param): bool => $this->isParameterBagParam($param)); } /** diff --git a/rules/Symfony73/Rector/Class_/ConstraintOptionsToNamedArgumentsRector.php b/rules/Symfony73/Rector/Class_/ConstraintOptionsToNamedArgumentsRector.php index e55ec447..8d87f6f8 100644 --- a/rules/Symfony73/Rector/Class_/ConstraintOptionsToNamedArgumentsRector.php +++ b/rules/Symfony73/Rector/Class_/ConstraintOptionsToNamedArgumentsRector.php @@ -55,12 +55,11 @@ public function getNodeTypes(): array return [New_::class]; } + /** + * @param New_ $node + */ public function refactor(Node $node): ?Node { - if (! $node instanceof New_) { - return null; - } - if ($node->isFirstClassCallable()) { return null; } diff --git a/rules/Symfony80/Rector/Class_/RemoveEraseCredentialsRector.php b/rules/Symfony80/Rector/Class_/RemoveEraseCredentialsRector.php index f0f7d913..f9b139ff 100644 --- a/rules/Symfony80/Rector/Class_/RemoveEraseCredentialsRector.php +++ b/rules/Symfony80/Rector/Class_/RemoveEraseCredentialsRector.php @@ -6,6 +6,7 @@ use PhpParser\Modifiers; use PhpParser\Node; +use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use Rector\Rector\AbstractRector; @@ -107,13 +108,10 @@ public function refactor(Node $node): ?Class_ private function doesImplementUserInterface(Class_ $class): bool { - foreach ($class->implements as $implementedInterface) { - if ($this->isName($implementedInterface, SymfonyClass::USER_INTERFACE)) { - return true; - } - } - - return false; + return array_any( + $class->implements, + fn (Name $name): bool => $this->isName($name, SymfonyClass::USER_INTERFACE) + ); } private function createSserializeClassMethod(mixed $classMethodStmts): ClassMethod diff --git a/rules/Symfony81/Rector/MethodCall/ConstraintValidatorValidateToValidateInContextRector.php b/rules/Symfony81/Rector/MethodCall/ConstraintValidatorValidateToValidateInContextRector.php index 2e7b7df9..d2b48e8c 100644 --- a/rules/Symfony81/Rector/MethodCall/ConstraintValidatorValidateToValidateInContextRector.php +++ b/rules/Symfony81/Rector/MethodCall/ConstraintValidatorValidateToValidateInContextRector.php @@ -107,37 +107,37 @@ public function refactor(Node $node): ?Node return $this->refactorConstraintValidatorCall($node); } - private function refactorConstraintValidatorTestCaseCall(MethodCall $node): ?Node + private function refactorConstraintValidatorTestCaseCall(MethodCall $methodCall): ?Node { - if ($this->isName($node->name, 'validate') && \count($node->args) === 2) { - return $this->createThisValidateMethodCall($node->args[0], $node->args[1]); + if ($this->isName($methodCall->name, 'validate') && \count($methodCall->args) === 2) { + return $this->createThisValidateMethodCall($methodCall->args[0], $methodCall->args[1]); } - if ($this->isName($node->name, 'validateInContext') && \count($node->args) === 3) { - return $this->createThisValidateMethodCall($node->args[0], $node->args[1]); + if ($this->isName($methodCall->name, 'validateInContext') && \count($methodCall->args) === 3) { + return $this->createThisValidateMethodCall($methodCall->args[0], $methodCall->args[1]); } return null; } - private function refactorConstraintValidatorCall(MethodCall $node): ?Node + private function refactorConstraintValidatorCall(MethodCall $methodCall): ?Node { - if (! $this->isName($node->name, 'validate')) { + if (! $this->isName($methodCall->name, 'validate')) { return null; } - if (\count($node->args) !== 2) { + if (\count($methodCall->args) !== 2) { return null; } - if (! $this->isInsideConstraintValidator($node)) { + if (! $this->isInsideConstraintValidator($methodCall)) { return null; } - $node->name = new Identifier('validateInContext'); - $node->args[] = new Arg($this->nodeFactory->createPropertyFetch(new Variable('this'), 'context')); + $methodCall->name = new Identifier('validateInContext'); + $methodCall->args[] = new Arg($this->nodeFactory->createPropertyFetch(new Variable('this'), 'context')); - return $node; + return $methodCall; } private function createThisValidateMethodCall(Arg $firstArg, Arg $secondArg): MethodCall @@ -145,32 +145,32 @@ private function createThisValidateMethodCall(Arg $firstArg, Arg $secondArg): Me return new MethodCall(new Variable('this'), new Identifier('validate'), [$firstArg, $secondArg]); } - private function isThisValidatorPropertyFetch(Expr $node): bool + private function isThisValidatorPropertyFetch(Expr $expr): bool { - if (! $node instanceof PropertyFetch) { + if (! $expr instanceof PropertyFetch) { return false; } - if (! $this->isName($node->name, 'validator')) { + if (! $this->isName($expr->name, 'validator')) { return false; } - return $node->var instanceof Variable && $this->isName($node->var, 'this'); + return $expr->var instanceof Variable && $this->isName($expr->var, 'this'); } - private function isInsideConstraintValidatorTestCase(MethodCall $node): bool + private function isInsideConstraintValidatorTestCase(MethodCall $methodCall): bool { - return $this->isInsideClassSubclassOf($node, ConstraintValidatorTestCase::class); + return $this->isInsideClassSubclassOf($methodCall, ConstraintValidatorTestCase::class); } - private function isInsideConstraintValidator(MethodCall $node): bool + private function isInsideConstraintValidator(MethodCall $methodCall): bool { - return $this->isInsideClassSubclassOf($node, ConstraintValidator::class); + return $this->isInsideClassSubclassOf($methodCall, ConstraintValidator::class); } - private function isInsideClassSubclassOf(MethodCall $node, string $className): bool + private function isInsideClassSubclassOf(MethodCall $methodCall, string $className): bool { - $scope = ScopeFetcher::fetch($node); + $scope = ScopeFetcher::fetch($methodCall); $classReflection = $scope->getClassReflection(); if (! $classReflection instanceof ClassReflection) { return false; diff --git a/rules/Symfony81/Rector/New_/RemoveEraseCredentialsFromAuthenticatorManagerRector.php b/rules/Symfony81/Rector/New_/RemoveEraseCredentialsFromAuthenticatorManagerRector.php index 87687ea7..e10c8135 100644 --- a/rules/Symfony81/Rector/New_/RemoveEraseCredentialsFromAuthenticatorManagerRector.php +++ b/rules/Symfony81/Rector/New_/RemoveEraseCredentialsFromAuthenticatorManagerRector.php @@ -80,10 +80,6 @@ public function getNodeTypes(): array */ public function refactor(Node $node): ?Node { - if (! $node instanceof New_) { - return null; - } - if (! $this->isName($node->class, 'Symfony\Component\Security\Http\Authentication\AuthenticatorManager')) { return null; } diff --git a/src/Annotation/AnnotationAnalyzer.php b/src/Annotation/AnnotationAnalyzer.php index d705a6e1..74898c17 100644 --- a/src/Annotation/AnnotationAnalyzer.php +++ b/src/Annotation/AnnotationAnalyzer.php @@ -5,6 +5,7 @@ namespace Rector\Symfony\Annotation; use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\ClassMethod; use Rector\Doctrine\NodeAnalyzer\AttrinationFinder; use Rector\Symfony\Enum\SymfonyAnnotation; @@ -20,13 +21,12 @@ public function hasClassMethodWithTemplateAnnotation(Class_ $class): bool if ($this->attrinationFinder->hasByOne($class, SymfonyAnnotation::TEMPLATE)) { return true; } - - foreach ($class->getMethods() as $classMethod) { - if ($this->attrinationFinder->hasByOne($classMethod, SymfonyAnnotation::TEMPLATE)) { - return true; - } - } - - return false; + return array_any( + $class->getMethods(), + fn (ClassMethod $classMethod): bool => $this->attrinationFinder->hasByOne( + $classMethod, + SymfonyAnnotation::TEMPLATE + ) + ); } } diff --git a/src/Bridge/Symfony/ContainerServiceProvider.php b/src/Bridge/Symfony/ContainerServiceProvider.php index 64040a7d..124ef633 100644 --- a/src/Bridge/Symfony/ContainerServiceProvider.php +++ b/src/Bridge/Symfony/ContainerServiceProvider.php @@ -11,6 +11,9 @@ use Symfony\Component\DependencyInjection\Container; use Webmozart\Assert\Assert; +/** + * @see \Rector\Symfony\Tests\Bridge\Symfony\ContainerServiceProviderTest + */ final class ContainerServiceProvider { private ?object $container = null; diff --git a/src/NodeAnalyzer/ClassAnalyzer.php b/src/NodeAnalyzer/ClassAnalyzer.php index 4acc241d..254b2ecf 100644 --- a/src/NodeAnalyzer/ClassAnalyzer.php +++ b/src/NodeAnalyzer/ClassAnalyzer.php @@ -4,6 +4,7 @@ namespace Rector\Symfony\NodeAnalyzer; +use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; use Rector\NodeNameResolver\NodeNameResolver; @@ -16,12 +17,9 @@ public function __construct( public function hasImplements(Class_ $class, string $interfaceFQN): bool { - foreach ($class->implements as $implement) { - if ($this->nodeNameResolver->isName($implement, $interfaceFQN)) { - return true; - } - } - - return false; + return array_any( + $class->implements, + fn (Name $name): bool => $this->nodeNameResolver->isName($name, $interfaceFQN) + ); } } diff --git a/src/Set/SymfonySetList.php b/src/Set/SymfonySetList.php index 61a04dbe..04a0b788 100644 --- a/src/Set/SymfonySetList.php +++ b/src/Set/SymfonySetList.php @@ -4,6 +4,8 @@ namespace Rector\Symfony\Set; +use Deprecated; + /** * @api */ @@ -11,177 +13,173 @@ final class SymfonySetList { public const string CONFIGS = __DIR__ . '/../../config/sets/symfony/configs.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_25 = __DIR__ . '/../../config/sets/symfony/symfony25.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_26 = __DIR__ . '/../../config/sets/symfony/symfony26.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_27 = __DIR__ . '/../../config/sets/symfony/symfony27.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_28 = __DIR__ . '/../../config/sets/symfony/symfony28.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_30 = __DIR__ . '/../../config/sets/symfony/symfony3/symfony30.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_31 = __DIR__ . '/../../config/sets/symfony/symfony3/symfony31.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_32 = __DIR__ . '/../../config/sets/symfony/symfony3/symfony32.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_33 = __DIR__ . '/../../config/sets/symfony/symfony3/symfony33.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_34 = __DIR__ . '/../../config/sets/symfony/symfony3/symfony34.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_40 = __DIR__ . '/../../config/sets/symfony/symfony4/symfony40.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_41 = __DIR__ . '/../../config/sets/symfony/symfony4/symfony41.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_42 = __DIR__ . '/../../config/sets/symfony/symfony4/symfony42.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_43 = __DIR__ . '/../../config/sets/symfony/symfony4/symfony43.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_44 = __DIR__ . '/../../config/sets/symfony/symfony4/symfony44.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_50 = __DIR__ . '/../../config/sets/symfony/symfony5/symfony50.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_50_TYPES = __DIR__ . '/../../config/sets/symfony/symfony5/symfony50/symfony50-types.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_51 = __DIR__ . '/../../config/sets/symfony/symfony5/symfony51.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_52 = __DIR__ . '/../../config/sets/symfony/symfony5/symfony52.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_53 = __DIR__ . '/../../config/sets/symfony/symfony5/symfony53.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_54 = __DIR__ . '/../../config/sets/symfony/symfony5/symfony54.php'; - /** - * @deprecated Use ->withAttributesSets(symfony: true) in rector.php config instead - */ + #[Deprecated(message: 'Use ->withAttributesSets(symfony: true) in rector.php config instead')] public const string SYMFONY_52_VALIDATOR_ATTRIBUTES = __DIR__ . '/../../config/sets/symfony/symfony5/symfony52-validator-attributes.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_60 = __DIR__ . '/../../config/sets/symfony/symfony6/symfony60.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_61 = __DIR__ . '/../../config/sets/symfony/symfony6/symfony61.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_62 = __DIR__ . '/../../config/sets/symfony/symfony6/symfony62.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_63 = __DIR__ . '/../../config/sets/symfony/symfony6/symfony63.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_64 = __DIR__ . '/../../config/sets/symfony/symfony6/symfony64.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_70 = __DIR__ . '/../../config/sets/symfony/symfony7/symfony70.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_71 = __DIR__ . '/../../config/sets/symfony/symfony7/symfony71.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_72 = __DIR__ . '/../../config/sets/symfony/symfony7/symfony72.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_73 = __DIR__ . '/../../config/sets/symfony/symfony7/symfony73.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_74 = __DIR__ . '/../../config/sets/symfony/symfony7/symfony74.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_80 = __DIR__ . '/../../config/sets/symfony/symfony8/symfony80.php'; - /** - * @deprecated Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead - */ + #[Deprecated( + message: 'Set list are too generic and do not handle package differences. Use ->withComposerBased(symfony: true) instead' + )] public const string SYMFONY_81 = __DIR__ . '/../../config/sets/symfony/symfony8/symfony81.php'; public const string SYMFONY_CODE_QUALITY = __DIR__ . '/../../config/sets/symfony/symfony-code-quality.php'; public const string SYMFONY_CONSTRUCTOR_INJECTION = __DIR__ . '/../../config/sets/symfony/symfony-constructor-injection.php'; - /** - * @deprecated Use ->withAttributesSets(symfony: true) in rector.php config instead - */ + #[Deprecated(message: 'Use ->withAttributesSets(symfony: true) in rector.php config instead')] public const string ANNOTATIONS_TO_ATTRIBUTES = __DIR__ . '/../../config/sets/symfony/annotations-to-attributes.php'; } diff --git a/src/ValueObjectFactory/ServiceMapFactory.php b/src/ValueObjectFactory/ServiceMapFactory.php index 45901cd3..d6cca18b 100644 --- a/src/ValueObjectFactory/ServiceMapFactory.php +++ b/src/ValueObjectFactory/ServiceMapFactory.php @@ -37,7 +37,7 @@ public function createFromFileContent(string $configFilePath): ServiceMap foreach ($xml->services->service as $def) { /** @var SimpleXMLElement $attrs */ $attrs = $def->attributes(); - if (! (property_exists($attrs, 'id') && $attrs->id instanceof SimpleXMLElement)) { + if (! property_exists($attrs, 'id') || ! $attrs->id instanceof SimpleXMLElement) { continue; } @@ -102,18 +102,18 @@ private function createServiceFromXmlAndTagsData(SimpleXMLElement $attrs, array $attrs, 'class' ) && $attrs->class instanceof SimpleXMLElement ? (string) $attrs->class : null, - ! (property_exists( + ! property_exists( $attrs, 'public' - ) && $attrs->public instanceof SimpleXMLElement) || (string) $attrs->public !== 'false', + ) || ! $attrs->public instanceof SimpleXMLElement || (string) $attrs->public !== 'false', property_exists( $attrs, 'synthetic' ) && $attrs->synthetic instanceof SimpleXMLElement && (string) $attrs->synthetic === 'true', - ! (property_exists( + ! property_exists( $attrs, 'shared' - ) && $attrs->shared instanceof SimpleXMLElement) || (string) $attrs->shared !== 'false', + ) || ! $attrs->shared instanceof SimpleXMLElement || (string) $attrs->shared !== 'false', property_exists( $attrs, 'alias' From 90e73738982a26ba01b3c1a92c7fd7a23027c2ad Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 26 Jun 2026 10:15:07 +0000 Subject: [PATCH 3/3] [rector] Rector fixes --- src/Annotation/AnnotationAnalyzer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Annotation/AnnotationAnalyzer.php b/src/Annotation/AnnotationAnalyzer.php index 74898c17..51f53761 100644 --- a/src/Annotation/AnnotationAnalyzer.php +++ b/src/Annotation/AnnotationAnalyzer.php @@ -21,6 +21,7 @@ public function hasClassMethodWithTemplateAnnotation(Class_ $class): bool if ($this->attrinationFinder->hasByOne($class, SymfonyAnnotation::TEMPLATE)) { return true; } + return array_any( $class->getMethods(), fn (ClassMethod $classMethod): bool => $this->attrinationFinder->hasByOne(