mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
Updated Rector to commit 4ea7d0f477ff10755172869818056824b2d42dcd
4ea7d0f477
[DeadCode] Clean up PHPStan notice on ComplexNodeRemover::processRemoveParamWithKeys() (#4018)
This commit is contained in:
parent
8925a6a4f0
commit
4c71bd6171
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit1129ecb5f2bd2dbc397346f31cbc7d99::getLoader();
|
||||
return ComposerAutoloaderInit68dbdf136090a4311602cfb2dc70640b::getLoader();
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -2493,6 +2493,7 @@ return array(
|
||||
'Rector\\Symfony\\Contract\\Tag\\TagInterface' => $vendorDir . '/rector/rector-symfony/src/Contract/Tag/TagInterface.php',
|
||||
'Rector\\Symfony\\DataProvider\\ServiceMapProvider' => $vendorDir . '/rector/rector-symfony/src/DataProvider/ServiceMapProvider.php',
|
||||
'Rector\\Symfony\\DataProvider\\ServiceNameToTypeUniqueProvider' => $vendorDir . '/rector/rector-symfony/src/DataProvider/ServiceNameToTypeUniqueProvider.php',
|
||||
'Rector\\Symfony\\Enum\\SensioAttribute' => $vendorDir . '/rector/rector-symfony/src/Enum/SensioAttribute.php',
|
||||
'Rector\\Symfony\\Enum\\SymfonyAnnotation' => $vendorDir . '/rector/rector-symfony/src/Enum/SymfonyAnnotation.php',
|
||||
'Rector\\Symfony\\Exception\\InvalidConfigurationException' => $vendorDir . '/rector/rector-symfony/src/Exception/InvalidConfigurationException.php',
|
||||
'Rector\\Symfony\\Exception\\XmlContainerNotExistsException' => $vendorDir . '/rector/rector-symfony/src/Exception/XmlContainerNotExistsException.php',
|
||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit1129ecb5f2bd2dbc397346f31cbc7d99
|
||||
class ComposerAutoloaderInit68dbdf136090a4311602cfb2dc70640b
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit1129ecb5f2bd2dbc397346f31cbc7d99
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit1129ecb5f2bd2dbc397346f31cbc7d99', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit68dbdf136090a4311602cfb2dc70640b', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit1129ecb5f2bd2dbc397346f31cbc7d99', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit68dbdf136090a4311602cfb2dc70640b', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit1129ecb5f2bd2dbc397346f31cbc7d99::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit68dbdf136090a4311602cfb2dc70640b::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit1129ecb5f2bd2dbc397346f31cbc7d99::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit68dbdf136090a4311602cfb2dc70640b::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit1129ecb5f2bd2dbc397346f31cbc7d99
|
||||
class ComposerStaticInit68dbdf136090a4311602cfb2dc70640b
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -2735,6 +2735,7 @@ class ComposerStaticInit1129ecb5f2bd2dbc397346f31cbc7d99
|
||||
'Rector\\Symfony\\Contract\\Tag\\TagInterface' => __DIR__ . '/..' . '/rector/rector-symfony/src/Contract/Tag/TagInterface.php',
|
||||
'Rector\\Symfony\\DataProvider\\ServiceMapProvider' => __DIR__ . '/..' . '/rector/rector-symfony/src/DataProvider/ServiceMapProvider.php',
|
||||
'Rector\\Symfony\\DataProvider\\ServiceNameToTypeUniqueProvider' => __DIR__ . '/..' . '/rector/rector-symfony/src/DataProvider/ServiceNameToTypeUniqueProvider.php',
|
||||
'Rector\\Symfony\\Enum\\SensioAttribute' => __DIR__ . '/..' . '/rector/rector-symfony/src/Enum/SensioAttribute.php',
|
||||
'Rector\\Symfony\\Enum\\SymfonyAnnotation' => __DIR__ . '/..' . '/rector/rector-symfony/src/Enum/SymfonyAnnotation.php',
|
||||
'Rector\\Symfony\\Exception\\InvalidConfigurationException' => __DIR__ . '/..' . '/rector/rector-symfony/src/Exception/InvalidConfigurationException.php',
|
||||
'Rector\\Symfony\\Exception\\XmlContainerNotExistsException' => __DIR__ . '/..' . '/rector/rector-symfony/src/Exception/XmlContainerNotExistsException.php',
|
||||
@ -3083,9 +3084,9 @@ class ComposerStaticInit1129ecb5f2bd2dbc397346f31cbc7d99
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit1129ecb5f2bd2dbc397346f31cbc7d99::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit1129ecb5f2bd2dbc397346f31cbc7d99::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit1129ecb5f2bd2dbc397346f31cbc7d99::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit68dbdf136090a4311602cfb2dc70640b::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit68dbdf136090a4311602cfb2dc70640b::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit68dbdf136090a4311602cfb2dc70640b::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -2059,12 +2059,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "15475fc5a3d2f0f66e417ff78695f06de8a9d5b3"
|
||||
"reference": "4de970023567afc964cf47e75d84ae98b3ae6890"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/15475fc5a3d2f0f66e417ff78695f06de8a9d5b3",
|
||||
"reference": "15475fc5a3d2f0f66e417ff78695f06de8a9d5b3",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/4de970023567afc964cf47e75d84ae98b3ae6890",
|
||||
"reference": "4de970023567afc964cf47e75d84ae98b3ae6890",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2094,7 +2094,7 @@
|
||||
"tomasvotruba\/type-coverage": "^0.0.9",
|
||||
"tomasvotruba\/unused-public": "^0.0.34"
|
||||
},
|
||||
"time": "2023-05-29T13:18:20+00:00",
|
||||
"time": "2023-05-29T13:35:44+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
||||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7e3df08'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main abf0a7f'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main edbdd0e'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 15475fc'));
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7e3df08'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main abf0a7f'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main edbdd0e'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4de9700'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
24
vendor/rector/rector-symfony/src/Enum/SensioAttribute.php
vendored
Normal file
24
vendor/rector/rector-symfony/src/Enum/SensioAttribute.php
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Symfony\Enum;
|
||||
|
||||
final class SensioAttribute
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PARAM_CONVERTER_CLASS = 'Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\ParamConverter';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ENTITY_CLASS = 'Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Entity';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const SENSIO_METHOD = 'Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Method';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const SENSIO_TEMPLATE = 'Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Template';
|
||||
}
|
@ -9,16 +9,12 @@ final class SymfonyAnnotation
|
||||
* @var string
|
||||
*/
|
||||
public const ROUTE = 'Symfony\\Component\\Routing\\Annotation\\Route';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const SENSIO_METHOD = 'Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Method';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const SENSIO_TEMPLATE = 'Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Template';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const TWIG_TEMPLATE = 'Symfony\\Bridge\\Twig\\Attribute\\Template';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const MAP_ENTITY_CLASS = 'Symfony\\Bridge\\Doctrine\\Attribute\\MapEntity';
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
|
||||
use Rector\BetterPhpDocParser\Printer\PhpDocInfoPrinter;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Symfony\Enum\SensioAttribute;
|
||||
use Rector\Symfony\Enum\SymfonyAnnotation;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
@ -91,7 +92,7 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
$sensioDoctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass(SymfonyAnnotation::SENSIO_METHOD);
|
||||
$sensioDoctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass(SensioAttribute::SENSIO_METHOD);
|
||||
if (!$sensioDoctrineAnnotationTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
return null;
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
|
||||
use Rector\Symfony\Enum\SensioAttribute;
|
||||
use Rector\Symfony\Enum\SymfonyAnnotation;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
@ -29,18 +30,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class ParamConverterAttributeToMapEntityAttributeRector extends AbstractRector implements MinPhpVersionInterface
|
||||
{
|
||||
private const PARAM_CONVERTER_CLASS = 'Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\ParamConverter';
|
||||
private const ENTITY_CLASS = 'Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Entity';
|
||||
private const MAP_ENTITY_CLASS = 'Symfony\\Bridge\\Doctrine\\Attribute\\MapEntity';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer
|
||||
*/
|
||||
private $phpAttributeAnalyzer;
|
||||
public function __construct(PhpAttributeAnalyzer $phpAttributeAnalyzer)
|
||||
{
|
||||
$this->phpAttributeAnalyzer = $phpAttributeAnalyzer;
|
||||
}
|
||||
public function provideMinPhpVersion() : int
|
||||
{
|
||||
return PhpVersionFeature::ATTRIBUTES;
|
||||
@ -50,23 +39,27 @@ final class ParamConverterAttributeToMapEntityAttributeRector extends AbstractRe
|
||||
return new RuleDefinition('Replace ParamConverter attribute with mappings with the MapEntity attribute', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
class SomeController
|
||||
{
|
||||
#[Route('/blog/{date}/{slug}/comments/{comment_slug}')]
|
||||
#[ParamConverter('post', options: ['mapping' => ['date' => 'date', 'slug' => 'slug']])]
|
||||
#[ParamConverter('comment', options: ['mapping' => ['comment_slug' => 'slug']])]
|
||||
public function showComment(
|
||||
Post $post,
|
||||
|
||||
Comment $comment
|
||||
) {
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
|
||||
class SomeController
|
||||
{
|
||||
#[Route('/blog/{date}/{slug}/comments/{comment_slug}')]
|
||||
public function showComment(
|
||||
#[\Symfony\Bridge\Doctrine\Attribute\MapEntity(mapping: ['date' => 'date', 'slug' => 'slug'])] Post $post,
|
||||
#[\Symfony\Bridge\Doctrine\Attribute\MapEntity(mapping: ['comment_slug' => 'slug'])] Comment $comment
|
||||
#[MapEntity(mapping: ['date' => 'date', 'slug' => 'slug'])]
|
||||
Post $post,
|
||||
|
||||
#[MapEntity(mapping: ['comment_slug' => 'slug'])]
|
||||
Comment $comment
|
||||
) {
|
||||
}
|
||||
}
|
||||
@ -80,55 +73,65 @@ CODE_SAMPLE
|
||||
{
|
||||
return [ClassMethod::class];
|
||||
}
|
||||
/**
|
||||
* @param ClassMethod $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if (!$node instanceof ClassMethod || !$node->isPublic() || !$this->phpAttributeAnalyzer->hasPhpAttributes($node, [self::PARAM_CONVERTER_CLASS, self::ENTITY_CLASS])) {
|
||||
if (!$node->isPublic()) {
|
||||
return null;
|
||||
}
|
||||
$this->refactorParamConverter($node);
|
||||
return $node;
|
||||
}
|
||||
private function refactorParamConverter(ClassMethod $classMethod) : void
|
||||
{
|
||||
foreach ($classMethod->attrGroups as $attrGroup) {
|
||||
$hasChanged = \false;
|
||||
foreach ($node->attrGroups as $attrGroupKey => $attrGroup) {
|
||||
foreach ($attrGroup->attrs as $attr) {
|
||||
if ($this->isNames($attr, [self::PARAM_CONVERTER_CLASS, self::ENTITY_CLASS])) {
|
||||
$this->refactorAttribute($classMethod, $attr);
|
||||
if (!$this->isNames($attr, [SensioAttribute::PARAM_CONVERTER_CLASS, SensioAttribute::ENTITY_CLASS])) {
|
||||
continue;
|
||||
}
|
||||
$attribute = $this->refactorAttribute($node, $attr, $attrGroup);
|
||||
if ($attribute instanceof Attribute) {
|
||||
unset($node->attrGroups[$attrGroupKey]);
|
||||
$hasChanged = \true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($hasChanged) {
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private function refactorAttribute(ClassMethod $classMethod, Attribute $attribute) : void
|
||||
private function refactorAttribute(ClassMethod $classMethod, Attribute $attribute, AttributeGroup $attributeGroup) : ?Attribute
|
||||
{
|
||||
if ($attribute->args === [] || !$attribute->args[0]->value instanceof String_) {
|
||||
return;
|
||||
$firstArg = $attribute->args[0] ?? null;
|
||||
if (!$firstArg instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
if (!$firstArg->value instanceof String_) {
|
||||
return null;
|
||||
}
|
||||
$optionsIndex = $this->getIndexForOptionsArg($attribute->args);
|
||||
$exprIndex = $this->getIndexForExprArg($attribute->args);
|
||||
if (!$optionsIndex && !$exprIndex) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$name = $attribute->args[0]->value->value;
|
||||
$name = $firstArg->value->value;
|
||||
$mapping = $attribute->args[$optionsIndex]->value;
|
||||
$exprValue = $attribute->args[$exprIndex]->value;
|
||||
$newArguments = $this->getNewArguments($mapping, $exprValue);
|
||||
if ($newArguments === []) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$this->removeNode($attribute->args[0]);
|
||||
unset($attribute->args[0]);
|
||||
if ($optionsIndex) {
|
||||
$this->removeNode($attribute->args[$optionsIndex]);
|
||||
unset($attribute->args[$optionsIndex]);
|
||||
}
|
||||
if ($exprIndex) {
|
||||
$this->removeNode($attribute->args[$exprIndex]);
|
||||
unset($attribute->args[$exprIndex]);
|
||||
}
|
||||
$attribute->args = \array_merge($attribute->args, $newArguments);
|
||||
$attribute->name = new FullyQualified(self::MAP_ENTITY_CLASS);
|
||||
$node = $attribute->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$node instanceof AttributeGroup) {
|
||||
return;
|
||||
}
|
||||
$this->addMapEntityAttribute($classMethod, $name, $node);
|
||||
$attribute->name = new FullyQualified(SymfonyAnnotation::MAP_ENTITY_CLASS);
|
||||
// $node = $attribute->getAttribute(AttributeKey::PARENT_NODE);
|
||||
$this->addMapEntityAttribute($classMethod, $name, $attributeGroup);
|
||||
return $attribute;
|
||||
}
|
||||
/**
|
||||
* @return Arg[]
|
||||
@ -162,10 +165,10 @@ CODE_SAMPLE
|
||||
if (!$param->var instanceof Variable) {
|
||||
continue;
|
||||
}
|
||||
if ($variableName === $param->var->name) {
|
||||
$param->attrGroups = [$attributeGroup];
|
||||
$this->removeNode($attributeGroup);
|
||||
if (!$this->isName($param->var, $variableName)) {
|
||||
continue;
|
||||
}
|
||||
$param->attrGroups = [$attributeGroup];
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -13,6 +13,7 @@ use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Doctrine\NodeAnalyzer\AttrinationFinder;
|
||||
use Rector\Symfony\Enum\SensioAttribute;
|
||||
use Rector\Symfony\Enum\SymfonyAnnotation;
|
||||
use Rector\Symfony\TypeAnalyzer\ControllerAnalyzer;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
@ -96,7 +97,7 @@ CODE_SAMPLE
|
||||
if (!$this->hasReturn($node)) {
|
||||
return null;
|
||||
}
|
||||
if ($this->attrinationFinder->hasByOne($node, SymfonyAnnotation::SENSIO_TEMPLATE) || $this->attrinationFinder->hasByOne($node, SymfonyAnnotation::TWIG_TEMPLATE)) {
|
||||
if ($this->attrinationFinder->hasByOne($node, SensioAttribute::SENSIO_TEMPLATE) || $this->attrinationFinder->hasByOne($node, SymfonyAnnotation::TWIG_TEMPLATE)) {
|
||||
$node->returnType = new NullableType(new Identifier('array'));
|
||||
return $node;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user