mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-30 16:00:52 +00:00
Updated Rector to commit bd68c98f0bc5cb8b41a62dd9e7bd94bf82e731a5
bd68c98f0b
Run tests workflow as well on push (#3301)
This commit is contained in:
parent
a0a7aca50e
commit
f82175f981
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 ComposerAutoloaderInit1c7eb6da90a8fe61c0643f0a792b7779::getLoader();
|
||||
return ComposerAutoloaderInit2f8eda5f75af331f44fc1f9e8c17ae91::getLoader();
|
||||
|
|
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 ComposerAutoloaderInit1c7eb6da90a8fe61c0643f0a792b7779
|
||||
class ComposerAutoloaderInit2f8eda5f75af331f44fc1f9e8c17ae91
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit1c7eb6da90a8fe61c0643f0a792b7779
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit1c7eb6da90a8fe61c0643f0a792b7779', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit2f8eda5f75af331f44fc1f9e8c17ae91', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit1c7eb6da90a8fe61c0643f0a792b7779', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit2f8eda5f75af331f44fc1f9e8c17ae91', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit1c7eb6da90a8fe61c0643f0a792b7779::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit1c7eb6da90a8fe61c0643f0a792b7779::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91::$files;
|
||||
$requireFile = static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit1c7eb6da90a8fe61c0643f0a792b7779
|
||||
class ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3074,9 +3074,9 @@ class ComposerStaticInit1c7eb6da90a8fe61c0643f0a792b7779
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit1c7eb6da90a8fe61c0643f0a792b7779::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit1c7eb6da90a8fe61c0643f0a792b7779::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit1c7eb6da90a8fe61c0643f0a792b7779::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -2126,12 +2126,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "fc94862f8cde756f6127d7a63fff34460338f921"
|
||||
"reference": "8dc191dff31aed2fbfa57e710a48d9837a4d69da"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/fc94862f8cde756f6127d7a63fff34460338f921",
|
||||
"reference": "fc94862f8cde756f6127d7a63fff34460338f921",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/8dc191dff31aed2fbfa57e710a48d9837a4d69da",
|
||||
"reference": "8dc191dff31aed2fbfa57e710a48d9837a4d69da",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2165,7 +2165,7 @@
|
|||
"tomasvotruba\/type-coverage": "^0.0.9",
|
||||
"tomasvotruba\/unused-public": "^0.0.34"
|
||||
},
|
||||
"time": "2023-01-22T23:04:35+00:00",
|
||||
"time": "2023-01-23T21:24:23+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 f0c3c11'), '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 cda9d4d'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), '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 2cfc0a5'), '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 fc94862'));
|
||||
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 f0c3c11'), '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 cda9d4d'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), '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 2cfc0a5'), '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 8dc191d'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ use PHPStan\Type\ObjectType;
|
|||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Symfony\NodeAnalyzer\ServiceTypeMethodCallResolver;
|
||||
use Rector\Symfony\NodeFactory\RequiredClassMethodFactory;
|
||||
use Rector\Symfony\TypeAnalyzer\ContainerAwareAnalyzer;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
|
@ -37,10 +38,16 @@ final class ContainerGetToRequiredDependencyAbstractClassRector extends Abstract
|
|||
* @var \Rector\Symfony\NodeFactory\RequiredClassMethodFactory
|
||||
*/
|
||||
private $requiredClassMethodFactory;
|
||||
public function __construct(ServiceTypeMethodCallResolver $serviceTypeMethodCallResolver, RequiredClassMethodFactory $requiredClassMethodFactory)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Symfony\TypeAnalyzer\ContainerAwareAnalyzer
|
||||
*/
|
||||
private $containerAwareAnalyzer;
|
||||
public function __construct(ServiceTypeMethodCallResolver $serviceTypeMethodCallResolver, RequiredClassMethodFactory $requiredClassMethodFactory, ContainerAwareAnalyzer $containerAwareAnalyzer)
|
||||
{
|
||||
$this->serviceTypeMethodCallResolver = $serviceTypeMethodCallResolver;
|
||||
$this->requiredClassMethodFactory = $requiredClassMethodFactory;
|
||||
$this->containerAwareAnalyzer = $containerAwareAnalyzer;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
|
@ -93,7 +100,7 @@ CODE_SAMPLE
|
|||
if (!$node->isAbstract()) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isObjectType($node, new ObjectType('Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController'))) {
|
||||
if (!$this->containerAwareAnalyzer->isGetMethodAwareType($node)) {
|
||||
return null;
|
||||
}
|
||||
$this->autowiredTypes = [];
|
||||
|
@ -116,14 +123,8 @@ CODE_SAMPLE
|
|||
if ($this->autowiredTypes === []) {
|
||||
return null;
|
||||
}
|
||||
$newStmts = [];
|
||||
foreach ($this->autowiredTypes as $autowiredType) {
|
||||
$propertyName = $this->resolveVariableNameFromClassName($autowiredType);
|
||||
$propertyBuilder = new Property($propertyName);
|
||||
$propertyBuilder->makePrivate();
|
||||
$propertyBuilder->setType(new FullyQualified($autowiredType));
|
||||
$newStmts[] = $propertyBuilder->getNode();
|
||||
}
|
||||
$autowiredTypes = \array_unique($this->autowiredTypes);
|
||||
$newStmts = $this->createPropertyStmts($autowiredTypes);
|
||||
$newStmts[] = $this->requiredClassMethodFactory->createRequiredAutowireClassMethod($this->autowiredTypes);
|
||||
$node->stmts = \array_merge($newStmts, $node->stmts);
|
||||
return $node;
|
||||
|
@ -149,4 +150,20 @@ CODE_SAMPLE
|
|||
}
|
||||
return \lcfirst($shortClassName);
|
||||
}
|
||||
/**
|
||||
* @param string[] $autowiredTypes
|
||||
* @return Node\Stmt\Property[]
|
||||
*/
|
||||
private function createPropertyStmts(array $autowiredTypes) : array
|
||||
{
|
||||
$properties = [];
|
||||
foreach ($autowiredTypes as $autowiredType) {
|
||||
$propertyName = $this->resolveVariableNameFromClassName($autowiredType);
|
||||
$propertyBuilder = new Property($propertyName);
|
||||
$propertyBuilder->makePrivate();
|
||||
$propertyBuilder->setType(new FullyQualified($autowiredType));
|
||||
$properties[] = $propertyBuilder->getNode();
|
||||
}
|
||||
return $properties;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\Symfony\TypeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
final class ContainerAwareAnalyzer
|
||||
|
@ -22,8 +22,8 @@ final class ContainerAwareAnalyzer
|
|||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->getMethodAwareObjectTypes = [new ObjectType('Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController'), new ObjectType('Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller'), new ObjectType('Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerTrait')];
|
||||
}
|
||||
public function isGetMethodAwareType(Expr $expr) : bool
|
||||
public function isGetMethodAwareType(Node $node) : bool
|
||||
{
|
||||
return $this->nodeTypeResolver->isObjectTypes($expr, $this->getMethodAwareObjectTypes);
|
||||
return $this->nodeTypeResolver->isObjectTypes($node, $this->getMethodAwareObjectTypes);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user