Updated Rector to commit bd68c98f0bc5cb8b41a62dd9e7bd94bf82e731a5

bd68c98f0b Run tests workflow as well on push (#3301)
This commit is contained in:
Tomas Votruba 2023-01-23 21:59:09 +00:00
parent f82175f981
commit f904de44f2
9 changed files with 37 additions and 20 deletions

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit2f8eda5f75af331f44fc1f9e8c17ae91::getLoader();
return ComposerAutoloaderInit274bd0da1f70b52e1bb33d788f1d209e::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit2f8eda5f75af331f44fc1f9e8c17ae91
class ComposerAutoloaderInit274bd0da1f70b52e1bb33d788f1d209e
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit2f8eda5f75af331f44fc1f9e8c17ae91
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit2f8eda5f75af331f44fc1f9e8c17ae91', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit274bd0da1f70b52e1bb33d788f1d209e', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit2f8eda5f75af331f44fc1f9e8c17ae91', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit274bd0da1f70b52e1bb33d788f1d209e', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit274bd0da1f70b52e1bb33d788f1d209e::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit274bd0da1f70b52e1bb33d788f1d209e::$files;
$requireFile = static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91
class ComposerStaticInit274bd0da1f70b52e1bb33d788f1d209e
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3074,9 +3074,9 @@ class ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit2f8eda5f75af331f44fc1f9e8c17ae91::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit274bd0da1f70b52e1bb33d788f1d209e::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit274bd0da1f70b52e1bb33d788f1d209e::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit274bd0da1f70b52e1bb33d788f1d209e::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2126,12 +2126,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "8dc191dff31aed2fbfa57e710a48d9837a4d69da"
"reference": "368c1fa4a386863ef35da60aabbed12c367fe98c"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/8dc191dff31aed2fbfa57e710a48d9837a4d69da",
"reference": "8dc191dff31aed2fbfa57e710a48d9837a4d69da",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/368c1fa4a386863ef35da60aabbed12c367fe98c",
"reference": "368c1fa4a386863ef35da60aabbed12c367fe98c",
"shasum": ""
},
"require": {
@ -2165,7 +2165,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-01-23T21:24:23+00:00",
"time": "2023-01-23T21:50:26+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -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 8dc191d'));
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 368c1fa'));
private function __construct()
{
}

View File

@ -9,20 +9,27 @@ use PhpParser\Comment\Doc;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use Rector\Core\Exception\ShouldNotHappenException;
use RectorPrefix202301\Webmozart\Assert\Assert;
final class RequiredClassMethodFactory
{
/**
* @param string[] $classNames
*/
public function createRequiredAutowireClassMethod(array $classNames) : ClassMethod
public function createRequiredAutowireClassMethod(array $classNames, Class_ $class) : ClassMethod
{
Assert::allString($classNames);
$method = new Method('autowire');
if (!$class->name instanceof Identifier) {
throw new ShouldNotHappenException();
}
// use unique name per class, to avoid inheritance override
$method = new Method('autowire' . \ucfirst($class->name->toString()));
$method->makePublic();
foreach ($classNames as $className) {
$variableName = $this->resolveVariableNameFromClassName($className);

View File

@ -125,7 +125,7 @@ CODE_SAMPLE
}
$autowiredTypes = \array_unique($this->autowiredTypes);
$newStmts = $this->createPropertyStmts($autowiredTypes);
$newStmts[] = $this->requiredClassMethodFactory->createRequiredAutowireClassMethod($this->autowiredTypes);
$newStmts[] = $this->requiredClassMethodFactory->createRequiredAutowireClassMethod($this->autowiredTypes, $node);
$node->stmts = \array_merge($newStmts, $node->stmts);
return $node;
}

View File

@ -10,6 +10,7 @@ use PhpParser\Node\Expr\ArrayItem;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Rector\Symfony\TypeAnalyzer\ControllerAnalyzer;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -17,6 +18,15 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
*/
final class SimplifyFormRenderingRector extends AbstractRector
{
/**
* @readonly
* @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer
*/
private $controllerAnalyzer;
public function __construct(ControllerAnalyzer $controllerAnalyzer)
{
$this->controllerAnalyzer = $controllerAnalyzer;
}
public function getRuleDefinition() : RuleDefinition
{
return new RuleDefinition('Symplify form rendering by not calling `->createView()` on `render` function', [new CodeSample(<<<'CODE_SAMPLE'
@ -59,7 +69,7 @@ CODE_SAMPLE
*/
public function refactor(Node $node) : ?Node
{
if (!$this->isObjectType($node->var, new ObjectType('Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController'))) {
if (!$this->controllerAnalyzer->isController($node->var)) {
return null;
}
if ($node->isFirstClassCallable()) {