mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 06:18:07 +01:00
Updated Rector to commit a68528204268680699cf9d60a82904c7532215db
a685282042
[DowngradePhp80] Add getAttributes() reflection downgrade (#1406)
This commit is contained in:
parent
573ed06c1c
commit
d33418d841
@ -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);
|
||||
};
|
||||
|
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\DowngradePhp80\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\Tests\DowngradePhp80\Rector\MethodCall\DowngradeReflectionGetAttributesRector\DowngradeReflectionGetAttributesRectorTest
|
||||
*/
|
||||
final class DowngradeReflectionGetAttributesRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Remove reflection getAttributes() class method code', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function run(ReflectionClass $reflectionClass)
|
||||
{
|
||||
if ($reflectionClass->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<class-string<Node>>
|
||||
*/
|
||||
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_([]);
|
||||
}
|
||||
}
|
@ -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__);
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitcb5c23844d6f484dc73fc23035ddc70c::getLoader();
|
||||
return ComposerAutoloaderInitad990f187e90a0c8236f265ebda091e0::getLoader();
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -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',
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -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;
|
||||
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
@ -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);
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -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')) {
|
||||
|
@ -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));
|
||||
|
4
vendor/symfony/console/Command/Command.php
vendored
4
vendor/symfony/console/Command/Command.php
vendored
@ -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');
|
||||
|
@ -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()) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user