mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 00:10:51 +00:00
Updated Rector to commit 01a066062b
01a066062b
Add failing test fixture for AnnotationToAttributeRector (#225)
This commit is contained in:
parent
5915890df5
commit
54671c2dc3
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'c8900bf34845ea694b84443c6ccfc09e394f3e89';
|
||||
public const PACKAGE_VERSION = '01a066062bf3ef8e88cbce8e68bb933a02f025c3';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-06-14 16:54:42';
|
||||
public const RELEASE_DATE = '2021-06-14 23:01:17';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210614\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 ComposerAutoloaderIniteee3c7b8a73ec51612a23479456abc41::getLoader();
|
||||
return ComposerAutoloaderInit7ca01c3532cfed17a5a881fa84c4b98c::getLoader();
|
||||
|
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
|
@ -2066,6 +2066,7 @@ return array(
|
|||
'Rector\\Doctrine\\Rector\\ClassMethod\\ServiceEntityRepositoryParentCallToDIRector' => $vendorDir . '/rector/rector-doctrine/src/Rector/ClassMethod/ServiceEntityRepositoryParentCallToDIRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\AddEntityIdByConditionRector' => $vendorDir . '/rector/rector-doctrine/src/Rector/Class_/AddEntityIdByConditionRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\BlameableBehaviorRector' => $vendorDir . '/rector/rector-doctrine/src/Rector/Class_/BlameableBehaviorRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\ClassAnnotationToNamedArgumentConstructorRector' => $vendorDir . '/rector/rector-doctrine/src/Rector/Class_/ClassAnnotationToNamedArgumentConstructorRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\InitializeDefaultEntityCollectionRector' => $vendorDir . '/rector/rector-doctrine/src/Rector/Class_/InitializeDefaultEntityCollectionRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\LoggableBehaviorRector' => $vendorDir . '/rector/rector-doctrine/src/Rector/Class_/LoggableBehaviorRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\ManagerRegistryGetManagerToEntityManagerRector' => $vendorDir . '/rector/rector-doctrine/src/Rector/Class_/ManagerRegistryGetManagerToEntityManagerRector.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 ComposerAutoloaderIniteee3c7b8a73ec51612a23479456abc41
|
||||
class ComposerAutoloaderInit7ca01c3532cfed17a5a881fa84c4b98c
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderIniteee3c7b8a73ec51612a23479456abc41
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderIniteee3c7b8a73ec51612a23479456abc41', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit7ca01c3532cfed17a5a881fa84c4b98c', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderIniteee3c7b8a73ec51612a23479456abc41', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit7ca01c3532cfed17a5a881fa84c4b98c', '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\ComposerStaticIniteee3c7b8a73ec51612a23479456abc41::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit7ca01c3532cfed17a5a881fa84c4b98c::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderIniteee3c7b8a73ec51612a23479456abc41
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticIniteee3c7b8a73ec51612a23479456abc41::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit7ca01c3532cfed17a5a881fa84c4b98c::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequireeee3c7b8a73ec51612a23479456abc41($fileIdentifier, $file);
|
||||
composerRequire7ca01c3532cfed17a5a881fa84c4b98c($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequireeee3c7b8a73ec51612a23479456abc41($fileIdentifier, $file)
|
||||
function composerRequire7ca01c3532cfed17a5a881fa84c4b98c($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 ComposerStaticIniteee3c7b8a73ec51612a23479456abc41
|
||||
class ComposerStaticInit7ca01c3532cfed17a5a881fa84c4b98c
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -2421,6 +2421,7 @@ class ComposerStaticIniteee3c7b8a73ec51612a23479456abc41
|
|||
'Rector\\Doctrine\\Rector\\ClassMethod\\ServiceEntityRepositoryParentCallToDIRector' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Rector/ClassMethod/ServiceEntityRepositoryParentCallToDIRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\AddEntityIdByConditionRector' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Rector/Class_/AddEntityIdByConditionRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\BlameableBehaviorRector' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Rector/Class_/BlameableBehaviorRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\ClassAnnotationToNamedArgumentConstructorRector' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Rector/Class_/ClassAnnotationToNamedArgumentConstructorRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\InitializeDefaultEntityCollectionRector' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Rector/Class_/InitializeDefaultEntityCollectionRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\LoggableBehaviorRector' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Rector/Class_/LoggableBehaviorRector.php',
|
||||
'Rector\\Doctrine\\Rector\\Class_\\ManagerRegistryGetManagerToEntityManagerRector' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Rector/Class_/ManagerRegistryGetManagerToEntityManagerRector.php',
|
||||
|
@ -3863,9 +3864,9 @@ class ComposerStaticIniteee3c7b8a73ec51612a23479456abc41
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticIniteee3c7b8a73ec51612a23479456abc41::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticIniteee3c7b8a73ec51612a23479456abc41::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticIniteee3c7b8a73ec51612a23479456abc41::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit7ca01c3532cfed17a5a881fa84c4b98c::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit7ca01c3532cfed17a5a881fa84c4b98c::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit7ca01c3532cfed17a5a881fa84c4b98c::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
16
vendor/composer/installed.json
vendored
16
vendor/composer/installed.json
vendored
|
@ -1167,17 +1167,17 @@
|
|||
},
|
||||
{
|
||||
"name": "rector\/rector-doctrine",
|
||||
"version": "0.11.3",
|
||||
"version_normalized": "0.11.3.0",
|
||||
"version": "0.11.4",
|
||||
"version_normalized": "0.11.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
|
||||
"reference": "5899205a3e49d08d2dc05206fe08c36c127e6cd0"
|
||||
"reference": "e890a52131d6f05808c1f78f18faeb1d5c597e46"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/5899205a3e49d08d2dc05206fe08c36c127e6cd0",
|
||||
"reference": "5899205a3e49d08d2dc05206fe08c36c127e6cd0",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/e890a52131d6f05808c1f78f18faeb1d5c597e46",
|
||||
"reference": "e890a52131d6f05808c1f78f18faeb1d5c597e46",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1188,14 +1188,16 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"doctrine\/orm": "^2.9",
|
||||
"phpstan\/extension-installer": "^1.1",
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"rector\/rector-generator": "^0.2",
|
||||
"rector\/rector-src": "^0.11.2",
|
||||
"symplify\/easy-coding-standard": "^9.2",
|
||||
"symplify\/phpstan-extensions": "^9.2",
|
||||
"symplify\/phpstan-rules": "^9.2",
|
||||
"symplify\/rule-doc-generator": "^9.2"
|
||||
},
|
||||
"time": "2021-06-03T12:35:00+00:00",
|
||||
"time": "2021-06-14T22:51:40+00:00",
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@ -1220,7 +1222,7 @@
|
|||
"description": "Rector upgrades rules for Doctrine",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/rectorphp\/rector-doctrine\/issues",
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-doctrine\/tree\/0.11.3"
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-doctrine\/tree\/0.11.4"
|
||||
},
|
||||
"install-path": "..\/rector\/rector-doctrine"
|
||||
},
|
||||
|
|
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-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.2'), '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' => '0.11.3'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.1'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.4'), 'rector/rector-nette-to-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette-to-symfony', 'relative_install_path' => '../../rector-nette-to-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), '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' => '0.11.1'), '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' => '0.11.5'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.16'));
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.2'), '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' => '0.11.4'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.1'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.4'), 'rector/rector-nette-to-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette-to-symfony', 'relative_install_path' => '../../rector-nette-to-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), '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' => '0.11.1'), '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' => '0.11.5'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.16'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
4
vendor/rector/rector-doctrine/composer.json
vendored
4
vendor/rector/rector-doctrine/composer.json
vendored
|
@ -7,13 +7,15 @@
|
|||
"php": ">=8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan\/extension-installer": "^1.1",
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"symplify\/phpstan-rules": "^9.2",
|
||||
"symplify\/phpstan-extensions": "^9.2",
|
||||
"symplify\/easy-coding-standard": "^9.2",
|
||||
"symplify\/rule-doc-generator": "^9.2",
|
||||
"rector\/rector-src": "^0.11.2",
|
||||
"doctrine\/orm": "^2.9"
|
||||
"doctrine\/orm": "^2.9",
|
||||
"rector\/rector-generator": "^0.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
132
vendor/rector/rector-doctrine/src/Rector/Class_/ClassAnnotationToNamedArgumentConstructorRector.php
vendored
Normal file
132
vendor/rector/rector-doctrine/src/Rector/Class_/ClassAnnotationToNamedArgumentConstructorRector.php
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\Rector\Class_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\Type\ArrayType;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @changelog https://github.com/doctrine/annotations/blob/1.13.x/docs/en/custom.rst#optional-constructors-with-named-parameters
|
||||
*
|
||||
* @see \Rector\Doctrine\Tests\Rector\Class_\ClassAnnotationToNamedArgumentConstructorRector\ClassAnnotationToNamedArgumentConstructorRectorTest
|
||||
*/
|
||||
final class ClassAnnotationToNamedArgumentConstructorRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Decorate classic array-based class annotation with named parameters', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
class SomeAnnotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $foo;
|
||||
|
||||
public function __construct(array $values)
|
||||
{
|
||||
$this->foo = $values['foo'];
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
/**
|
||||
* @Annotation
|
||||
* @\Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor
|
||||
*/
|
||||
class SomeAnnotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $foo;
|
||||
|
||||
public function __construct(string $foo)
|
||||
{
|
||||
$this->foo = $foo;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<\PhpParser\Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Stmt\Class_::class];
|
||||
}
|
||||
/**
|
||||
* @param Class_ $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($node);
|
||||
if ($phpDocInfo === null) {
|
||||
return null;
|
||||
}
|
||||
if (!$phpDocInfo->hasByNames(['annotation', 'Annotation'])) {
|
||||
return null;
|
||||
}
|
||||
if ($phpDocInfo->hasByAnnotationClass('Doctrine\\Common\\Annotations\\Annotation\\NamedArgumentConstructor')) {
|
||||
return null;
|
||||
}
|
||||
$doctrineAnnotationTagValueNode = new \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode('Doctrine\\Common\\Annotations\\Annotation\\NamedArgumentConstructor');
|
||||
$phpDocInfo->addTagValueNode($doctrineAnnotationTagValueNode);
|
||||
$classMethod = $node->getMethod(\Rector\Core\ValueObject\MethodName::CONSTRUCT);
|
||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
return null;
|
||||
}
|
||||
if (\count($classMethod->params) !== 1) {
|
||||
return null;
|
||||
}
|
||||
$onlyParam = $classMethod->params[0];
|
||||
// change array to properites
|
||||
if ($onlyParam->type) {
|
||||
$paramType = $this->nodeTypeResolver->getStaticType($onlyParam);
|
||||
// we have a match
|
||||
if (!$paramType instanceof \PHPStan\Type\ArrayType) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/** @var Assign[] $assigns */
|
||||
$assigns = $this->betterNodeFinder->findInstanceOf($node->stmts, \PhpParser\Node\Expr\Assign::class);
|
||||
$params = [];
|
||||
foreach ($assigns as $assign) {
|
||||
if (!$assign->var instanceof \PhpParser\Node\Expr\PropertyFetch) {
|
||||
continue;
|
||||
}
|
||||
// decorate property fetches to params
|
||||
$propertyFetch = $assign->var;
|
||||
$propertyName = $this->nodeNameResolver->getName($propertyFetch->name);
|
||||
if ($propertyName === null) {
|
||||
continue;
|
||||
}
|
||||
$variable = new \PhpParser\Node\Expr\Variable($propertyName);
|
||||
$params[] = $this->createParam($propertyFetch, $variable);
|
||||
$assign->expr = $variable;
|
||||
}
|
||||
$classMethod->params = $params;
|
||||
return $node;
|
||||
}
|
||||
private function createParam(\PhpParser\Node\Expr\PropertyFetch $propertyFetch, \PhpParser\Node\Expr\Variable $variable) : \PhpParser\Node\Param
|
||||
{
|
||||
$param = new \PhpParser\Node\Param($variable);
|
||||
$paramType = $this->nodeTypeResolver->getStaticType($propertyFetch);
|
||||
$param->type = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($paramType);
|
||||
return $param;
|
||||
}
|
||||
}
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
|
@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
|
|||
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||
spl_autoload_call('RectorPrefix20210614\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderIniteee3c7b8a73ec51612a23479456abc41', false) && !interface_exists('ComposerAutoloaderIniteee3c7b8a73ec51612a23479456abc41', false) && !trait_exists('ComposerAutoloaderIniteee3c7b8a73ec51612a23479456abc41', false)) {
|
||||
spl_autoload_call('RectorPrefix20210614\ComposerAutoloaderIniteee3c7b8a73ec51612a23479456abc41');
|
||||
if (!class_exists('ComposerAutoloaderInit7ca01c3532cfed17a5a881fa84c4b98c', false) && !interface_exists('ComposerAutoloaderInit7ca01c3532cfed17a5a881fa84c4b98c', false) && !trait_exists('ComposerAutoloaderInit7ca01c3532cfed17a5a881fa84c4b98c', false)) {
|
||||
spl_autoload_call('RectorPrefix20210614\ComposerAutoloaderInit7ca01c3532cfed17a5a881fa84c4b98c');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210614\Doctrine\Inflector\Inflector');
|
||||
|
@ -3323,9 +3323,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20210614\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequireeee3c7b8a73ec51612a23479456abc41')) {
|
||||
function composerRequireeee3c7b8a73ec51612a23479456abc41() {
|
||||
return \RectorPrefix20210614\composerRequireeee3c7b8a73ec51612a23479456abc41(...func_get_args());
|
||||
if (!function_exists('composerRequire7ca01c3532cfed17a5a881fa84c4b98c')) {
|
||||
function composerRequire7ca01c3532cfed17a5a881fa84c4b98c() {
|
||||
return \RectorPrefix20210614\composerRequire7ca01c3532cfed17a5a881fa84c4b98c(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user