Updated Rector to commit fabc27e122

fabc27e122 Cherry picks (#1074)
This commit is contained in:
Tomas Votruba 2021-10-26 23:10:48 +00:00
parent 855541443a
commit 3017b511f6
19 changed files with 132 additions and 76 deletions

View File

@ -34,7 +34,7 @@ use Rector\Core\PhpParser\Parser\PhpParserLexerFactory;
use Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory;
use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocator\IntermediateSourceLocator;
use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider;
use RectorPrefix20211026\Symfony\Component\Console\Application as SymfonyApplication;
use RectorPrefix20211026\Symfony\Component\Console\Application;
use RectorPrefix20211026\Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use function RectorPrefix20211026\Symfony\Component\DependencyInjection\Loader\Configurator\service;

View File

@ -3,26 +3,28 @@
declare (strict_types=1);
namespace Rector\NodeCollector\ScopeResolver;
use PhpParser\Node;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use Rector\NodeTypeResolver\Node\AttributeKey;
final class ParentClassScopeResolver
{
public function resolveParentClassName(\PhpParser\Node $node) : ?string
public function resolveParentClassName(\PHPStan\Analyser\Scope $scope) : ?string
{
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
if (!$scope instanceof \PHPStan\Analyser\Scope) {
$parentClassReflection = $this->resolveParentClassReflection($scope);
if (!$parentClassReflection instanceof \PHPStan\Reflection\ClassReflection) {
return null;
}
return $parentClassReflection->getName();
}
public function resolveParentClassReflection(\PHPStan\Analyser\Scope $scope) : ?\PHPStan\Reflection\ClassReflection
{
$classReflection = $scope->getClassReflection();
if (!$classReflection instanceof \PHPStan\Reflection\ClassReflection) {
return null;
}
$parentClassReflection = $classReflection->getParentClass();
if ($parentClassReflection === \false) {
return null;
if ($parentClassReflection instanceof \PHPStan\Reflection\ClassReflection) {
return $parentClassReflection;
}
return $parentClassReflection->getName();
return null;
}
}

View File

@ -74,7 +74,7 @@ final class IdentifierTypeMapper implements \Rector\StaticTypeMapper\Contract\Ph
return $this->mapSelf($node);
}
if ($loweredName === \Rector\Core\Enum\ObjectReference::PARENT()->getValue()) {
return $this->mapParent($node, $scope);
return $this->mapParent($scope);
}
if ($loweredName === \Rector\Core\Enum\ObjectReference::STATIC()->getValue()) {
return $this->mapStatic($node, $scope);
@ -102,17 +102,13 @@ final class IdentifierTypeMapper implements \Rector\StaticTypeMapper\Contract\Ph
/**
* @return \Rector\StaticTypeMapper\ValueObject\Type\ParentStaticType|\PHPStan\Type\MixedType
*/
private function mapParent(\PhpParser\Node $node, \PHPStan\Analyser\Scope $scope)
private function mapParent(\PHPStan\Analyser\Scope $scope)
{
$parentClassName = $this->parentClassScopeResolver->resolveParentClassName($node);
if ($parentClassName === null) {
$parentClassReflection = $this->parentClassScopeResolver->resolveParentClassReflection($scope);
if (!$parentClassReflection instanceof \PHPStan\Reflection\ClassReflection) {
return new \PHPStan\Type\MixedType();
}
$classReflection = $scope->getClassReflection();
if (!$classReflection instanceof \PHPStan\Reflection\ClassReflection) {
throw new \Rector\Core\Exception\ShouldNotHappenException();
}
return new \Rector\StaticTypeMapper\ValueObject\Type\ParentStaticType($classReflection);
return new \Rector\StaticTypeMapper\ValueObject\Type\ParentStaticType($parentClassReflection);
}
/**
* @return \PHPStan\Type\MixedType|\PHPStan\Type\StaticType

View File

@ -9,6 +9,7 @@ use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use PHPStan\Reflection\ClassReflection;
use Rector\Core\Enum\ObjectReference;
use Rector\Core\NodeAnalyzer\ClassAnalyzer;
use Rector\Core\NodeManipulator\ClassMethodManipulator;
@ -83,8 +84,9 @@ CODE_SAMPLE
if (!$this->isName($node->class, \Rector\Core\Enum\ObjectReference::PARENT()->getValue())) {
return null;
}
$parentClassName = $this->parentClassScopeResolver->resolveParentClassName($node);
if ($parentClassName === null) {
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
$parentClassReflection = $this->parentClassScopeResolver->resolveParentClassReflection($scope);
if (!$parentClassReflection instanceof \PHPStan\Reflection\ClassReflection) {
$this->removeNode($node);
return null;
}

View File

@ -12,12 +12,12 @@ use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use Rector\Core\Enum\ObjectReference;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\MethodName;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\NodeCollector\ScopeResolver\ParentClassScopeResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Php70\NodeAnalyzer\Php4ConstructorClassMethodAnalyzer;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
@ -33,9 +33,14 @@ final class Php4ConstructorRector extends \Rector\Core\Rector\AbstractRector imp
* @var \Rector\Php70\NodeAnalyzer\Php4ConstructorClassMethodAnalyzer
*/
private $php4ConstructorClassMethodAnalyzer;
public function __construct(\Rector\Php70\NodeAnalyzer\Php4ConstructorClassMethodAnalyzer $php4ConstructorClassMethodAnalyzer)
/**
* @var \Rector\NodeCollector\ScopeResolver\ParentClassScopeResolver
*/
private $parentClassScopeResolver;
public function __construct(\Rector\Php70\NodeAnalyzer\Php4ConstructorClassMethodAnalyzer $php4ConstructorClassMethodAnalyzer, \Rector\NodeCollector\ScopeResolver\ParentClassScopeResolver $parentClassScopeResolver)
{
$this->php4ConstructorClassMethodAnalyzer = $php4ConstructorClassMethodAnalyzer;
$this->parentClassScopeResolver = $parentClassScopeResolver;
}
public function provideMinPhpVersion() : int
{
@ -126,43 +131,28 @@ CODE_SAMPLE
}
private function processParentPhp4ConstructCall(\PhpParser\Node\Expr\StaticCall $staticCall) : void
{
$parentClassName = $this->resolveParentClassName($staticCall);
$scope = $staticCall->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
$parentClassReflection = $this->parentClassScopeResolver->resolveParentClassReflection($scope);
// no parent class
if ($parentClassName === null) {
if (!$parentClassReflection instanceof \PHPStan\Reflection\ClassReflection) {
return;
}
if (!$staticCall->class instanceof \PhpParser\Node\Name) {
return;
}
// rename ParentClass
if ($this->isName($staticCall->class, $parentClassName)) {
if ($this->isName($staticCall->class, $parentClassReflection->getName())) {
$staticCall->class = new \PhpParser\Node\Name(\Rector\Core\Enum\ObjectReference::PARENT()->getValue());
}
if (!$this->isName($staticCall->class, \Rector\Core\Enum\ObjectReference::PARENT()->getValue())) {
return;
}
// it's not a parent PHP 4 constructor call
if (!$this->isName($staticCall->name, $parentClassName)) {
if (!$this->isName($staticCall->name, $parentClassReflection->getName())) {
return;
}
$staticCall->name = new \PhpParser\Node\Identifier(\Rector\Core\ValueObject\MethodName::CONSTRUCT);
}
private function resolveParentClassName(\PhpParser\Node\Expr\StaticCall $staticCall) : ?string
{
$scope = $staticCall->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
if (!$scope instanceof \PHPStan\Analyser\Scope) {
return null;
}
$classReflection = $scope->getClassReflection();
if (!$classReflection instanceof \PHPStan\Reflection\ClassReflection) {
return null;
}
$parentClassReflection = $classReflection->getParentClass();
if (!$parentClassReflection instanceof \PHPStan\Reflection\ClassReflection) {
return null;
}
return $parentClassReflection->getName();
}
private function isLocalMethodCallNamed(\PhpParser\Node\Expr $expr, string $name) : bool
{
if (!$expr instanceof \PhpParser\Node\Expr\MethodCall) {

View File

@ -18,6 +18,7 @@ use Rector\Core\Reflection\ReflectionResolver;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\NodeCollector\ScopeResolver\ParentClassScopeResolver;
use Rector\NodeCollector\StaticAnalyzer;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
use ReflectionMethod;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@ -147,7 +148,8 @@ CODE_SAMPLE
if ($className === 'class') {
return \true;
}
$parentClassName = $this->parentClassScopeResolver->resolveParentClassName($staticCall);
$scope = $staticCall->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
$parentClassName = $this->parentClassScopeResolver->resolveParentClassName($scope);
return $className === $parentClassName;
}
private function isInstantiable(string $className) : bool

View File

@ -5,9 +5,11 @@ namespace Rector\Removing\Rector\Class_;
use PhpParser\Node;
use PhpParser\Node\Stmt\Class_;
use PHPStan\Reflection\ClassReflection;
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
use Rector\Core\Rector\AbstractRector;
use Rector\NodeCollector\ScopeResolver\ParentClassScopeResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -58,12 +60,13 @@ CODE_SAMPLE
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
{
$parentClassName = $this->parentClassScopeResolver->resolveParentClassName($node);
if ($parentClassName === null) {
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
$parentClassReflection = $this->parentClassScopeResolver->resolveParentClassReflection($scope);
if (!$parentClassReflection instanceof \PHPStan\Reflection\ClassReflection) {
return null;
}
foreach ($this->parentClassesToRemove as $parentClassToRemove) {
if ($parentClassName !== $parentClassToRemove) {
if ($parentClassReflection->getName() !== $parentClassToRemove) {
continue;
}
// remove parent class

View File

@ -9,6 +9,7 @@ use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\Visibility;
use Rector\NodeCollector\ScopeResolver\ParentClassScopeResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Visibility\ValueObject\ChangeMethodVisibility;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -80,7 +81,8 @@ CODE_SAMPLE
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
{
$parentClassName = $this->parentClassScopeResolver->resolveParentClassName($node);
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
$parentClassName = $this->parentClassScopeResolver->resolveParentClassName($scope);
if ($parentClassName === null) {
return null;
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'edd1ebd5f6fffd80706efec452804494af20a0a3';
public const PACKAGE_VERSION = 'fabc27e1229c75ae5920f3a010b7af0d52f2ff8d';
/**
* @var string
*/
public const RELEASE_DATE = '2021-10-26 22:44:56';
public const RELEASE_DATE = '2021-10-26 22:57:21';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20211026\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitd7db1d72149fb027bfc5af91ac4ec9f6::getLoader();
return ComposerAutoloaderInitcf58ba53c8269cd7e9ccd18dd49a6836::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitd7db1d72149fb027bfc5af91ac4ec9f6
class ComposerAutoloaderInitcf58ba53c8269cd7e9ccd18dd49a6836
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInitd7db1d72149fb027bfc5af91ac4ec9f6
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitd7db1d72149fb027bfc5af91ac4ec9f6', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitcf58ba53c8269cd7e9ccd18dd49a6836', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitd7db1d72149fb027bfc5af91ac4ec9f6', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitcf58ba53c8269cd7e9ccd18dd49a6836', '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\ComposerStaticInitd7db1d72149fb027bfc5af91ac4ec9f6::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitcf58ba53c8269cd7e9ccd18dd49a6836::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInitd7db1d72149fb027bfc5af91ac4ec9f6
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitd7db1d72149fb027bfc5af91ac4ec9f6::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitcf58ba53c8269cd7e9ccd18dd49a6836::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequired7db1d72149fb027bfc5af91ac4ec9f6($fileIdentifier, $file);
composerRequirecf58ba53c8269cd7e9ccd18dd49a6836($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequired7db1d72149fb027bfc5af91ac4ec9f6($fileIdentifier, $file)
function composerRequirecf58ba53c8269cd7e9ccd18dd49a6836($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitd7db1d72149fb027bfc5af91ac4ec9f6
class ComposerStaticInitcf58ba53c8269cd7e9ccd18dd49a6836
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3890,9 +3890,9 @@ class ComposerStaticInitd7db1d72149fb027bfc5af91ac4ec9f6
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitd7db1d72149fb027bfc5af91ac4ec9f6::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd7db1d72149fb027bfc5af91ac4ec9f6::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitd7db1d72149fb027bfc5af91ac4ec9f6::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitcf58ba53c8269cd7e9ccd18dd49a6836::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitcf58ba53c8269cd7e9ccd18dd49a6836::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitcf58ba53c8269cd7e9ccd18dd49a6836::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1534,17 +1534,17 @@
},
{
"name": "rector\/rector-symfony",
"version": "0.11.29",
"version_normalized": "0.11.29.0",
"version": "0.11.30",
"version_normalized": "0.11.30.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "4d65712da20c9a1543d96a7fef9c3848c374ebaa"
"reference": "785ae5870d610f5af3d63a91fdeec3bd4f0267c3"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/4d65712da20c9a1543d96a7fef9c3848c374ebaa",
"reference": "4d65712da20c9a1543d96a7fef9c3848c374ebaa",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/785ae5870d610f5af3d63a91fdeec3bd4f0267c3",
"reference": "785ae5870d610f5af3d63a91fdeec3bd4f0267c3",
"shasum": ""
},
"require": {
@ -1567,7 +1567,7 @@
"symplify\/phpstan-rules": "^9.4",
"symplify\/rule-doc-generator": "^9.4"
},
"time": "2021-10-25T18:21:20+00:00",
"time": "2021-10-26T22:48:50+00:00",
"type": "rector-extension",
"extra": {
"branch-alias": {
@ -1592,7 +1592,7 @@
"description": "Rector upgrades rules for Symfony Framework",
"support": {
"issues": "https:\/\/github.com\/rectorphp\/rector-symfony\/issues",
"source": "https:\/\/github.com\/rectorphp\/rector-symfony\/tree\/0.11.29"
"source": "https:\/\/github.com\/rectorphp\/rector-symfony\/tree\/0.11.30"
},
"install-path": "..\/rector\/rector-symfony"
},

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-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.5'), '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.25'), '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.8'), '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.29'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.4'), '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.13'), '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.29'), '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.26'));
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.5'), '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.25'), '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.8'), '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.29'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.4'), '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.13'), '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.30'), '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.26'));
private function __construct()
{
}

View File

@ -6,6 +6,7 @@ namespace Rector\Symfony\Bridge\NodeAnalyzer;
use PhpParser\Node;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\NodeCollector\ScopeResolver\ParentClassScopeResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
final class ControllerMethodAnalyzer
{
/**
@ -24,7 +25,8 @@ final class ControllerMethodAnalyzer
if (!$node instanceof \PhpParser\Node\Stmt\ClassMethod) {
return \false;
}
$parentClassName = (string) $this->parentClassScopeResolver->resolveParentClassName($node);
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
$parentClassName = (string) $this->parentClassScopeResolver->resolveParentClassName($scope);
if (\substr_compare($parentClassName, 'Controller', -\strlen('Controller')) === 0) {
return \true;
}

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20211026\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInitd7db1d72149fb027bfc5af91ac4ec9f6', false) && !interface_exists('ComposerAutoloaderInitd7db1d72149fb027bfc5af91ac4ec9f6', false) && !trait_exists('ComposerAutoloaderInitd7db1d72149fb027bfc5af91ac4ec9f6', false)) {
spl_autoload_call('RectorPrefix20211026\ComposerAutoloaderInitd7db1d72149fb027bfc5af91ac4ec9f6');
if (!class_exists('ComposerAutoloaderInitcf58ba53c8269cd7e9ccd18dd49a6836', false) && !interface_exists('ComposerAutoloaderInitcf58ba53c8269cd7e9ccd18dd49a6836', false) && !trait_exists('ComposerAutoloaderInitcf58ba53c8269cd7e9ccd18dd49a6836', false)) {
spl_autoload_call('RectorPrefix20211026\ComposerAutoloaderInitcf58ba53c8269cd7e9ccd18dd49a6836');
}
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('RectorPrefix20211026\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -3306,9 +3306,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20211026\print_node(...func_get_args());
}
}
if (!function_exists('composerRequired7db1d72149fb027bfc5af91ac4ec9f6')) {
function composerRequired7db1d72149fb027bfc5af91ac4ec9f6() {
return \RectorPrefix20211026\composerRequired7db1d72149fb027bfc5af91ac4ec9f6(...func_get_args());
if (!function_exists('composerRequirecf58ba53c8269cd7e9ccd18dd49a6836')) {
function composerRequirecf58ba53c8269cd7e9ccd18dd49a6836() {
return \RectorPrefix20211026\composerRequirecf58ba53c8269cd7e9ccd18dd49a6836(...func_get_args());
}
}
if (!function_exists('parseArgs')) {

View File

@ -134,6 +134,9 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
$str->string .= $s;
return $str;
}
/**
* @return mixed
*/
public function camel()
{
$str = clone $this;
@ -159,6 +162,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
return $codePoints;
}
/**
* @return mixed
* @param bool $compat
*/
public function folded($compat = \true)
@ -173,6 +177,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
return $str;
}
/**
* @return mixed
* @param mixed[] $strings
* @param string|null $lastGlue
*/
@ -186,6 +191,9 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
}
return $str;
}
/**
* @return mixed
*/
public function lower()
{
$str = clone $this;
@ -240,6 +248,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
return $str;
}
/**
* @return mixed
* @param int $length
* @param string $padStr
*/
@ -253,6 +262,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
return $this->pad($length, $pad, \STR_PAD_BOTH);
}
/**
* @return mixed
* @param int $length
* @param string $padStr
*/
@ -266,6 +276,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
return $this->pad($length, $pad, \STR_PAD_RIGHT);
}
/**
* @return mixed
* @param int $length
* @param string $padStr
*/
@ -279,6 +290,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
return $this->pad($length, $pad, \STR_PAD_LEFT);
}
/**
* @return mixed
* @param string $fromRegexp
*/
public function replaceMatches($fromRegexp, $to)
@ -323,12 +335,18 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
$str->string = $string;
return $str;
}
/**
* @return mixed
*/
public function reverse()
{
$str = clone $this;
$str->string = \implode('', \array_reverse(\preg_split('/(\\X)/u', $str->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY)));
return $str;
}
/**
* @return mixed
*/
public function snake()
{
$str = $this->camel()->title();
@ -336,6 +354,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
return $str;
}
/**
* @return mixed
* @param bool $allWords
*/
public function title($allWords = \false)
@ -348,6 +367,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
return $str;
}
/**
* @return mixed
* @param string $chars
*/
public function trim($chars = " \t\n\r\0\v\f ")
@ -361,6 +381,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
return $str;
}
/**
* @return mixed
* @param string $chars
*/
public function trimEnd($chars = " \t\n\r\0\v\f ")
@ -374,6 +395,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
return $str;
}
/**
* @return mixed
* @param string $chars
*/
public function trimStart($chars = " \t\n\r\0\v\f ")
@ -386,6 +408,9 @@ abstract class AbstractUnicodeString extends \RectorPrefix20211026\Symfony\Compo
$str->string = \preg_replace("{^[{$chars}]++}uD", '', $str->string);
return $str;
}
/**
* @return mixed
*/
public function upper()
{
$str = clone $this;

View File

@ -88,6 +88,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return '' === $str ? [] : [\ord($str)];
}
/**
* @return mixed
* @param string ...$suffix
*/
public function append(...$suffix)
@ -96,6 +97,9 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
$str->string .= 1 >= \count($suffix) ? $suffix[0] ?? '' : \implode('', $suffix);
return $str;
}
/**
* @return mixed
*/
public function camel()
{
$str = clone $this;
@ -146,6 +150,9 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
}
return $string === $this->string;
}
/**
* @return mixed
*/
public function folded()
{
$str = clone $this;
@ -193,6 +200,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return '' === $this->string || \preg_match('//u', $this->string);
}
/**
* @return mixed
* @param mixed[] $strings
* @param string|null $lastGlue
*/
@ -207,6 +215,9 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
{
return \strlen($this->string);
}
/**
* @return mixed
*/
public function lower()
{
$str = clone $this;
@ -248,6 +259,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $matches;
}
/**
* @return mixed
* @param int $length
* @param string $padStr
*/
@ -258,6 +270,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $str;
}
/**
* @return mixed
* @param int $length
* @param string $padStr
*/
@ -268,6 +281,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $str;
}
/**
* @return mixed
* @param int $length
* @param string $padStr
*/
@ -278,6 +292,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $str;
}
/**
* @return mixed
* @param string ...$prefix
*/
public function prepend(...$prefix)
@ -287,6 +302,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $str;
}
/**
* @return mixed
* @param string $from
* @param string $to
*/
@ -299,6 +315,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $str;
}
/**
* @return mixed
* @param string $fromRegexp
*/
public function replaceMatches($fromRegexp, $to)
@ -334,6 +351,9 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
$str->string = $string;
return $str;
}
/**
* @return mixed
*/
public function reverse()
{
$str = clone $this;
@ -341,6 +361,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $str;
}
/**
* @return mixed
* @param int $start
* @param int|null $length
*/
@ -350,6 +371,9 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
$str->string = (string) \substr($this->string, $start, $length ?? \PHP_INT_MAX);
return $str;
}
/**
* @return mixed
*/
public function snake()
{
$str = $this->camel()->title();
@ -357,6 +381,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $str;
}
/**
* @return mixed
* @param string $replacement
* @param int $start
* @param int|null $length
@ -401,6 +426,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return '' !== $prefix && 0 === ($this->ignoreCase ? \strncasecmp($this->string, $prefix, \strlen($prefix)) : \strncmp($this->string, $prefix, \strlen($prefix)));
}
/**
* @return mixed
* @param bool $allWords
*/
public function title($allWords = \false)
@ -449,6 +475,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $u;
}
/**
* @return mixed
* @param string $chars
*/
public function trim($chars = " \t\n\r\0\v\f")
@ -458,6 +485,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $str;
}
/**
* @return mixed
* @param string $chars
*/
public function trimEnd($chars = " \t\n\r\0\v\f")
@ -467,6 +495,7 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
return $str;
}
/**
* @return mixed
* @param string $chars
*/
public function trimStart($chars = " \t\n\r\0\v\f")
@ -475,6 +504,9 @@ class ByteString extends \RectorPrefix20211026\Symfony\Component\String\Abstract
$str->string = \ltrim($str->string, $chars);
return $str;
}
/**
* @return mixed
*/
public function upper()
{
$str = clone $this;