mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
Updated Rector to commit ba29e3fd5f1584fe54d9b1edbe78b15e592a1791
ba29e3fd5f
Re-use name scope (#2171)
This commit is contained in:
parent
63f8af346b
commit
c7ca691738
@ -7,7 +7,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2|^8.0",
|
||||
"phpstan/phpstan": "^1.5.6"
|
||||
"phpstan/phpstan": "^1.6"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
|
@ -44,7 +44,7 @@ use Rector\NodeTypeResolver\NodeTypeCorrector\HasOffsetTypeCorrector;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver\IdentifierTypeResolver;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType;
|
||||
use Rector\TypeDeclaration\PHPStan\Type\ObjectTypeSpecifier;
|
||||
use Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier;
|
||||
final class NodeTypeResolver
|
||||
{
|
||||
/**
|
||||
@ -53,7 +53,7 @@ final class NodeTypeResolver
|
||||
private $nodeTypeResolvers = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\TypeDeclaration\PHPStan\Type\ObjectTypeSpecifier
|
||||
* @var \Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier
|
||||
*/
|
||||
private $objectTypeSpecifier;
|
||||
/**
|
||||
@ -99,7 +99,7 @@ final class NodeTypeResolver
|
||||
/**
|
||||
* @param NodeTypeResolverInterface[] $nodeTypeResolvers
|
||||
*/
|
||||
public function __construct(\Rector\TypeDeclaration\PHPStan\Type\ObjectTypeSpecifier $objectTypeSpecifier, \Rector\Core\NodeAnalyzer\ClassAnalyzer $classAnalyzer, \Rector\NodeTypeResolver\NodeTypeCorrector\GenericClassStringTypeCorrector $genericClassStringTypeCorrector, \PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\NodeTypeResolver\NodeTypeCorrector\HasOffsetTypeCorrector $hasOffsetTypeCorrector, \Rector\NodeTypeResolver\NodeTypeCorrector\AccessoryNonEmptyStringTypeCorrector $accessoryNonEmptyStringTypeCorrector, \Rector\NodeTypeResolver\NodeTypeResolver\IdentifierTypeResolver $identifierTypeResolver, \Rector\Core\Configuration\RenamedClassesDataCollector $renamedClassesDataCollector, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, array $nodeTypeResolvers)
|
||||
public function __construct(\Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier $objectTypeSpecifier, \Rector\Core\NodeAnalyzer\ClassAnalyzer $classAnalyzer, \Rector\NodeTypeResolver\NodeTypeCorrector\GenericClassStringTypeCorrector $genericClassStringTypeCorrector, \PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\NodeTypeResolver\NodeTypeCorrector\HasOffsetTypeCorrector $hasOffsetTypeCorrector, \Rector\NodeTypeResolver\NodeTypeCorrector\AccessoryNonEmptyStringTypeCorrector $accessoryNonEmptyStringTypeCorrector, \Rector\NodeTypeResolver\NodeTypeResolver\IdentifierTypeResolver $identifierTypeResolver, \Rector\Core\Configuration\RenamedClassesDataCollector $renamedClassesDataCollector, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, array $nodeTypeResolvers)
|
||||
{
|
||||
$this->objectTypeSpecifier = $objectTypeSpecifier;
|
||||
$this->classAnalyzer = $classAnalyzer;
|
||||
|
@ -30,7 +30,7 @@ use Rector\StaticTypeMapper\Mapper\ScalarStringToTypeMapper;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\ParentStaticType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\SelfObjectType;
|
||||
use Rector\TypeDeclaration\PHPStan\Type\ObjectTypeSpecifier;
|
||||
use Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier;
|
||||
/**
|
||||
* @implements PhpDocTypeMapperInterface<IdentifierTypeNode>
|
||||
*/
|
||||
@ -38,7 +38,7 @@ final class IdentifierTypeMapper implements \Rector\StaticTypeMapper\Contract\Ph
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\TypeDeclaration\PHPStan\Type\ObjectTypeSpecifier
|
||||
* @var \Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier
|
||||
*/
|
||||
private $objectTypeSpecifier;
|
||||
/**
|
||||
@ -61,7 +61,7 @@ final class IdentifierTypeMapper implements \Rector\StaticTypeMapper\Contract\Ph
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
public function __construct(\Rector\TypeDeclaration\PHPStan\Type\ObjectTypeSpecifier $objectTypeSpecifier, \Rector\StaticTypeMapper\Mapper\ScalarStringToTypeMapper $scalarStringToTypeMapper, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \PHPStan\Reflection\ReflectionProvider $reflectionProvider)
|
||||
public function __construct(\Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier $objectTypeSpecifier, \Rector\StaticTypeMapper\Mapper\ScalarStringToTypeMapper $scalarStringToTypeMapper, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \PHPStan\Reflection\ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->objectTypeSpecifier = $objectTypeSpecifier;
|
||||
$this->scalarStringToTypeMapper = $scalarStringToTypeMapper;
|
||||
|
@ -5,12 +5,14 @@ namespace Rector\DeadCode\Rector\Assign;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\StaticPropertyFetch;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\FunctionLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\Foreach_;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
|
||||
@ -45,14 +47,17 @@ CODE_SAMPLE
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Stmt\Foreach_::class, \Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace::class, \PhpParser\Node\FunctionLike::class, \PhpParser\Node\Stmt\If_::class, \PhpParser\Node\Stmt\Namespace_::class];
|
||||
return [\PhpParser\Node\Stmt\Foreach_::class, \Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace::class, \PhpParser\Node\Stmt\ClassMethod::class, \PhpParser\Node\Stmt\Function_::class, \PhpParser\Node\Expr\Closure::class, \PhpParser\Node\Stmt\If_::class, \PhpParser\Node\Stmt\Namespace_::class];
|
||||
}
|
||||
/**
|
||||
* @param Foreach_|FileWithoutNamespace|FunctionLike|If_|Namespace_ $node
|
||||
* @param Foreach_|FileWithoutNamespace|If_|Namespace_|ClassMethod|Function_|Closure $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
$stmts = $node->stmts;
|
||||
if ($stmts === null) {
|
||||
return null;
|
||||
}
|
||||
$hasChanged = \false;
|
||||
$previousStmt = null;
|
||||
foreach ($stmts as $key => $stmt) {
|
||||
|
@ -76,19 +76,21 @@ CODE_SAMPLE
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
/** @var Match_|null $match */
|
||||
$match = $this->betterNodeFinder->findFirst($node, function (\PhpParser\Node $subNode) : bool {
|
||||
return $subNode instanceof \PhpParser\Node\Expr\Match_;
|
||||
});
|
||||
if ($match === null || $this->shouldSkip($match)) {
|
||||
if (!$match instanceof \PhpParser\Node\Expr\Match_) {
|
||||
return null;
|
||||
}
|
||||
if ($this->shouldSkip($match)) {
|
||||
return null;
|
||||
}
|
||||
$switchCases = $this->createSwitchCasesFromMatchArms($node, $match->arms);
|
||||
return new \PhpParser\Node\Stmt\Switch_($match->cond, $switchCases);
|
||||
}
|
||||
private function shouldSkip(\PhpParser\Node\Expr\Match_ $node) : bool
|
||||
private function shouldSkip(\PhpParser\Node\Expr\Match_ $match) : bool
|
||||
{
|
||||
return (bool) $this->betterNodeFinder->findFirst($node, function (\PhpParser\Node $subNode) : bool {
|
||||
return (bool) $this->betterNodeFinder->findFirst($match, function (\PhpParser\Node $subNode) : bool {
|
||||
return $subNode instanceof \PhpParser\Node\Expr\ArrayItem && $subNode->unpack;
|
||||
});
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ final class NormalizeTypeToRespectArrayScalarType
|
||||
unset($types[$key]);
|
||||
}
|
||||
}
|
||||
$arrayItemType = \count($types) === 1 ? $types[0] : new \PHPStan\Type\IntersectionType($types);
|
||||
$arrayItemType = \count($types) === 1 ? \array_pop($types) : new \PHPStan\Type\IntersectionType($types);
|
||||
return new \PHPStan\Type\ArrayType($arrayType->getKeyType(), $arrayItemType);
|
||||
}
|
||||
private function normalizeUnionType(\PHPStan\Type\UnionType $unionType) : \PHPStan\Type\UnionType
|
||||
|
@ -1,23 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\TypeDeclaration\PHPStan\Type;
|
||||
namespace Rector\TypeDeclaration\PHPStan;
|
||||
|
||||
use RectorPrefix20220426\Nette\Utils\Strings;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
use PhpParser\Node\Stmt\UseUse;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\Generic\GenericObjectType;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\Naming\Naming\UseImportsResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\StaticTypeMapper\Naming\NameScopeFactory;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\NonExistingObjectType;
|
||||
@ -41,14 +42,20 @@ final class ObjectTypeSpecifier
|
||||
* @readonly
|
||||
*/
|
||||
private $typeWithClassTypeSpecifiers;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\StaticTypeMapper\Naming\NameScopeFactory
|
||||
*/
|
||||
private $nameScopeFactory;
|
||||
/**
|
||||
* @param TypeWithClassTypeSpecifierInterface[] $typeWithClassTypeSpecifiers
|
||||
*/
|
||||
public function __construct(\PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\Naming\Naming\UseImportsResolver $useImportsResolver, array $typeWithClassTypeSpecifiers)
|
||||
public function __construct(\PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\Naming\Naming\UseImportsResolver $useImportsResolver, array $typeWithClassTypeSpecifiers, \Rector\StaticTypeMapper\Naming\NameScopeFactory $nameScopeFactory)
|
||||
{
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->useImportsResolver = $useImportsResolver;
|
||||
$this->typeWithClassTypeSpecifiers = $typeWithClassTypeSpecifiers;
|
||||
$this->nameScopeFactory = $nameScopeFactory;
|
||||
}
|
||||
/**
|
||||
* @param \PHPStan\Analyser\Scope|null $scope
|
||||
@ -56,6 +63,8 @@ final class ObjectTypeSpecifier
|
||||
*/
|
||||
public function narrowToFullyQualifiedOrAliasedObjectType(\PhpParser\Node $node, \PHPStan\Type\ObjectType $objectType, $scope)
|
||||
{
|
||||
$this->nameScopeFactory->createNameScopeFromNodeWithoutTemplateTypes($node);
|
||||
// @todo reuse name scope
|
||||
if ($scope instanceof \PHPStan\Analyser\Scope) {
|
||||
foreach ($this->typeWithClassTypeSpecifiers as $typeWithClassTypeSpecifier) {
|
||||
if ($typeWithClassTypeSpecifier->match($objectType, $scope)) {
|
||||
@ -70,11 +79,11 @@ final class ObjectTypeSpecifier
|
||||
}
|
||||
return new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType($objectType->getClassName(), null, $objectType->getClassReflection());
|
||||
}
|
||||
$aliasedObjectType = $this->matchAliasedObjectType($node, $objectType);
|
||||
$aliasedObjectType = $this->matchAliasedObjectType($node, $objectType, $uses);
|
||||
if ($aliasedObjectType !== null) {
|
||||
return $aliasedObjectType;
|
||||
}
|
||||
$shortenedObjectType = $this->matchShortenedObjectType($node, $objectType);
|
||||
$shortenedObjectType = $this->matchShortenedObjectType($objectType, $uses);
|
||||
if ($shortenedObjectType !== null) {
|
||||
return $shortenedObjectType;
|
||||
}
|
||||
@ -85,9 +94,11 @@ final class ObjectTypeSpecifier
|
||||
// invalid type
|
||||
return new \Rector\StaticTypeMapper\ValueObject\Type\NonExistingObjectType($className);
|
||||
}
|
||||
private function matchAliasedObjectType(\PhpParser\Node $node, \PHPStan\Type\ObjectType $objectType) : ?\Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType
|
||||
/**
|
||||
* @param Use_[] $uses
|
||||
*/
|
||||
private function matchAliasedObjectType(\PhpParser\Node $node, \PHPStan\Type\ObjectType $objectType, array $uses) : ?\Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType
|
||||
{
|
||||
$uses = $this->useImportsResolver->resolveForNode($node);
|
||||
if ($uses === []) {
|
||||
return null;
|
||||
}
|
||||
@ -126,11 +137,11 @@ final class ObjectTypeSpecifier
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @param Use_[] $uses
|
||||
* @return \Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType|\Rector\StaticTypeMapper\ValueObject\Type\ShortenedGenericObjectType|null
|
||||
*/
|
||||
private function matchShortenedObjectType(\PhpParser\Node $node, \PHPStan\Type\ObjectType $objectType)
|
||||
private function matchShortenedObjectType(\PHPStan\Type\ObjectType $objectType, array $uses)
|
||||
{
|
||||
$uses = $this->useImportsResolver->resolveForNode($node);
|
||||
if ($uses === []) {
|
||||
return null;
|
||||
}
|
@ -102,6 +102,9 @@ CODE_SAMPLE
|
||||
private function shouldSkip($node) : bool
|
||||
{
|
||||
$hasReturn = $this->betterNodeFinder->hasInstancesOfInFunctionLikeScoped($node, \PhpParser\Node\Stmt\Return_::class);
|
||||
if ($node instanceof \PhpParser\Node\Stmt\ClassMethod && $node->isMagic()) {
|
||||
return \true;
|
||||
}
|
||||
if ($hasReturn) {
|
||||
return \true;
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '588470337e577595a90715dc456539804fd68674';
|
||||
public const PACKAGE_VERSION = 'ba29e3fd5f1584fe54d9b1edbe78b15e592a1791';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-04-26 10:09:12';
|
||||
public const RELEASE_DATE = '2022-04-26 12:55:06';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -408,13 +408,12 @@ final class BetterNodeFinder
|
||||
$types = [$types];
|
||||
}
|
||||
foreach ($types as $type) {
|
||||
$foundNode = $this->findFirstInstanceOf((array) $functionLike->stmts, $type);
|
||||
if (!$foundNode instanceof \PhpParser\Node) {
|
||||
continue;
|
||||
}
|
||||
$parentFunctionLike = $this->findParentByTypes($foundNode, [\PhpParser\Node\Stmt\ClassMethod::class, \PhpParser\Node\Stmt\Function_::class, \PhpParser\Node\Expr\Closure::class]);
|
||||
if ($parentFunctionLike === $functionLike) {
|
||||
return \true;
|
||||
$foundNodes = $this->findInstanceOf((array) $functionLike->stmts, $type);
|
||||
foreach ($foundNodes as $foundNode) {
|
||||
$parentFunctionLike = $this->findParentByTypes($foundNode, [\PhpParser\Node\Stmt\ClassMethod::class, \PhpParser\Node\Stmt\Function_::class, \PhpParser\Node\Expr\Closure::class]);
|
||||
if ($parentFunctionLike === $functionLike) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit61a729469f28752899c8e24a34d80df3::getLoader();
|
||||
return ComposerAutoloaderInit670c1a1bfc06390d63a2d63ac53da483::getLoader();
|
||||
|
2
vendor/composer/autoload_classmap.php
vendored
2
vendor/composer/autoload_classmap.php
vendored
@ -3108,9 +3108,9 @@ return array(
|
||||
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\DetailedTypeAnalyzer' => $baseDir . '/rules/TypeDeclaration/NodeTypeAnalyzer/DetailedTypeAnalyzer.php',
|
||||
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\PropertyTypeDecorator' => $baseDir . '/rules/TypeDeclaration/NodeTypeAnalyzer/PropertyTypeDecorator.php',
|
||||
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\TraitTypeAnalyzer' => $baseDir . '/rules/TypeDeclaration/NodeTypeAnalyzer/TraitTypeAnalyzer.php',
|
||||
'Rector\\TypeDeclaration\\PHPStan\\ObjectTypeSpecifier' => $baseDir . '/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php',
|
||||
'Rector\\TypeDeclaration\\PHPStan\\TypeSpecifier\\SameNamespacedTypeSpecifier' => $baseDir . '/rules/TypeDeclaration/PHPStan/TypeSpecifier/SameNamespacedTypeSpecifier.php',
|
||||
'Rector\\TypeDeclaration\\PHPStan\\TypeSpecifier\\SelfStaticParentTypeSpecifier' => $baseDir . '/rules/TypeDeclaration/PHPStan/TypeSpecifier/SelfStaticParentTypeSpecifier.php',
|
||||
'Rector\\TypeDeclaration\\PHPStan\\Type\\ObjectTypeSpecifier' => $baseDir . '/rules/TypeDeclaration/PHPStan/Type/ObjectTypeSpecifier.php',
|
||||
'Rector\\TypeDeclaration\\PhpDocParser\\NonInformativeReturnTagRemover' => $baseDir . '/rules/TypeDeclaration/PhpDocParser/NonInformativeReturnTagRemover.php',
|
||||
'Rector\\TypeDeclaration\\PhpDocParser\\ParamPhpDocNodeFactory' => $baseDir . '/rules/TypeDeclaration/PhpDocParser/ParamPhpDocNodeFactory.php',
|
||||
'Rector\\TypeDeclaration\\PhpParserTypeAnalyzer' => $baseDir . '/rules/TypeDeclaration/PhpParserTypeAnalyzer.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 ComposerAutoloaderInit61a729469f28752899c8e24a34d80df3
|
||||
class ComposerAutoloaderInit670c1a1bfc06390d63a2d63ac53da483
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,19 +22,19 @@ class ComposerAutoloaderInit61a729469f28752899c8e24a34d80df3
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit61a729469f28752899c8e24a34d80df3', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit670c1a1bfc06390d63a2d63ac53da483', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit61a729469f28752899c8e24a34d80df3', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit670c1a1bfc06390d63a2d63ac53da483', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit61a729469f28752899c8e24a34d80df3::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit670c1a1bfc06390d63a2d63ac53da483::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit61a729469f28752899c8e24a34d80df3::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit670c1a1bfc06390d63a2d63ac53da483::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire61a729469f28752899c8e24a34d80df3($fileIdentifier, $file);
|
||||
composerRequire670c1a1bfc06390d63a2d63ac53da483($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -46,7 +46,7 @@ class ComposerAutoloaderInit61a729469f28752899c8e24a34d80df3
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire61a729469f28752899c8e24a34d80df3($fileIdentifier, $file)
|
||||
function composerRequire670c1a1bfc06390d63a2d63ac53da483($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
10
vendor/composer/autoload_static.php
vendored
10
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit61a729469f28752899c8e24a34d80df3
|
||||
class ComposerStaticInit670c1a1bfc06390d63a2d63ac53da483
|
||||
{
|
||||
public static $files = array (
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
@ -3477,9 +3477,9 @@ class ComposerStaticInit61a729469f28752899c8e24a34d80df3
|
||||
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\DetailedTypeAnalyzer' => __DIR__ . '/../..' . '/rules/TypeDeclaration/NodeTypeAnalyzer/DetailedTypeAnalyzer.php',
|
||||
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\PropertyTypeDecorator' => __DIR__ . '/../..' . '/rules/TypeDeclaration/NodeTypeAnalyzer/PropertyTypeDecorator.php',
|
||||
'Rector\\TypeDeclaration\\NodeTypeAnalyzer\\TraitTypeAnalyzer' => __DIR__ . '/../..' . '/rules/TypeDeclaration/NodeTypeAnalyzer/TraitTypeAnalyzer.php',
|
||||
'Rector\\TypeDeclaration\\PHPStan\\ObjectTypeSpecifier' => __DIR__ . '/../..' . '/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php',
|
||||
'Rector\\TypeDeclaration\\PHPStan\\TypeSpecifier\\SameNamespacedTypeSpecifier' => __DIR__ . '/../..' . '/rules/TypeDeclaration/PHPStan/TypeSpecifier/SameNamespacedTypeSpecifier.php',
|
||||
'Rector\\TypeDeclaration\\PHPStan\\TypeSpecifier\\SelfStaticParentTypeSpecifier' => __DIR__ . '/../..' . '/rules/TypeDeclaration/PHPStan/TypeSpecifier/SelfStaticParentTypeSpecifier.php',
|
||||
'Rector\\TypeDeclaration\\PHPStan\\Type\\ObjectTypeSpecifier' => __DIR__ . '/../..' . '/rules/TypeDeclaration/PHPStan/Type/ObjectTypeSpecifier.php',
|
||||
'Rector\\TypeDeclaration\\PhpDocParser\\NonInformativeReturnTagRemover' => __DIR__ . '/../..' . '/rules/TypeDeclaration/PhpDocParser/NonInformativeReturnTagRemover.php',
|
||||
'Rector\\TypeDeclaration\\PhpDocParser\\ParamPhpDocNodeFactory' => __DIR__ . '/../..' . '/rules/TypeDeclaration/PhpDocParser/ParamPhpDocNodeFactory.php',
|
||||
'Rector\\TypeDeclaration\\PhpParserTypeAnalyzer' => __DIR__ . '/../..' . '/rules/TypeDeclaration/PhpParserTypeAnalyzer.php',
|
||||
@ -3874,9 +3874,9 @@ class ComposerStaticInit61a729469f28752899c8e24a34d80df3
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit61a729469f28752899c8e24a34d80df3::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit61a729469f28752899c8e24a34d80df3::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit61a729469f28752899c8e24a34d80df3::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit670c1a1bfc06390d63a2d63ac53da483::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit670c1a1bfc06390d63a2d63ac53da483::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit670c1a1bfc06390d63a2d63ac53da483::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
16
vendor/composer/installed.json
vendored
16
vendor/composer/installed.json
vendored
@ -2203,12 +2203,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
|
||||
"reference": "3f5c2673308e5b425f587884ce02efee99b2d2aa"
|
||||
"reference": "7d419dc5e19c7ce85d4be1ed298f467e0fb1ce5d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/3f5c2673308e5b425f587884ce02efee99b2d2aa",
|
||||
"reference": "3f5c2673308e5b425f587884ce02efee99b2d2aa",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/7d419dc5e19c7ce85d4be1ed298f467e0fb1ce5d",
|
||||
"reference": "7d419dc5e19c7ce85d4be1ed298f467e0fb1ce5d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2233,7 +2233,7 @@
|
||||
"symplify\/rule-doc-generator": "^10.1",
|
||||
"symplify\/vendor-patches": "^10.1"
|
||||
},
|
||||
"time": "2022-04-19T14:35:34+00:00",
|
||||
"time": "2022-04-26T09:37:18+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
@ -2559,12 +2559,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||
"reference": "a9d0d9334d1836b14255b126269cd3220b2fe6c1"
|
||||
"reference": "ab7463de735e392d1ec59036d167ed99af2be34d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/a9d0d9334d1836b14255b126269cd3220b2fe6c1",
|
||||
"reference": "a9d0d9334d1836b14255b126269cd3220b2fe6c1",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/ab7463de735e392d1ec59036d167ed99af2be34d",
|
||||
"reference": "ab7463de735e392d1ec59036d167ed99af2be34d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2589,7 +2589,7 @@
|
||||
"symplify\/rule-doc-generator": "^10.0",
|
||||
"symplify\/vendor-patches": "^10.0"
|
||||
},
|
||||
"time": "2022-04-23T10:26:52+00:00",
|
||||
"time": "2022-04-26T08:38:24+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-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' => 'dev-main dc4fbb8'), '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 3f5c267'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5d945fb'), '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' => 'dev-main b794171'), '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' => 'dev-main 0c547b2'), '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' => 'dev-main 01fa90c'), '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 a9d0d93'), '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 9f704d1'), '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' => 'dev-main c2c9a7b'));
|
||||
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' => 'dev-main dc4fbb8'), '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 7d419dc'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5d945fb'), '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' => 'dev-main b794171'), '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' => 'dev-main 0c547b2'), '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' => 'dev-main 01fa90c'), '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 ab7463d'), '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 9f704d1'), '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' => 'dev-main c2c9a7b'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType;
|
||||
use Rector\TypeDeclaration\PHPStan\Type\ObjectTypeSpecifier;
|
||||
use Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier;
|
||||
final class ShortClassExpander
|
||||
{
|
||||
/**
|
||||
@ -25,10 +25,10 @@ final class ShortClassExpander
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\TypeDeclaration\PHPStan\Type\ObjectTypeSpecifier
|
||||
* @var \Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier
|
||||
*/
|
||||
private $objectTypeSpecifier;
|
||||
public function __construct(\PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\TypeDeclaration\PHPStan\Type\ObjectTypeSpecifier $objectTypeSpecifier)
|
||||
public function __construct(\PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier $objectTypeSpecifier)
|
||||
{
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->objectTypeSpecifier = $objectTypeSpecifier;
|
||||
|
@ -6,6 +6,7 @@ namespace Rector\PHPUnit\NodeManipulator;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\PHPUnit\NodeFactory\SetUpClassMethodFactory;
|
||||
final class SetUpClassMethodNodeManipulator
|
||||
@ -32,7 +33,7 @@ final class SetUpClassMethodNodeManipulator
|
||||
{
|
||||
$stmts = $this->stmtManipulator->normalizeStmts($stmts);
|
||||
$setUpClassMethod = $class->getMethod(\Rector\Core\ValueObject\MethodName::SET_UP);
|
||||
if ($setUpClassMethod === null) {
|
||||
if (!$setUpClassMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
$setUpClassMethod = $this->setUpClassMethodFactory->createSetUpMethod($stmts);
|
||||
$class->stmts = \array_merge([$setUpClassMethod], $class->stmts);
|
||||
} else {
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -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('RectorPrefix20220426\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit61a729469f28752899c8e24a34d80df3', false) && !interface_exists('ComposerAutoloaderInit61a729469f28752899c8e24a34d80df3', false) && !trait_exists('ComposerAutoloaderInit61a729469f28752899c8e24a34d80df3', false)) {
|
||||
spl_autoload_call('RectorPrefix20220426\ComposerAutoloaderInit61a729469f28752899c8e24a34d80df3');
|
||||
if (!class_exists('ComposerAutoloaderInit670c1a1bfc06390d63a2d63ac53da483', false) && !interface_exists('ComposerAutoloaderInit670c1a1bfc06390d63a2d63ac53da483', false) && !trait_exists('ComposerAutoloaderInit670c1a1bfc06390d63a2d63ac53da483', false)) {
|
||||
spl_autoload_call('RectorPrefix20220426\ComposerAutoloaderInit670c1a1bfc06390d63a2d63ac53da483');
|
||||
}
|
||||
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('RectorPrefix20220426\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20220426\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire61a729469f28752899c8e24a34d80df3')) {
|
||||
function composerRequire61a729469f28752899c8e24a34d80df3() {
|
||||
return \RectorPrefix20220426\composerRequire61a729469f28752899c8e24a34d80df3(...func_get_args());
|
||||
if (!function_exists('composerRequire670c1a1bfc06390d63a2d63ac53da483')) {
|
||||
function composerRequire670c1a1bfc06390d63a2d63ac53da483() {
|
||||
return \RectorPrefix20220426\composerRequire670c1a1bfc06390d63a2d63ac53da483(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user