From d33418d841e5edaceffd62a4cd2407a59e16fa2e Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 6 Dec 2021 13:10:17 +0000 Subject: [PATCH] Updated Rector to commit a68528204268680699cf9d60a82904c7532215db https://github.com/rectorphp/rector-src/commit/a68528204268680699cf9d60a82904c7532215db [DowngradePhp80] Add getAttributes() reflection downgrade (#1406) --- config/set/downgrade-php80.php | 2 + ...DowngradeReflectionGetAttributesRector.php | 68 +++++++++++++++++++ src/Application/VersionResolver.php | 4 +- vendor/autoload.php | 2 +- vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_real.php | 14 ++-- vendor/composer/autoload_static.php | 9 +-- vendor/scoper-autoload.php | 10 +-- .../Resource/ReflectionClassResource.php | 8 +-- vendor/symfony/console/Command/Command.php | 4 +- .../Service/ServiceSubscriberTrait.php | 2 +- .../dependency-injection/Attribute/Target.php | 2 +- .../AttributeAutoconfigurationPass.php | 12 ++-- .../Compiler/AutowirePass.php | 2 +- .../Compiler/AutowireRequiredMethodsPass.php | 2 +- .../AutowireRequiredPropertiesPass.php | 2 +- .../Compiler/PriorityTaggedServiceTrait.php | 2 +- .../RegisterAutoconfigureAttributesPass.php | 2 +- .../Loader/PhpFileLoader.php | 2 +- 19 files changed, 111 insertions(+), 39 deletions(-) create mode 100644 rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php diff --git a/config/set/downgrade-php80.php b/config/set/downgrade-php80.php index 642093adc74..93d63a3a9b5 100644 --- a/config/set/downgrade-php80.php +++ b/config/set/downgrade-php80.php @@ -21,6 +21,7 @@ use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRecto use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector; use Rector\DowngradePhp80\Rector\Instanceof_\DowngradePhp80ResourceReturnToObjectRector; use Rector\DowngradePhp80\Rector\MethodCall\DowngradeNamedArgumentRector; +use Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionGetAttributesRector; use Rector\DowngradePhp80\Rector\New_\DowngradeArbitraryExpressionsSupportRector; use Rector\DowngradePhp80\Rector\NullsafeMethodCall\DowngradeNullsafeToTernaryOperatorRector; use Rector\DowngradePhp80\Rector\Property\DowngradeUnionTypeTypedPropertyRector; @@ -61,4 +62,5 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat $services->set(\Rector\DowngradePhp80\Rector\StaticCall\DowngradePhpTokenRector::class); $services->set(\Rector\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector::class); $services->set(\Rector\DowngradePhp80\Rector\Instanceof_\DowngradePhp80ResourceReturnToObjectRector::class); + $services->set(\Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionGetAttributesRector::class); }; diff --git a/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php b/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php new file mode 100644 index 00000000000..547adb6d4a3 --- /dev/null +++ b/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php @@ -0,0 +1,68 @@ +getAttributes()) { + return true; + } + + return false; + } +} +CODE_SAMPLE +, <<<'CODE_SAMPLE' +class SomeClass +{ + public function run(ReflectionClass $reflectionClass) + { + if ([]) { + return true; + } + + return false; + } +} +CODE_SAMPLE +)]); + } + /** + * @return array> + */ + public function getNodeTypes() : array + { + return [\PhpParser\Node\Expr\MethodCall::class]; + } + /** + * @param MethodCall $node + */ + public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node + { + if (!$this->isName($node->name, 'getAttributes')) { + return null; + } + if (!$this->isObjectType($node->var, new \PHPStan\Type\ObjectType('Reflector'))) { + return null; + } + return new \PhpParser\Node\Expr\Array_([]); + } +} diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 50848697105..9a3f0a132b7 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = '99d53a903d8cde0644d2fc54584fe0a12904589b'; + public const PACKAGE_VERSION = 'a68528204268680699cf9d60a82904c7532215db'; /** * @var string */ - public const RELEASE_DATE = '2021-12-06 13:43:20'; + public const RELEASE_DATE = '2021-12-06 13:54:18'; public static function resolvePackageVersion() : string { $process = new \RectorPrefix20211206\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); diff --git a/vendor/autoload.php b/vendor/autoload.php index 2bb6721af4c..06f6d8dfafa 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c::getLoader(); +return ComposerAutoloaderInitad990f187e90a0c8236f265ebda091e0::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 478c39ef39d..80e13d47eac 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2017,6 +2017,7 @@ return array( 'Rector\\DowngradePhp80\\Rector\\FunctionLike\\DowngradeUnionTypeDeclarationRector' => $baseDir . '/rules/DowngradePhp80/Rector/FunctionLike/DowngradeUnionTypeDeclarationRector.php', 'Rector\\DowngradePhp80\\Rector\\Instanceof_\\DowngradePhp80ResourceReturnToObjectRector' => $baseDir . '/rules/DowngradePhp80/Rector/Instanceof_/DowngradePhp80ResourceReturnToObjectRector.php', 'Rector\\DowngradePhp80\\Rector\\MethodCall\\DowngradeNamedArgumentRector' => $baseDir . '/rules/DowngradePhp80/Rector/MethodCall/DowngradeNamedArgumentRector.php', + 'Rector\\DowngradePhp80\\Rector\\MethodCall\\DowngradeReflectionGetAttributesRector' => $baseDir . '/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php', 'Rector\\DowngradePhp80\\Rector\\New_\\DowngradeArbitraryExpressionsSupportRector' => $baseDir . '/rules/DowngradePhp80/Rector/New_/DowngradeArbitraryExpressionsSupportRector.php', 'Rector\\DowngradePhp80\\Rector\\NullsafeMethodCall\\DowngradeNullsafeToTernaryOperatorRector' => $baseDir . '/rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php', 'Rector\\DowngradePhp80\\Rector\\Property\\DowngradeUnionTypeTypedPropertyRector' => $baseDir . '/rules/DowngradePhp80/Rector/Property/DowngradeUnionTypeTypedPropertyRector.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 7286043ca7d..ceb5d7d0a6e 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c +class ComposerAutoloaderInitad990f187e90a0c8236f265ebda091e0 { private static $loader; @@ -22,15 +22,15 @@ class ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitad990f187e90a0c8236f265ebda091e0', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitad990f187e90a0c8236f265ebda091e0', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitcb5c23844d6f484dc73fc23035ddc70c::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitad990f187e90a0c8236f265ebda091e0::getInitializer($loader)); } else { $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { @@ -42,19 +42,19 @@ class ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitcb5c23844d6f484dc73fc23035ddc70c::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitad990f187e90a0c8236f265ebda091e0::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirecb5c23844d6f484dc73fc23035ddc70c($fileIdentifier, $file); + composerRequiread990f187e90a0c8236f265ebda091e0($fileIdentifier, $file); } return $loader; } } -function composerRequirecb5c23844d6f484dc73fc23035ddc70c($fileIdentifier, $file) +function composerRequiread990f187e90a0c8236f265ebda091e0($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 7acef681fee..46ce0ca1208 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitcb5c23844d6f484dc73fc23035ddc70c +class ComposerStaticInitad990f187e90a0c8236f265ebda091e0 { public static $files = array ( 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', @@ -2414,6 +2414,7 @@ class ComposerStaticInitcb5c23844d6f484dc73fc23035ddc70c 'Rector\\DowngradePhp80\\Rector\\FunctionLike\\DowngradeUnionTypeDeclarationRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/FunctionLike/DowngradeUnionTypeDeclarationRector.php', 'Rector\\DowngradePhp80\\Rector\\Instanceof_\\DowngradePhp80ResourceReturnToObjectRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/Instanceof_/DowngradePhp80ResourceReturnToObjectRector.php', 'Rector\\DowngradePhp80\\Rector\\MethodCall\\DowngradeNamedArgumentRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/MethodCall/DowngradeNamedArgumentRector.php', + 'Rector\\DowngradePhp80\\Rector\\MethodCall\\DowngradeReflectionGetAttributesRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php', 'Rector\\DowngradePhp80\\Rector\\New_\\DowngradeArbitraryExpressionsSupportRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/New_/DowngradeArbitraryExpressionsSupportRector.php', 'Rector\\DowngradePhp80\\Rector\\NullsafeMethodCall\\DowngradeNullsafeToTernaryOperatorRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php', 'Rector\\DowngradePhp80\\Rector\\Property\\DowngradeUnionTypeTypedPropertyRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/Property/DowngradeUnionTypeTypedPropertyRector.php', @@ -3788,9 +3789,9 @@ class ComposerStaticInitcb5c23844d6f484dc73fc23035ddc70c public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitcb5c23844d6f484dc73fc23035ddc70c::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitcb5c23844d6f484dc73fc23035ddc70c::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitcb5c23844d6f484dc73fc23035ddc70c::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitad990f187e90a0c8236f265ebda091e0::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitad990f187e90a0c8236f265ebda091e0::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitad990f187e90a0c8236f265ebda091e0::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index 9f7d1c1c26f..4da39c28a52 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -12,8 +12,8 @@ if (!class_exists('GenerateChangelogCommand', false) && !interface_exists('Gener if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) { spl_autoload_call('RectorPrefix20211206\AutoloadIncluder'); } -if (!class_exists('ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c', false) && !interface_exists('ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c', false) && !trait_exists('ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c', false)) { - spl_autoload_call('RectorPrefix20211206\ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c'); +if (!class_exists('ComposerAutoloaderInitad990f187e90a0c8236f265ebda091e0', false) && !interface_exists('ComposerAutoloaderInitad990f187e90a0c8236f265ebda091e0', false) && !trait_exists('ComposerAutoloaderInitad990f187e90a0c8236f265ebda091e0', false)) { + spl_autoload_call('RectorPrefix20211206\ComposerAutoloaderInitad990f187e90a0c8236f265ebda091e0'); } if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) { spl_autoload_call('RectorPrefix20211206\Helmich\TypoScriptParser\Parser\AST\Statement'); @@ -81,9 +81,9 @@ if (!function_exists('print_node')) { return \RectorPrefix20211206\print_node(...func_get_args()); } } -if (!function_exists('composerRequirecb5c23844d6f484dc73fc23035ddc70c')) { - function composerRequirecb5c23844d6f484dc73fc23035ddc70c() { - return \RectorPrefix20211206\composerRequirecb5c23844d6f484dc73fc23035ddc70c(...func_get_args()); +if (!function_exists('composerRequiread990f187e90a0c8236f265ebda091e0')) { + function composerRequiread990f187e90a0c8236f265ebda091e0() { + return \RectorPrefix20211206\composerRequiread990f187e90a0c8236f265ebda091e0(...func_get_args()); } } if (!function_exists('scanPath')) { diff --git a/vendor/symfony/config/Resource/ReflectionClassResource.php b/vendor/symfony/config/Resource/ReflectionClassResource.php index 0b259d0280d..b8258459163 100644 --- a/vendor/symfony/config/Resource/ReflectionClassResource.php +++ b/vendor/symfony/config/Resource/ReflectionClassResource.php @@ -109,7 +109,7 @@ class ReflectionClassResource implements \RectorPrefix20211206\Symfony\Component { if (\PHP_VERSION_ID >= 80000) { $attributes = []; - foreach ($class->getAttributes() as $a) { + foreach ([] as $a) { $attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()]; } (yield \print_r($attributes, \true)); @@ -129,7 +129,7 @@ class ReflectionClassResource implements \RectorPrefix20211206\Symfony\Component $defaults = $class->getDefaultProperties(); foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) { if (\PHP_VERSION_ID >= 80000) { - foreach ($p->getAttributes() as $a) { + foreach ([] as $a) { $attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()]; } (yield \print_r($attributes, \true)); @@ -148,7 +148,7 @@ class ReflectionClassResource implements \RectorPrefix20211206\Symfony\Component }, null, $class->name); foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) { if (\PHP_VERSION_ID >= 80000) { - foreach ($m->getAttributes() as $a) { + foreach ([] as $a) { $attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()]; } (yield \print_r($attributes, \true)); @@ -158,7 +158,7 @@ class ReflectionClassResource implements \RectorPrefix20211206\Symfony\Component $parametersWithUndefinedConstants = []; foreach ($m->getParameters() as $p) { if (\PHP_VERSION_ID >= 80000) { - foreach ($p->getAttributes() as $a) { + foreach ([] as $a) { $attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()]; } (yield \print_r($attributes, \true)); diff --git a/vendor/symfony/console/Command/Command.php b/vendor/symfony/console/Command/Command.php index d2e0971c4c3..db137a1c2d9 100644 --- a/vendor/symfony/console/Command/Command.php +++ b/vendor/symfony/console/Command/Command.php @@ -62,7 +62,7 @@ class Command public static function getDefaultName() { $class = static::class; - if (\PHP_VERSION_ID >= 80000 && ($attribute = (new \ReflectionClass($class))->getAttributes(\RectorPrefix20211206\Symfony\Component\Console\Attribute\AsCommand::class))) { + if (\PHP_VERSION_ID >= 80000 && ($attribute = [])) { return $attribute[0]->newInstance()->name; } $r = new \ReflectionProperty($class, 'defaultName'); @@ -71,7 +71,7 @@ class Command public static function getDefaultDescription() : ?string { $class = static::class; - if (\PHP_VERSION_ID >= 80000 && ($attribute = (new \ReflectionClass($class))->getAttributes(\RectorPrefix20211206\Symfony\Component\Console\Attribute\AsCommand::class))) { + if (\PHP_VERSION_ID >= 80000 && ($attribute = [])) { return $attribute[0]->newInstance()->description; } $r = new \ReflectionProperty($class, 'defaultDescription'); diff --git a/vendor/symfony/contracts/Service/ServiceSubscriberTrait.php b/vendor/symfony/contracts/Service/ServiceSubscriberTrait.php index f91e4509ff2..f1278000b8e 100644 --- a/vendor/symfony/contracts/Service/ServiceSubscriberTrait.php +++ b/vendor/symfony/contracts/Service/ServiceSubscriberTrait.php @@ -38,7 +38,7 @@ trait ServiceSubscriberTrait if (self::class !== $method->getDeclaringClass()->name) { continue; } - if (!($attribute = $method->getAttributes(\RectorPrefix20211206\Symfony\Contracts\Service\Attribute\SubscribedService::class)[0] ?? null)) { + if (!($attribute = [][0] ?? null)) { continue; } if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) { diff --git a/vendor/symfony/dependency-injection/Attribute/Target.php b/vendor/symfony/dependency-injection/Attribute/Target.php index b6c47eec1d2..fc78aaf7498 100644 --- a/vendor/symfony/dependency-injection/Attribute/Target.php +++ b/vendor/symfony/dependency-injection/Attribute/Target.php @@ -29,7 +29,7 @@ final class Target } public static function parseName(\ReflectionParameter $parameter) : string { - if (80000 > \PHP_VERSION_ID || !($target = $parameter->getAttributes(self::class)[0] ?? null)) { + if (80000 > \PHP_VERSION_ID || !($target = [][0] ?? null)) { return $parameter->name; } $name = $target->newInstance()->name; diff --git a/vendor/symfony/dependency-injection/Compiler/AttributeAutoconfigurationPass.php b/vendor/symfony/dependency-injection/Compiler/AttributeAutoconfigurationPass.php index 710921a8bda..7b9b5b228c5 100644 --- a/vendor/symfony/dependency-injection/Compiler/AttributeAutoconfigurationPass.php +++ b/vendor/symfony/dependency-injection/Compiler/AttributeAutoconfigurationPass.php @@ -54,7 +54,7 @@ final class AttributeAutoconfigurationPass extends \RectorPrefix20211206\Symfony } catch (\ReflectionException $e) { continue; } - $targets = $attributeReflector->getAttributes(\Attribute::class)[0] ?? 0; + $targets = [][0] ?? 0; $targets = $targets ? $targets->getArguments()[0] ?? -1 : 0; foreach (['class', 'method', 'property', 'parameter'] as $symbol) { if (['Reflector'] !== $types) { @@ -81,7 +81,7 @@ final class AttributeAutoconfigurationPass extends \RectorPrefix20211206\Symfony $instanceof = $value->getInstanceofConditionals(); $conditionals = $instanceof[$classReflector->getName()] ?? new \RectorPrefix20211206\Symfony\Component\DependencyInjection\ChildDefinition(''); if ($this->classAttributeConfigurators) { - foreach ($classReflector->getAttributes() as $attribute) { + foreach ([] as $attribute) { if ($configurator = $this->classAttributeConfigurators[$attribute->getName()] ?? null) { $configurator($conditionals, $attribute->newInstance(), $classReflector); } @@ -89,7 +89,7 @@ final class AttributeAutoconfigurationPass extends \RectorPrefix20211206\Symfony } if ($this->parameterAttributeConfigurators && ($constructorReflector = $this->getConstructor($value, \false))) { foreach ($constructorReflector->getParameters() as $parameterReflector) { - foreach ($parameterReflector->getAttributes() as $attribute) { + foreach ([] as $attribute) { if ($configurator = $this->parameterAttributeConfigurators[$attribute->getName()] ?? null) { $configurator($conditionals, $attribute->newInstance(), $parameterReflector); } @@ -102,7 +102,7 @@ final class AttributeAutoconfigurationPass extends \RectorPrefix20211206\Symfony continue; } if ($this->methodAttributeConfigurators) { - foreach ($methodReflector->getAttributes() as $attribute) { + foreach ([] as $attribute) { if ($configurator = $this->methodAttributeConfigurators[$attribute->getName()] ?? null) { $configurator($conditionals, $attribute->newInstance(), $methodReflector); } @@ -110,7 +110,7 @@ final class AttributeAutoconfigurationPass extends \RectorPrefix20211206\Symfony } if ($this->parameterAttributeConfigurators) { foreach ($methodReflector->getParameters() as $parameterReflector) { - foreach ($parameterReflector->getAttributes() as $attribute) { + foreach ([] as $attribute) { if ($configurator = $this->parameterAttributeConfigurators[$attribute->getName()] ?? null) { $configurator($conditionals, $attribute->newInstance(), $parameterReflector); } @@ -124,7 +124,7 @@ final class AttributeAutoconfigurationPass extends \RectorPrefix20211206\Symfony if ($propertyReflector->isStatic()) { continue; } - foreach ($propertyReflector->getAttributes() as $attribute) { + foreach ([] as $attribute) { if ($configurator = $this->propertyAttributeConfigurators[$attribute->getName()] ?? null) { $configurator($conditionals, $attribute->newInstance(), $propertyReflector); } diff --git a/vendor/symfony/dependency-injection/Compiler/AutowirePass.php b/vendor/symfony/dependency-injection/Compiler/AutowirePass.php index 077cb74eb0b..b8f9f4e06ba 100644 --- a/vendor/symfony/dependency-injection/Compiler/AutowirePass.php +++ b/vendor/symfony/dependency-injection/Compiler/AutowirePass.php @@ -211,7 +211,7 @@ class AutowirePass extends \RectorPrefix20211206\Symfony\Component\DependencyInj } $type = \RectorPrefix20211206\Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper::getTypeHint($reflectionMethod, $parameter, \true); if ($checkAttributes) { - foreach ($parameter->getAttributes() as $attribute) { + foreach ([] as $attribute) { if (\RectorPrefix20211206\Symfony\Component\DependencyInjection\Attribute\TaggedIterator::class === $attribute->getName()) { $attribute = $attribute->newInstance(); $arguments[$index] = new \RectorPrefix20211206\Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument($attribute->tag, $attribute->indexAttribute, $attribute->defaultIndexMethod, \false, $attribute->defaultPriorityMethod); diff --git a/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php b/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php index 450c3a3cd77..a7a2a39705d 100644 --- a/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php @@ -43,7 +43,7 @@ class AutowireRequiredMethodsPass extends \RectorPrefix20211206\Symfony\Componen continue; } while (\true) { - if (\PHP_VERSION_ID >= 80000 && $r->getAttributes(\RectorPrefix20211206\Symfony\Contracts\Service\Attribute\Required::class)) { + if (\PHP_VERSION_ID >= 80000 && []) { if ($this->isWither($r, $r->getDocComment() ?: '')) { $withers[] = [$r->name, [], \true]; } else { diff --git a/vendor/symfony/dependency-injection/Compiler/AutowireRequiredPropertiesPass.php b/vendor/symfony/dependency-injection/Compiler/AutowireRequiredPropertiesPass.php index b041991d8d2..86d5c1a65fb 100644 --- a/vendor/symfony/dependency-injection/Compiler/AutowireRequiredPropertiesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/AutowireRequiredPropertiesPass.php @@ -43,7 +43,7 @@ class AutowireRequiredPropertiesPass extends \RectorPrefix20211206\Symfony\Compo if (!($type = $reflectionProperty->getType()) instanceof \ReflectionNamedType) { continue; } - if ((\PHP_VERSION_ID < 80000 || !$reflectionProperty->getAttributes(\RectorPrefix20211206\Symfony\Contracts\Service\Attribute\Required::class)) && (\false === ($doc = $reflectionProperty->getDocComment()) || \false === \stripos($doc, '@required') || !\preg_match('#(?:^/\\*\\*|\\n\\s*+\\*)\\s*+@required(?:\\s|\\*/$)#i', $doc))) { + if ((\PHP_VERSION_ID < 80000 || ![]) && (\false === ($doc = $reflectionProperty->getDocComment()) || \false === \stripos($doc, '@required') || !\preg_match('#(?:^/\\*\\*|\\n\\s*+\\*)\\s*+@required(?:\\s|\\*/$)#i', $doc))) { continue; } if (\array_key_exists($name = $reflectionProperty->getName(), $properties)) { diff --git a/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php b/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php index 641dad5aa2d..5d6d5415268 100644 --- a/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php +++ b/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php @@ -119,7 +119,7 @@ class PriorityTaggedServiceUtil return null; } if ($checkTaggedItem && !$r->hasMethod($defaultMethod)) { - foreach ($r->getAttributes(\RectorPrefix20211206\Symfony\Component\DependencyInjection\Attribute\AsTaggedItem::class) as $attribute) { + foreach ([] as $attribute) { return 'priority' === $indexAttribute ? $attribute->newInstance()->priority : $attribute->newInstance()->index; } return null; diff --git a/vendor/symfony/dependency-injection/Compiler/RegisterAutoconfigureAttributesPass.php b/vendor/symfony/dependency-injection/Compiler/RegisterAutoconfigureAttributesPass.php index e80f62306a4..9b4407c4acd 100644 --- a/vendor/symfony/dependency-injection/Compiler/RegisterAutoconfigureAttributesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RegisterAutoconfigureAttributesPass.php @@ -51,7 +51,7 @@ final class RegisterAutoconfigureAttributesPass implements \RectorPrefix20211206 */ public function processClass($container, $class) { - foreach ($class->getAttributes(\RectorPrefix20211206\Symfony\Component\DependencyInjection\Attribute\Autoconfigure::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) { + foreach ([] as $attribute) { self::registerForAutoconfiguration($container, $class, $attribute); } } diff --git a/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php b/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php index c70aa3a46b5..f4e71ddb387 100644 --- a/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php @@ -92,7 +92,7 @@ class PhpFileLoader extends \RectorPrefix20211206\Symfony\Component\DependencyIn $r = new \ReflectionFunction($callback); if (\PHP_VERSION_ID >= 80000) { $attribute = null; - foreach ($r->getAttributes(\RectorPrefix20211206\Symfony\Component\DependencyInjection\Attribute\When::class) as $attribute) { + foreach ([] as $attribute) { if ($this->env === $attribute->newInstance()->env) { $attribute = null; break;