mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 16:30:51 +00:00
Updated Rector to commit dfbd366b74
dfbd366b74
[Transform] Add MethodCallToMethodCallRector (#505)
This commit is contained in:
parent
8f07228ff7
commit
3f2ea1ec26
|
@ -1,4 +1,4 @@
|
|||
# 491 Rules Overview
|
||||
# 492 Rules Overview
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -94,7 +94,7 @@
|
|||
|
||||
- [Restoration](#restoration) (6)
|
||||
|
||||
- [Transform](#transform) (36)
|
||||
- [Transform](#transform) (37)
|
||||
|
||||
- [TypeDeclaration](#typedeclaration) (18)
|
||||
|
||||
|
@ -10792,6 +10792,53 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
<br>
|
||||
|
||||
### MethodCallToMethodCallRector
|
||||
|
||||
Change method one method from one service to a method call to in another service
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: [`Rector\Transform\Rector\MethodCall\MethodCallToMethodCallRector`](../rules/Transform/Rector/MethodCall/MethodCallToMethodCallRector.php)
|
||||
|
||||
```php
|
||||
use Rector\Transform\Rector\MethodCall\MethodCallToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\MethodCallToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(MethodCallToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
MethodCallToMethodCallRector::METHOD_CALLS_TO_METHOD_CALLS => ValueObjectInliner::inline([
|
||||
new MethodCallToMethodCall('FirstDependency', 'go', 'SecondDependency', 'away'),
|
||||
]),
|
||||
]]);
|
||||
};
|
||||
```
|
||||
|
||||
↓
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function __construct(
|
||||
- private FirstDependency $firstDependency
|
||||
+ private SecondDependency $secondDependency
|
||||
) {
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
- $this->firstDependency->go();
|
||||
+ $this->secondDependency->away();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### MethodCallToPropertyFetchRector
|
||||
|
||||
Turns method call `"$this->something()"` to property fetch "$this->something"
|
||||
|
|
|
@ -49,14 +49,12 @@ final class PropertyToAddCollector implements \Rector\PostRector\Contract\Collec
|
|||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Stmt\Class_ $class
|
||||
* @param string $propertyName
|
||||
* @param \PHPStan\Type\Type|null $propertyType
|
||||
* @param int $propertyFlags
|
||||
* @param \Rector\PostRector\ValueObject\PropertyMetadata $propertyMetadata
|
||||
*/
|
||||
public function addPropertyToClass($class, $propertyName, $propertyType, $propertyFlags) : void
|
||||
public function addPropertyToClass($class, $propertyMetadata) : void
|
||||
{
|
||||
$uniqueHash = \spl_object_hash($class);
|
||||
$this->propertiesByClass[$uniqueHash][] = new \Rector\PostRector\ValueObject\PropertyMetadata($propertyName, $propertyType, $propertyFlags);
|
||||
$this->propertiesByClass[$uniqueHash][] = $propertyMetadata;
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Stmt\Class_ $class
|
||||
|
|
|
@ -14,6 +14,7 @@ use Rector\NodeNameResolver\NodeNameResolver;
|
|||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
use Rector\PostRector\Collector\PropertyToAddCollector;
|
||||
use Rector\PostRector\ValueObject\PropertyMetadata;
|
||||
final class PropertyAdder
|
||||
{
|
||||
/**
|
||||
|
@ -58,9 +59,14 @@ final class PropertyAdder
|
|||
$propertyName = $this->nodeNameResolver->getName($property);
|
||||
$this->addConstructorDependencyToClass($classNode, $propertyType, $propertyName, $property->flags);
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* Use directly @see PropertyToAddCollector::addPropertyToClass() directly with PropertyMetadata object
|
||||
*/
|
||||
public function addConstructorDependencyToClass(\PhpParser\Node\Stmt\Class_ $class, \PHPStan\Type\Type $propertyType, string $propertyName, int $propertyFlags = 0) : void
|
||||
{
|
||||
$this->propertyToAddCollector->addPropertyToClass($class, $propertyName, $propertyType, $propertyFlags);
|
||||
$propertyMetadata = new \Rector\PostRector\ValueObject\PropertyMetadata($propertyName, $propertyType, $propertyFlags);
|
||||
$this->propertyToAddCollector->addPropertyToClass($class, $propertyMetadata);
|
||||
$this->rectorChangeCollector->notifyNodeFileInfo($class);
|
||||
}
|
||||
public function addServiceConstructorDependencyToClass(\PhpParser\Node\Stmt\Class_ $class, \PHPStan\Type\ObjectType $objectType) : void
|
||||
|
|
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Transform\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\NodeAnalyzer\PropertyPresenceChecker;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Naming\Naming\PropertyNaming;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\PostRector\ValueObject\PropertyMetadata;
|
||||
use Rector\Transform\ValueObject\MethodCallToMethodCall;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix20210725\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see \Rector\Tests\Transform\Rector\MethodCall\MethodCallToMethodCallRector\MethodCallToMethodCallRectorTest
|
||||
*/
|
||||
final class MethodCallToMethodCallRector extends \Rector\Core\Rector\AbstractRector implements \Rector\Core\Contract\Rector\ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const METHOD_CALLS_TO_METHOD_CALLS = 'method_calls_to_method_calls';
|
||||
/**
|
||||
* @var MethodCallToMethodCall[]
|
||||
*/
|
||||
private $methodCallsToMethodsCalls = [];
|
||||
/**
|
||||
* @var \Rector\Naming\Naming\PropertyNaming
|
||||
*/
|
||||
private $propertyNaming;
|
||||
/**
|
||||
* @var \Rector\Core\NodeAnalyzer\PropertyPresenceChecker
|
||||
*/
|
||||
private $propertyPresenceChecker;
|
||||
public function __construct(\Rector\Naming\Naming\PropertyNaming $propertyNaming, \Rector\Core\NodeAnalyzer\PropertyPresenceChecker $propertyPresenceChecker)
|
||||
{
|
||||
$this->propertyNaming = $propertyNaming;
|
||||
$this->propertyPresenceChecker = $propertyPresenceChecker;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Change method one method from one service to a method call to in another service', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample(<<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function __construct(
|
||||
private FirstDependency $firstDependency
|
||||
) {
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->firstDependency->go();
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function __construct(
|
||||
private SecondDependency $secondDependency
|
||||
) {
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->secondDependency->away();
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, [self::METHOD_CALLS_TO_METHOD_CALLS => [new \Rector\Transform\ValueObject\MethodCallToMethodCall('FirstDependency', 'go', 'SecondDependency', 'away')]])]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Expr\MethodCall::class];
|
||||
}
|
||||
/**
|
||||
* @param MethodCall $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
foreach ($this->methodCallsToMethodsCalls as $methodCallToMethodCall) {
|
||||
if (!$node->var instanceof \PhpParser\Node\Expr\PropertyFetch) {
|
||||
continue;
|
||||
}
|
||||
if (!$this->isMatch($node, $methodCallToMethodCall)) {
|
||||
continue;
|
||||
}
|
||||
$propertyFetch = $node->var;
|
||||
$class = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NODE);
|
||||
$newObjectType = new \PHPStan\Type\ObjectType($methodCallToMethodCall->getNewType());
|
||||
$newPropertyName = $this->matchNewPropertyName($methodCallToMethodCall, $class);
|
||||
if ($newPropertyName === null) {
|
||||
continue;
|
||||
}
|
||||
$this->addConstructorDependencyToClass($class, $newObjectType, $newPropertyName);
|
||||
// rename property
|
||||
$node->var = new \PhpParser\Node\Expr\PropertyFetch($propertyFetch->var, $newPropertyName);
|
||||
// rename method
|
||||
$node->name = new \PhpParser\Node\Identifier($methodCallToMethodCall->getNewMethod());
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @param array<string, MethodCallToMethodCall[]> $configuration
|
||||
*/
|
||||
public function configure(array $configuration) : void
|
||||
{
|
||||
$methodCallsToMethodsCalls = $configuration[self::METHOD_CALLS_TO_METHOD_CALLS] ?? [];
|
||||
\RectorPrefix20210725\Webmozart\Assert\Assert::allIsAOf($methodCallsToMethodsCalls, \Rector\Transform\ValueObject\MethodCallToMethodCall::class);
|
||||
$this->methodCallsToMethodsCalls = $methodCallsToMethodsCalls;
|
||||
}
|
||||
private function isMatch(\PhpParser\Node\Expr\MethodCall $methodCall, \Rector\Transform\ValueObject\MethodCallToMethodCall $methodCallToMethodCall) : bool
|
||||
{
|
||||
if (!$this->isObjectType($methodCall->var, new \PHPStan\Type\ObjectType($methodCallToMethodCall->getOldType()))) {
|
||||
return \false;
|
||||
}
|
||||
return $this->isName($methodCall->name, $methodCallToMethodCall->getOldMethod());
|
||||
}
|
||||
private function matchNewPropertyName(\Rector\Transform\ValueObject\MethodCallToMethodCall $methodCallToMethodCall, \PhpParser\Node\Stmt\Class_ $class) : ?string
|
||||
{
|
||||
$newPropertyName = $this->propertyNaming->fqnToVariableName($methodCallToMethodCall->getNewType());
|
||||
$propertyMetadata = new \Rector\PostRector\ValueObject\PropertyMetadata($newPropertyName, new \PHPStan\Type\ObjectType($methodCallToMethodCall->getNewType()), \PhpParser\Node\Stmt\Class_::MODIFIER_PRIVATE);
|
||||
$classContextProperty = $this->propertyPresenceChecker->getClassContextProperty($class, $propertyMetadata);
|
||||
if ($classContextProperty === null) {
|
||||
return $newPropertyName;
|
||||
}
|
||||
// re-use existing proeprty name
|
||||
return $this->getName($classContextProperty);
|
||||
}
|
||||
}
|
51
rules/Transform/ValueObject/MethodCallToMethodCall.php
Normal file
51
rules/Transform/ValueObject/MethodCallToMethodCall.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Transform\ValueObject;
|
||||
|
||||
final class MethodCallToMethodCall
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $oldType;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $oldMethod;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $newType;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $newMethod;
|
||||
/**
|
||||
* @param class-string $oldType
|
||||
* @param class-string $newType
|
||||
*/
|
||||
public function __construct(string $oldType, string $oldMethod, string $newType, string $newMethod)
|
||||
{
|
||||
$this->oldType = $oldType;
|
||||
$this->oldMethod = $oldMethod;
|
||||
$this->newType = $newType;
|
||||
$this->newMethod = $newMethod;
|
||||
}
|
||||
public function getOldType() : string
|
||||
{
|
||||
return $this->oldType;
|
||||
}
|
||||
public function getOldMethod() : string
|
||||
{
|
||||
return $this->oldMethod;
|
||||
}
|
||||
public function getNewType() : string
|
||||
{
|
||||
return $this->newType;
|
||||
}
|
||||
public function getNewMethod() : string
|
||||
{
|
||||
return $this->newMethod;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\TypeDeclaration\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
|
@ -24,7 +25,7 @@ final class AutowiredClassMethodOrPropertyAnalyzer
|
|||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property $node
|
||||
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Param|\PhpParser\Node\Stmt\Property $node
|
||||
*/
|
||||
public function detect($node) : bool
|
||||
{
|
||||
|
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '93add0f6c9aef0d30a46c16be1ac1ad013b6d3e4';
|
||||
public const PACKAGE_VERSION = 'dfbd366b74df51ca25f509c779499cd9978b5045';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-07-25 12:48:53';
|
||||
public const RELEASE_DATE = '2021-07-25 13:02:20';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210725\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
|
|
@ -23,10 +23,8 @@ final class ExtensionConfigResolver
|
|||
}
|
||||
$generatedConfigDirectory = \dirname($generatedConfigReflectionClass->getFileName());
|
||||
foreach (\Rector\RectorInstaller\GeneratedConfig::EXTENSIONS as $extensionConfig) {
|
||||
if (!isset($extensionConfig['extra']['includes'])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($extensionConfig['extra']['includes'] as $includedFile) {
|
||||
$includedFiles = $extensionConfig['extra']['includes'] ?? [];
|
||||
foreach ($includedFiles as $includedFile) {
|
||||
$includedFilePath = $this->resolveIncludeFilePath($extensionConfig, $generatedConfigDirectory, $includedFile);
|
||||
if ($includedFilePath === null) {
|
||||
$includedFilePath = \sprintf('%s/%s', $extensionConfig['install_path'], $includedFile);
|
||||
|
|
|
@ -3,12 +3,20 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\Core\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\Php80\NodeAnalyzer\PromotedPropertyResolver;
|
||||
use Rector\PostRector\ValueObject\PropertyMetadata;
|
||||
use ReflectionNamedType;
|
||||
use ReflectionProperty;
|
||||
/**
|
||||
* Can be local property, parent property etc.
|
||||
*/
|
||||
final class PropertyPresenceChecker
|
||||
{
|
||||
/**
|
||||
|
@ -23,42 +31,52 @@ final class PropertyPresenceChecker
|
|||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
public function __construct(\Rector\Php80\NodeAnalyzer\PromotedPropertyResolver $promotedPropertyResolver, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \PHPStan\Reflection\ReflectionProvider $reflectionProvider)
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
public function __construct(\Rector\Php80\NodeAnalyzer\PromotedPropertyResolver $promotedPropertyResolver, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
{
|
||||
$this->promotedPropertyResolver = $promotedPropertyResolver;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
/**
|
||||
* Includes parent classes and traits
|
||||
*/
|
||||
public function hasClassContextPropertyByName(\PhpParser\Node\Stmt\Class_ $class, string $propertyName) : bool
|
||||
public function hasClassContextProperty(\PhpParser\Node\Stmt\Class_ $class, \Rector\PostRector\ValueObject\PropertyMetadata $propertyMetadata) : bool
|
||||
{
|
||||
$propertyOrParam = $this->getClassContextProperty($class, $propertyMetadata);
|
||||
return $propertyOrParam !== null;
|
||||
}
|
||||
/**
|
||||
* @return \PhpParser\Node\Stmt\Property|\PhpParser\Node\Param|null
|
||||
*/
|
||||
public function getClassContextProperty(\PhpParser\Node\Stmt\Class_ $class, \Rector\PostRector\ValueObject\PropertyMetadata $propertyMetadata)
|
||||
{
|
||||
$className = $this->nodeNameResolver->getName($class);
|
||||
if ($className === null) {
|
||||
return \false;
|
||||
return null;
|
||||
}
|
||||
if (!$this->reflectionProvider->hasClass($className)) {
|
||||
return \false;
|
||||
return null;
|
||||
}
|
||||
$property = $class->getProperty($propertyName);
|
||||
$property = $class->getProperty($propertyMetadata->getName());
|
||||
if ($property instanceof \PhpParser\Node\Stmt\Property) {
|
||||
return \true;
|
||||
return $property;
|
||||
}
|
||||
$availablePropertyReflections = $this->getParentClassPublicAndProtectedPropertyReflections($className);
|
||||
foreach ($availablePropertyReflections as $availablePropertyReflection) {
|
||||
if ($availablePropertyReflection->getName() !== $propertyName) {
|
||||
continue;
|
||||
}
|
||||
return \true;
|
||||
$property = $this->matchPropertyByParentPublicOrProtectedProperties($className, $propertyMetadata);
|
||||
if ($property instanceof \PhpParser\Node\Stmt\Property || $property instanceof \PhpParser\Node\Param) {
|
||||
return $property;
|
||||
}
|
||||
$promotedPropertyParams = $this->promotedPropertyResolver->resolveFromClass($class);
|
||||
foreach ($promotedPropertyParams as $promotedPropertyParam) {
|
||||
if ($this->nodeNameResolver->isName($promotedPropertyParam, $propertyName)) {
|
||||
return \true;
|
||||
if ($this->nodeNameResolver->isName($promotedPropertyParam, $propertyMetadata->getName())) {
|
||||
return $promotedPropertyParam;
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @return ReflectionProperty[]
|
||||
|
@ -77,4 +95,47 @@ final class PropertyPresenceChecker
|
|||
}
|
||||
return $propertyReflections;
|
||||
}
|
||||
/**
|
||||
* @return \PhpParser\Node\Stmt\Property|\PhpParser\Node\Param|null
|
||||
*/
|
||||
private function matchPropertyByType(\Rector\PostRector\ValueObject\PropertyMetadata $propertyMetadata, \ReflectionProperty $reflectionProperty)
|
||||
{
|
||||
if ($propertyMetadata->getType() === null) {
|
||||
return null;
|
||||
}
|
||||
if (!$reflectionProperty->getType() instanceof \ReflectionNamedType) {
|
||||
return null;
|
||||
}
|
||||
if (!$propertyMetadata->getType() instanceof \PHPStan\Type\TypeWithClassName) {
|
||||
return null;
|
||||
}
|
||||
$propertyObjectType = $propertyMetadata->getType();
|
||||
$propertyObjectTypeClassName = $propertyObjectType->getClassName();
|
||||
if ($propertyObjectTypeClassName !== (string) $reflectionProperty->getType()) {
|
||||
return null;
|
||||
}
|
||||
// dump($reflectionProperty);
|
||||
// dump($this->astResolver->resolvePropertyFromPropertyReflection($reflectionProperty));
|
||||
// die;
|
||||
return $this->astResolver->resolvePropertyFromPropertyReflection($reflectionProperty);
|
||||
}
|
||||
/**
|
||||
* @return \PhpParser\Node\Stmt\Property|\PhpParser\Node\Param|null
|
||||
*/
|
||||
private function matchPropertyByParentPublicOrProtectedProperties(string $className, \Rector\PostRector\ValueObject\PropertyMetadata $propertyMetadata)
|
||||
{
|
||||
$availablePropertyReflections = $this->getParentClassPublicAndProtectedPropertyReflections($className);
|
||||
foreach ($availablePropertyReflections as $availablePropertyReflection) {
|
||||
// 1. match type by priority
|
||||
$property = $this->matchPropertyByType($propertyMetadata, $availablePropertyReflection);
|
||||
if ($property instanceof \PhpParser\Node\Stmt\Property || $property instanceof \PhpParser\Node\Param) {
|
||||
return $property;
|
||||
}
|
||||
// 2. match by name
|
||||
if ($availablePropertyReflection->getName() === $propertyMetadata->getName()) {
|
||||
return $this->astResolver->resolvePropertyFromPropertyReflection($availablePropertyReflection);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ final class ClassDependencyManipulator
|
|||
}
|
||||
public function addInjectProperty(\PhpParser\Node\Stmt\Class_ $class, \Rector\PostRector\ValueObject\PropertyMetadata $propertyMetadata) : void
|
||||
{
|
||||
if ($this->propertyPresenceChecker->hasClassContextPropertyByName($class, $propertyMetadata->getName())) {
|
||||
if ($this->propertyPresenceChecker->hasClassContextProperty($class, $propertyMetadata)) {
|
||||
return;
|
||||
}
|
||||
$this->classInsertManipulator->addInjectPropertyToClass($class, $propertyMetadata);
|
||||
|
@ -193,17 +193,15 @@ final class ClassDependencyManipulator
|
|||
}
|
||||
private function hasClassPropertyAndDependency(\PhpParser\Node\Stmt\Class_ $class, \Rector\PostRector\ValueObject\PropertyMetadata $propertyMetadata) : bool
|
||||
{
|
||||
if (!$this->propertyPresenceChecker->hasClassContextPropertyByName($class, $propertyMetadata->getName())) {
|
||||
$property = $this->propertyPresenceChecker->getClassContextProperty($class, $propertyMetadata);
|
||||
if ($property === null) {
|
||||
return \false;
|
||||
}
|
||||
$property = $class->getProperty($propertyMetadata->getName());
|
||||
if (!$property instanceof \PhpParser\Node\Stmt\Property) {
|
||||
return $this->isParamInConstructor($class, $propertyMetadata->getName());
|
||||
}
|
||||
if (!$this->autowiredClassMethodOrPropertyAnalyzer->detect($property)) {
|
||||
return $this->isParamInConstructor($class, $propertyMetadata->getName());
|
||||
}
|
||||
return \true;
|
||||
// is inject/autowired property?
|
||||
return $property instanceof \PhpParser\Node\Stmt\Property && $this->autowiredClassMethodOrPropertyAnalyzer->detect($property);
|
||||
}
|
||||
private function hasMethodParameter(\PhpParser\Node\Stmt\ClassMethod $classMethod, string $name) : bool
|
||||
{
|
||||
|
|
|
@ -6,12 +6,14 @@ namespace Rector\Core\PhpParser;
|
|||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\Node\Stmt\Interface_;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PhpParser\Node\Stmt\Trait_;
|
||||
use PhpParser\NodeFinder;
|
||||
use PhpParser\Parser;
|
||||
|
@ -23,9 +25,11 @@ use PHPStan\Type\TypeWithClassName;
|
|||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Core\ValueObject\Application\File;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\NodeScopeAndMetadataDecorator;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
use ReflectionProperty;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
use RectorPrefix20210725\Symplify\SmartFileSystem\SmartFileSystem;
|
||||
/**
|
||||
|
@ -131,10 +135,10 @@ final class AstResolver
|
|||
$this->classMethodsByClassAndMethod[$classReflection->getName()][$methodReflection->getName()] = null;
|
||||
return null;
|
||||
}
|
||||
$nodes = (array) $this->parser->parse($fileContent);
|
||||
$smartFileInfo = new \Symplify\SmartFileSystem\SmartFileInfo($fileName);
|
||||
$file = new \Rector\Core\ValueObject\Application\File($smartFileInfo, $smartFileInfo->getContents());
|
||||
$nodes = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $nodes);
|
||||
$nodes = $this->parseFileNameToDecoratedNodes($fileName);
|
||||
if ($nodes === null) {
|
||||
return null;
|
||||
}
|
||||
$class = $this->nodeFinder->findFirstInstanceOf($nodes, \PhpParser\Node\Stmt\Class_::class);
|
||||
if (!$class instanceof \PhpParser\Node\Stmt\Class_) {
|
||||
// avoids looking for a class in a file where is not present
|
||||
|
@ -160,10 +164,10 @@ final class AstResolver
|
|||
$this->functionsByName[$phpFunctionReflection->getName()] = null;
|
||||
return null;
|
||||
}
|
||||
$nodes = (array) $this->parser->parse($fileContent);
|
||||
$smartFileInfo = new \Symplify\SmartFileSystem\SmartFileInfo($fileName);
|
||||
$file = new \Rector\Core\ValueObject\Application\File($smartFileInfo, $smartFileInfo->getContents());
|
||||
$nodes = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $nodes);
|
||||
$nodes = $this->parseFileNameToDecoratedNodes($fileName);
|
||||
if ($nodes === null) {
|
||||
return null;
|
||||
}
|
||||
/** @var Function_[] $functions */
|
||||
$functions = $this->nodeFinder->findInstanceOf($nodes, \PhpParser\Node\Stmt\Function_::class);
|
||||
foreach ($functions as $function) {
|
||||
|
@ -262,17 +266,13 @@ final class AstResolver
|
|||
if (!$fileName) {
|
||||
continue;
|
||||
}
|
||||
$fileContent = $this->smartFileSystem->readFile($fileName);
|
||||
/** @var Stmt[] $parsedNodes */
|
||||
$parsedNodes = $this->parser->parse($fileContent);
|
||||
$smartFileInfo = new \Symplify\SmartFileSystem\SmartFileInfo($fileName);
|
||||
$file = new \Rector\Core\ValueObject\Application\File($smartFileInfo, $smartFileInfo->getContents());
|
||||
/** @var Stmt[] $allNodes */
|
||||
$allNodes = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $parsedNodes);
|
||||
$traitName = $classLike->getName();
|
||||
$nodes = $this->parseFileNameToDecoratedNodes($fileName);
|
||||
if ($nodes === null) {
|
||||
continue;
|
||||
}
|
||||
/** @var Trait_|null $trait */
|
||||
$trait = $this->betterNodeFinder->findFirst($allNodes, function (\PhpParser\Node $node) use($traitName) : bool {
|
||||
return $node instanceof \PhpParser\Node\Stmt\Trait_ && $this->nodeNameResolver->isName($node, $traitName);
|
||||
$trait = $this->betterNodeFinder->findFirst($nodes, function (\PhpParser\Node $node) use($classLike) : bool {
|
||||
return $node instanceof \PhpParser\Node\Stmt\Trait_ && $this->nodeNameResolver->isName($node, $classLike->getName());
|
||||
});
|
||||
if (!$trait instanceof \PhpParser\Node\Stmt\Trait_) {
|
||||
continue;
|
||||
|
@ -281,4 +281,66 @@ final class AstResolver
|
|||
}
|
||||
return $traits;
|
||||
}
|
||||
/**
|
||||
* @return \PhpParser\Node\Stmt\Property|\PhpParser\Node\Param|null
|
||||
*/
|
||||
public function resolvePropertyFromPropertyReflection(\ReflectionProperty $reflectionProperty)
|
||||
{
|
||||
$reflectionClass = $reflectionProperty->getDeclaringClass();
|
||||
$fileName = $reflectionClass->getFileName();
|
||||
if ($fileName === \false) {
|
||||
return null;
|
||||
}
|
||||
$nodes = $this->parseFileNameToDecoratedNodes($fileName);
|
||||
if ($nodes === null) {
|
||||
return null;
|
||||
}
|
||||
$desiredPropertyName = $reflectionProperty->name;
|
||||
/** @var Property[] $properties */
|
||||
$properties = $this->betterNodeFinder->findInstanceOf($nodes, \PhpParser\Node\Stmt\Property::class);
|
||||
foreach ($properties as $property) {
|
||||
if ($this->nodeNameResolver->isName($property, $desiredPropertyName)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
// promoted property
|
||||
return $this->findPromotedPropertyByName($nodes, $desiredPropertyName);
|
||||
}
|
||||
/**
|
||||
* @return Stmt[]|null
|
||||
*/
|
||||
private function parseFileNameToDecoratedNodes(string $fileName) : ?array
|
||||
{
|
||||
$fileContent = $this->smartFileSystem->readFile($fileName);
|
||||
$nodes = $this->parser->parse($fileContent);
|
||||
if ($nodes === null) {
|
||||
return null;
|
||||
}
|
||||
$smartFileInfo = new \Symplify\SmartFileSystem\SmartFileInfo($fileName);
|
||||
$file = new \Rector\Core\ValueObject\Application\File($smartFileInfo, $smartFileInfo->getContents());
|
||||
return $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $nodes);
|
||||
}
|
||||
/**
|
||||
* @param Stmt[] $nodes
|
||||
*/
|
||||
private function findPromotedPropertyByName(array $nodes, string $desiredPropertyName) : ?\PhpParser\Node\Param
|
||||
{
|
||||
$class = $this->betterNodeFinder->findFirstInstanceOf($nodes, \PhpParser\Node\Stmt\Class_::class);
|
||||
if (!$class instanceof \PhpParser\Node\Stmt\Class_) {
|
||||
return null;
|
||||
}
|
||||
$constructClassMethod = $class->getMethod(\Rector\Core\ValueObject\MethodName::CONSTRUCT);
|
||||
if (!$constructClassMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
return null;
|
||||
}
|
||||
foreach ($constructClassMethod->getParams() as $param) {
|
||||
if ($param->flags === 0) {
|
||||
continue;
|
||||
}
|
||||
if ($this->nodeNameResolver->isName($param, $desiredPropertyName)) {
|
||||
return $param;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -4,4 +4,4 @@
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit19d435887d274957c40d7329f56e8f2d::getLoader();
|
||||
return ComposerAutoloaderInit0b545e1c5b74b2be4e69c2aeec79bbc2::getLoader();
|
||||
|
|
2
vendor/composer/autoload_classmap.php
vendored
2
vendor/composer/autoload_classmap.php
vendored
|
@ -3064,6 +3064,7 @@ return array(
|
|||
'Rector\\Transform\\Rector\\Isset_\\UnsetAndIssetToMethodCallRector' => $baseDir . '/rules/Transform/Rector/Isset_/UnsetAndIssetToMethodCallRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\CallableInMethodCallToVariableRector' => $baseDir . '/rules/Transform/Rector/MethodCall/CallableInMethodCallToVariableRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\MethodCallToAnotherMethodCallWithArgumentsRector' => $baseDir . '/rules/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\MethodCallToMethodCallRector' => $baseDir . '/rules/Transform/Rector/MethodCall/MethodCallToMethodCallRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\MethodCallToPropertyFetchRector' => $baseDir . '/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\MethodCallToStaticCallRector' => $baseDir . '/rules/Transform/Rector/MethodCall/MethodCallToStaticCallRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\ReplaceParentCallByPropertyCallRector' => $baseDir . '/rules/Transform/Rector/MethodCall/ReplaceParentCallByPropertyCallRector.php',
|
||||
|
@ -3088,6 +3089,7 @@ return array(
|
|||
'Rector\\Transform\\ValueObject\\FunctionToStaticCall' => $baseDir . '/rules/Transform/ValueObject/FunctionToStaticCall.php',
|
||||
'Rector\\Transform\\ValueObject\\GetAndSetToMethodCall' => $baseDir . '/rules/Transform/ValueObject/GetAndSetToMethodCall.php',
|
||||
'Rector\\Transform\\ValueObject\\MethodCallToAnotherMethodCallWithArguments' => $baseDir . '/rules/Transform/ValueObject/MethodCallToAnotherMethodCallWithArguments.php',
|
||||
'Rector\\Transform\\ValueObject\\MethodCallToMethodCall' => $baseDir . '/rules/Transform/ValueObject/MethodCallToMethodCall.php',
|
||||
'Rector\\Transform\\ValueObject\\MethodCallToReturn' => $baseDir . '/rules/Transform/ValueObject/MethodCallToReturn.php',
|
||||
'Rector\\Transform\\ValueObject\\MethodCallToStaticCall' => $baseDir . '/rules/Transform/ValueObject/MethodCallToStaticCall.php',
|
||||
'Rector\\Transform\\ValueObject\\NewArgToMethodCall' => $baseDir . '/rules/Transform/ValueObject/NewArgToMethodCall.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 ComposerAutoloaderInit19d435887d274957c40d7329f56e8f2d
|
||||
class ComposerAutoloaderInit0b545e1c5b74b2be4e69c2aeec79bbc2
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInit19d435887d274957c40d7329f56e8f2d
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit19d435887d274957c40d7329f56e8f2d', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit0b545e1c5b74b2be4e69c2aeec79bbc2', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit19d435887d274957c40d7329f56e8f2d', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit0b545e1c5b74b2be4e69c2aeec79bbc2', '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\ComposerStaticInit19d435887d274957c40d7329f56e8f2d::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit0b545e1c5b74b2be4e69c2aeec79bbc2::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInit19d435887d274957c40d7329f56e8f2d
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit19d435887d274957c40d7329f56e8f2d::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit0b545e1c5b74b2be4e69c2aeec79bbc2::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire19d435887d274957c40d7329f56e8f2d($fileIdentifier, $file);
|
||||
composerRequire0b545e1c5b74b2be4e69c2aeec79bbc2($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire19d435887d274957c40d7329f56e8f2d($fileIdentifier, $file)
|
||||
function composerRequire0b545e1c5b74b2be4e69c2aeec79bbc2($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
|
10
vendor/composer/autoload_static.php
vendored
10
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit19d435887d274957c40d7329f56e8f2d
|
||||
class ComposerStaticInit0b545e1c5b74b2be4e69c2aeec79bbc2
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -3419,6 +3419,7 @@ class ComposerStaticInit19d435887d274957c40d7329f56e8f2d
|
|||
'Rector\\Transform\\Rector\\Isset_\\UnsetAndIssetToMethodCallRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/Isset_/UnsetAndIssetToMethodCallRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\CallableInMethodCallToVariableRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/MethodCall/CallableInMethodCallToVariableRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\MethodCallToAnotherMethodCallWithArgumentsRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\MethodCallToMethodCallRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/MethodCall/MethodCallToMethodCallRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\MethodCallToPropertyFetchRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\MethodCallToStaticCallRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/MethodCall/MethodCallToStaticCallRector.php',
|
||||
'Rector\\Transform\\Rector\\MethodCall\\ReplaceParentCallByPropertyCallRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/MethodCall/ReplaceParentCallByPropertyCallRector.php',
|
||||
|
@ -3443,6 +3444,7 @@ class ComposerStaticInit19d435887d274957c40d7329f56e8f2d
|
|||
'Rector\\Transform\\ValueObject\\FunctionToStaticCall' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/FunctionToStaticCall.php',
|
||||
'Rector\\Transform\\ValueObject\\GetAndSetToMethodCall' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/GetAndSetToMethodCall.php',
|
||||
'Rector\\Transform\\ValueObject\\MethodCallToAnotherMethodCallWithArguments' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/MethodCallToAnotherMethodCallWithArguments.php',
|
||||
'Rector\\Transform\\ValueObject\\MethodCallToMethodCall' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/MethodCallToMethodCall.php',
|
||||
'Rector\\Transform\\ValueObject\\MethodCallToReturn' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/MethodCallToReturn.php',
|
||||
'Rector\\Transform\\ValueObject\\MethodCallToStaticCall' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/MethodCallToStaticCall.php',
|
||||
'Rector\\Transform\\ValueObject\\NewArgToMethodCall' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/NewArgToMethodCall.php',
|
||||
|
@ -3850,9 +3852,9 @@ class ComposerStaticInit19d435887d274957c40d7329f56e8f2d
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit19d435887d274957c40d7329f56e8f2d::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit19d435887d274957c40d7329f56e8f2d::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit19d435887d274957c40d7329f56e8f2d::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0b545e1c5b74b2be4e69c2aeec79bbc2::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit0b545e1c5b74b2be4e69c2aeec79bbc2::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit0b545e1c5b74b2be4e69c2aeec79bbc2::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
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('RectorPrefix20210725\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit19d435887d274957c40d7329f56e8f2d', false) && !interface_exists('ComposerAutoloaderInit19d435887d274957c40d7329f56e8f2d', false) && !trait_exists('ComposerAutoloaderInit19d435887d274957c40d7329f56e8f2d', false)) {
|
||||
spl_autoload_call('RectorPrefix20210725\ComposerAutoloaderInit19d435887d274957c40d7329f56e8f2d');
|
||||
if (!class_exists('ComposerAutoloaderInit0b545e1c5b74b2be4e69c2aeec79bbc2', false) && !interface_exists('ComposerAutoloaderInit0b545e1c5b74b2be4e69c2aeec79bbc2', false) && !trait_exists('ComposerAutoloaderInit0b545e1c5b74b2be4e69c2aeec79bbc2', false)) {
|
||||
spl_autoload_call('RectorPrefix20210725\ComposerAutoloaderInit0b545e1c5b74b2be4e69c2aeec79bbc2');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210725\Doctrine\Inflector\Inflector');
|
||||
|
@ -3308,9 +3308,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20210725\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire19d435887d274957c40d7329f56e8f2d')) {
|
||||
function composerRequire19d435887d274957c40d7329f56e8f2d() {
|
||||
return \RectorPrefix20210725\composerRequire19d435887d274957c40d7329f56e8f2d(...func_get_args());
|
||||
if (!function_exists('composerRequire0b545e1c5b74b2be4e69c2aeec79bbc2')) {
|
||||
function composerRequire0b545e1c5b74b2be4e69c2aeec79bbc2() {
|
||||
return \RectorPrefix20210725\composerRequire0b545e1c5b74b2be4e69c2aeec79bbc2(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user