mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
Updated Rector to commit 49aa15dbfb1932401ae68310c4064c273259ea4e
49aa15dbfb
[CodingStyle] Deprecate RemoveUnusedAliasRector, job rather for coding standard tool and opinonated (#1157)
This commit is contained in:
parent
a666365958
commit
c76f97bfb2
@ -31,7 +31,6 @@ use Rector\CodingStyle\Rector\String_\SplitStringClassConstantToClassConstFetchR
|
||||
use Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector;
|
||||
use Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector;
|
||||
use Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector;
|
||||
use Rector\CodingStyle\Rector\Use_\RemoveUnusedAliasRector;
|
||||
use Rector\CodingStyle\Rector\Use_\SeparateMultiUseImportsRector;
|
||||
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
||||
use Rector\Transform\Rector\FuncCall\FuncCallToConstFetchRector;
|
||||
@ -43,7 +42,6 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
|
||||
$services->set(\Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector::class);
|
||||
$services->set(\Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector::class);
|
||||
$services->set(\Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector::class);
|
||||
$services->set(\Rector\CodingStyle\Rector\Use_\RemoveUnusedAliasRector::class);
|
||||
$services->set(\Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector::class);
|
||||
$services->set(\Rector\CodingStyle\Rector\ClassConst\SplitGroupedConstantsAndPropertiesRector::class);
|
||||
$services->set(\Rector\CodingStyle\Rector\String_\SplitStringClassConstantToClassConstFetchRector::class);
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
- [CodeQuality](#codequality) (69)
|
||||
|
||||
- [CodingStyle](#codingstyle) (39)
|
||||
- [CodingStyle](#codingstyle) (38)
|
||||
|
||||
- [Composer](#composer) (6)
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
- [Php80](#php80) (17)
|
||||
|
||||
- [Php81](#php81) (5)
|
||||
- [Php81](#php81) (6)
|
||||
|
||||
- [PhpSpecToPHPUnit](#phpspectophpunit) (7)
|
||||
|
||||
@ -2352,24 +2352,6 @@ Non-magic PHP object methods cannot start with "__"
|
||||
|
||||
<br>
|
||||
|
||||
### RemoveUnusedAliasRector
|
||||
|
||||
Removes unused use aliases. Keep annotation aliases like "Doctrine\ORM\Mapping as ORM" to keep convention format
|
||||
|
||||
- class: [`Rector\CodingStyle\Rector\Use_\RemoveUnusedAliasRector`](../rules/CodingStyle/Rector/Use_/RemoveUnusedAliasRector.php)
|
||||
|
||||
```diff
|
||||
-use Symfony\Kernel as BaseKernel;
|
||||
+use Symfony\Kernel;
|
||||
|
||||
-class SomeClass extends BaseKernel
|
||||
+class SomeClass extends Kernel
|
||||
{
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### ReturnArrayClassMethodToYieldRector
|
||||
|
||||
Turns array return to yield return in specific type and method
|
||||
@ -8025,6 +8007,26 @@ Refactor MyCLabs enum fetch to Enum const
|
||||
|
||||
<br>
|
||||
|
||||
### Php81ResourceReturnToObjectRector
|
||||
|
||||
Change `is_resource()` to instanceof Object
|
||||
|
||||
- class: [`Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector`](../rules/Php81/Rector/FuncCall/Php81ResourceReturnToObjectRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$f = finfo_open();
|
||||
- is_resource($f);
|
||||
+ $f instanceof \finfo;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### ReadOnlyPropertyRector
|
||||
|
||||
Decorate read-only property with `readonly` attribute
|
||||
|
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\NameImporting\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\UseUse;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NameImporting\ValueObject\NameAndParent;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
/**
|
||||
* @see \Rector\Tests\NameImporting\NodeAnalyzer\UseAnalyzer\UseAnalyzerTest
|
||||
*/
|
||||
final class UseAnalyzer
|
||||
{
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
public function __construct(\Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
}
|
||||
/**
|
||||
* @return NameAndParent[]
|
||||
*/
|
||||
public function resolveUsedNameNodes(\PhpParser\Node $node) : array
|
||||
{
|
||||
$usedNames = $this->resolveUsedNames($node);
|
||||
$usedClassNames = $this->resolveUsedClassNames($node);
|
||||
$usedTraitNames = $this->resolveTraitUseNames($node);
|
||||
return \array_merge($usedNames, $usedClassNames, $usedTraitNames);
|
||||
}
|
||||
/**
|
||||
* @return NameAndParent[]
|
||||
*/
|
||||
private function resolveUsedNames(\PhpParser\Node $node) : array
|
||||
{
|
||||
$namesAndParents = [];
|
||||
/** @var Name[] $names */
|
||||
$names = $this->betterNodeFinder->findInstanceOf($node, \PhpParser\Node\Name::class);
|
||||
foreach ($names as $name) {
|
||||
/** node name before becoming FQN - attribute from @see NameResolver */
|
||||
$originalName = $name->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::ORIGINAL_NAME);
|
||||
if (!$originalName instanceof \PhpParser\Node\Name) {
|
||||
continue;
|
||||
}
|
||||
$parentNode = $name->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
if (!$parentNode instanceof \PhpParser\Node) {
|
||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||
}
|
||||
$shortName = $originalName->toString();
|
||||
$namesAndParents[] = new \Rector\NameImporting\ValueObject\NameAndParent($shortName, $name, $parentNode);
|
||||
}
|
||||
return $namesAndParents;
|
||||
}
|
||||
/**
|
||||
* @return NameAndParent[]
|
||||
*/
|
||||
private function resolveUsedClassNames(\PhpParser\Node $node) : array
|
||||
{
|
||||
$namesAndParents = [];
|
||||
/** @var ClassLike[] $classLikes */
|
||||
$classLikes = $this->betterNodeFinder->findClassLikes($node);
|
||||
foreach ($classLikes as $classLike) {
|
||||
$classLikeName = $classLike->name;
|
||||
if (!$classLikeName instanceof \PhpParser\Node\Identifier) {
|
||||
continue;
|
||||
}
|
||||
$name = $this->nodeNameResolver->getName($classLikeName);
|
||||
if (!\is_string($name)) {
|
||||
continue;
|
||||
}
|
||||
$namesAndParents[] = new \Rector\NameImporting\ValueObject\NameAndParent($name, $classLikeName, $classLike);
|
||||
}
|
||||
return $namesAndParents;
|
||||
}
|
||||
/**
|
||||
* @return NameAndParent[]
|
||||
*/
|
||||
private function resolveTraitUseNames(\PhpParser\Node $node) : array
|
||||
{
|
||||
$namesAndParents = [];
|
||||
/** @var Identifier[] $identifiers */
|
||||
$identifiers = $this->betterNodeFinder->findInstanceOf($node, \PhpParser\Node\Identifier::class);
|
||||
foreach ($identifiers as $identifier) {
|
||||
$parentNode = $identifier->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
if (!$parentNode instanceof \PhpParser\Node\Stmt\UseUse) {
|
||||
continue;
|
||||
}
|
||||
$shortName = $identifier->name;
|
||||
$namesAndParents[] = new \Rector\NameImporting\ValueObject\NameAndParent($shortName, $identifier, $parentNode);
|
||||
}
|
||||
return $namesAndParents;
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\NameImporting\ValueObject;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
final class NameAndParent
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $shortName;
|
||||
/**
|
||||
* @var Identifier|Name
|
||||
*/
|
||||
private $nameNode;
|
||||
/**
|
||||
* @var \PhpParser\Node
|
||||
*/
|
||||
private $parentNode;
|
||||
/**
|
||||
* @param Name|Identifier $nameNode
|
||||
*/
|
||||
public function __construct(string $shortName, \PhpParser\Node $nameNode, \PhpParser\Node $parentNode)
|
||||
{
|
||||
$this->shortName = $shortName;
|
||||
$this->nameNode = $nameNode;
|
||||
$this->parentNode = $parentNode;
|
||||
}
|
||||
/**
|
||||
* @return \PhpParser\Node\Identifier|\PhpParser\Node\Name
|
||||
*/
|
||||
public function getNameNode()
|
||||
{
|
||||
return $this->nameNode;
|
||||
}
|
||||
public function getParentNode() : \PhpParser\Node
|
||||
{
|
||||
return $this->parentNode;
|
||||
}
|
||||
public function matchShortName(string $desiredShortName) : bool
|
||||
{
|
||||
return \strtolower($this->shortName) === \strtolower($desiredShortName);
|
||||
}
|
||||
}
|
@ -1,199 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CodingStyle\Naming;
|
||||
|
||||
use PhpParser\Node\Expr\ClassConstFetch;
|
||||
use PhpParser\Node\Expr\Instanceof_;
|
||||
use PhpParser\Node\Expr\New_;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Interface_;
|
||||
use PhpParser\Node\Stmt\TraitUse;
|
||||
use PhpParser\Node\UnionType;
|
||||
use Rector\NameImporting\ValueObject\NameAndParent;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
final class NameRenamer
|
||||
{
|
||||
/**
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
public function __construct(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
}
|
||||
/**
|
||||
* @param NameAndParent[] $namesAndParent
|
||||
*/
|
||||
public function renameNameNode(array $namesAndParent, string $lastName) : void
|
||||
{
|
||||
foreach ($namesAndParent as $nameAndParent) {
|
||||
$parentNode = $nameAndParent->getParentNode();
|
||||
$usedName = $nameAndParent->getNameNode();
|
||||
if ($parentNode instanceof \PhpParser\Node\Stmt\TraitUse) {
|
||||
$this->renameTraitUse($lastName, $parentNode, $usedName);
|
||||
}
|
||||
if ($parentNode instanceof \PhpParser\Node\Stmt\Class_) {
|
||||
$this->renameClass($lastName, $parentNode, $usedName);
|
||||
}
|
||||
if ($parentNode instanceof \PhpParser\Node\Param) {
|
||||
$this->renameParam($lastName, $parentNode, $usedName);
|
||||
}
|
||||
if ($parentNode instanceof \PhpParser\Node\Expr\New_) {
|
||||
$this->renameNew($lastName, $parentNode, $usedName);
|
||||
}
|
||||
if ($parentNode instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
$this->renameClassMethod($lastName, $parentNode, $usedName);
|
||||
}
|
||||
if ($parentNode instanceof \PhpParser\Node\Stmt\Interface_) {
|
||||
$this->renameInterface($lastName, $parentNode, $usedName);
|
||||
}
|
||||
if ($parentNode instanceof \PhpParser\Node\Expr\StaticCall) {
|
||||
$this->renameStaticCall($lastName, $parentNode);
|
||||
}
|
||||
if ($parentNode instanceof \PhpParser\Node\UnionType) {
|
||||
$this->renameUnionType($lastName, $parentNode, $usedName);
|
||||
}
|
||||
if ($parentNode instanceof \PhpParser\Node\NullableType) {
|
||||
$this->renameNullableType($lastName, $parentNode, $usedName);
|
||||
}
|
||||
if ($parentNode instanceof \PhpParser\Node\Expr\Instanceof_) {
|
||||
$this->renameInInstanceOf($lastName, $parentNode, $usedName);
|
||||
}
|
||||
if ($parentNode instanceof \PhpParser\Node\Expr\ClassConstFetch) {
|
||||
$this->renameClassConstFetch($lastName, $parentNode, $usedName);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name $usedNameNode
|
||||
*/
|
||||
private function renameClassConstFetch(string $lastName, \PhpParser\Node\Expr\ClassConstFetch $classConstFetch, $usedNameNode) : void
|
||||
{
|
||||
if (!$this->nodeNameResolver->areNamesEqual($classConstFetch->class, $usedNameNode)) {
|
||||
return;
|
||||
}
|
||||
$classConstFetch->class = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name $usedNameNode
|
||||
*/
|
||||
private function renameInInstanceOf(string $lastName, \PhpParser\Node\Expr\Instanceof_ $instanceof, $usedNameNode) : void
|
||||
{
|
||||
if (!$this->nodeNameResolver->areNamesEqual($instanceof->class, $usedNameNode)) {
|
||||
return;
|
||||
}
|
||||
$instanceof->class = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name $usedNameNode
|
||||
*/
|
||||
private function renameNullableType(string $lastName, \PhpParser\Node\NullableType $nullableType, $usedNameNode) : void
|
||||
{
|
||||
if (!$this->nodeNameResolver->areNamesEqual($nullableType->type, $usedNameNode)) {
|
||||
return;
|
||||
}
|
||||
$nullableType->type = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name $usedNameNode
|
||||
*/
|
||||
private function renameTraitUse(string $lastName, \PhpParser\Node\Stmt\TraitUse $traitUse, $usedNameNode) : void
|
||||
{
|
||||
foreach ($traitUse->traits as $key => $traitName) {
|
||||
if (!$this->nodeNameResolver->areNamesEqual($traitName, $usedNameNode)) {
|
||||
continue;
|
||||
}
|
||||
$traitUse->traits[$key] = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name $usedNameNode
|
||||
*/
|
||||
private function renameClass(string $lastName, \PhpParser\Node\Stmt\Class_ $class, $usedNameNode) : void
|
||||
{
|
||||
if ($class->name !== null && $this->nodeNameResolver->areNamesEqual($class->name, $usedNameNode)) {
|
||||
$class->name = new \PhpParser\Node\Identifier($lastName);
|
||||
}
|
||||
if ($class->extends !== null && $this->nodeNameResolver->areNamesEqual($class->extends, $usedNameNode)) {
|
||||
$class->extends = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
foreach ($class->implements as $key => $implementNode) {
|
||||
if ($this->nodeNameResolver->areNamesEqual($implementNode, $usedNameNode)) {
|
||||
$class->implements[$key] = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name $usedNameNode
|
||||
*/
|
||||
private function renameParam(string $lastName, \PhpParser\Node\Param $param, $usedNameNode) : void
|
||||
{
|
||||
if ($param->type === null) {
|
||||
return;
|
||||
}
|
||||
if (!$this->nodeNameResolver->areNamesEqual($param->type, $usedNameNode)) {
|
||||
return;
|
||||
}
|
||||
$param->type = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name $usedNameNode
|
||||
*/
|
||||
private function renameUnionType(string $lastName, \PhpParser\Node\UnionType $unionType, $usedNameNode) : void
|
||||
{
|
||||
foreach ($unionType->types as $key => $unionedType) {
|
||||
if (!$this->nodeNameResolver->areNamesEqual($unionedType, $usedNameNode)) {
|
||||
continue;
|
||||
}
|
||||
if (!$unionedType instanceof \PhpParser\Node\Name) {
|
||||
continue;
|
||||
}
|
||||
$unionType->types[$key] = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name $usedNameNode
|
||||
*/
|
||||
private function renameNew(string $lastName, \PhpParser\Node\Expr\New_ $new, $usedNameNode) : void
|
||||
{
|
||||
if ($this->nodeNameResolver->areNamesEqual($new->class, $usedNameNode)) {
|
||||
$new->class = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name $usedNameNode
|
||||
*/
|
||||
private function renameClassMethod(string $lastName, \PhpParser\Node\Stmt\ClassMethod $classMethod, $usedNameNode) : void
|
||||
{
|
||||
if ($classMethod->returnType === null) {
|
||||
return;
|
||||
}
|
||||
if (!$this->nodeNameResolver->areNamesEqual($classMethod->returnType, $usedNameNode)) {
|
||||
return;
|
||||
}
|
||||
$classMethod->returnType = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name $usedNameNode
|
||||
*/
|
||||
private function renameInterface(string $lastName, \PhpParser\Node\Stmt\Interface_ $interface, $usedNameNode) : void
|
||||
{
|
||||
foreach ($interface->extends as $key => $extendInterfaceName) {
|
||||
if (!$this->nodeNameResolver->areNamesEqual($extendInterfaceName, $usedNameNode)) {
|
||||
continue;
|
||||
}
|
||||
$interface->extends[$key] = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
}
|
||||
private function renameStaticCall(string $lastName, \PhpParser\Node\Expr\StaticCall $staticCall) : void
|
||||
{
|
||||
$staticCall->class = new \PhpParser\Node\Name($lastName);
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CodingStyle\Node;
|
||||
|
||||
use RectorPrefix20211105\Nette\Utils\Strings;
|
||||
use PhpParser\Comment\Doc;
|
||||
use PhpParser\Node;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
|
||||
use RectorPrefix20211105\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser;
|
||||
final class DocAliasResolver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/cWpliJ/1
|
||||
*/
|
||||
private const DOC_ALIAS_REGEX = '#\\@(?<possible_alias>\\w+)(\\\\)?#s';
|
||||
/**
|
||||
* @var \Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser
|
||||
*/
|
||||
private $simpleCallableNodeTraverser;
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
public function __construct(\RectorPrefix20211105\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser $simpleCallableNodeTraverser, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory)
|
||||
{
|
||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function resolve(\PhpParser\Node $node) : array
|
||||
{
|
||||
$possibleDocAliases = [];
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($node, function (\PhpParser\Node $node) use(&$possibleDocAliases) : void {
|
||||
$docComment = $node->getDocComment();
|
||||
if (!$docComment instanceof \PhpParser\Comment\Doc) {
|
||||
return;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
$possibleDocAliases = $this->collectVarType($phpDocInfo, $possibleDocAliases);
|
||||
// e.g. "use Dotrine\ORM\Mapping as ORM" etc.
|
||||
$matches = \RectorPrefix20211105\Nette\Utils\Strings::matchAll($docComment->getText(), self::DOC_ALIAS_REGEX);
|
||||
foreach ($matches as $match) {
|
||||
$possibleDocAliases[] = $match['possible_alias'];
|
||||
}
|
||||
});
|
||||
return \array_unique($possibleDocAliases);
|
||||
}
|
||||
/**
|
||||
* @param string[] $possibleDocAliases
|
||||
* @return string[]
|
||||
*/
|
||||
private function collectVarType(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, array $possibleDocAliases) : array
|
||||
{
|
||||
$possibleDocAliases = $this->appendPossibleAliases($phpDocInfo->getVarType(), $possibleDocAliases);
|
||||
$possibleDocAliases = $this->appendPossibleAliases($phpDocInfo->getReturnType(), $possibleDocAliases);
|
||||
foreach ($phpDocInfo->getParamTypesByName() as $paramType) {
|
||||
$possibleDocAliases = $this->appendPossibleAliases($paramType, $possibleDocAliases);
|
||||
}
|
||||
return $possibleDocAliases;
|
||||
}
|
||||
/**
|
||||
* @param string[] $possibleDocAliases
|
||||
* @return string[]
|
||||
*/
|
||||
private function appendPossibleAliases(\PHPStan\Type\Type $varType, array $possibleDocAliases) : array
|
||||
{
|
||||
if ($varType instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType) {
|
||||
$possibleDocAliases[] = $varType->getClassName();
|
||||
}
|
||||
if ($varType instanceof \PHPStan\Type\UnionType) {
|
||||
foreach ($varType->getTypes() as $type) {
|
||||
$possibleDocAliases = $this->appendPossibleAliases($type, $possibleDocAliases);
|
||||
}
|
||||
}
|
||||
return $possibleDocAliases;
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CodingStyle\Node;
|
||||
|
||||
use Rector\CodingStyle\ClassNameImport\ShortNameResolver;
|
||||
use Rector\CodingStyle\Naming\ClassNaming;
|
||||
use Rector\Core\ValueObject\Application\File;
|
||||
final class UseNameAliasToNameResolver
|
||||
{
|
||||
/**
|
||||
* @var \Rector\CodingStyle\Naming\ClassNaming
|
||||
*/
|
||||
private $classNaming;
|
||||
/**
|
||||
* @var \Rector\CodingStyle\ClassNameImport\ShortNameResolver
|
||||
*/
|
||||
private $shortNameResolver;
|
||||
public function __construct(\Rector\CodingStyle\Naming\ClassNaming $classNaming, \Rector\CodingStyle\ClassNameImport\ShortNameResolver $shortNameResolver)
|
||||
{
|
||||
$this->classNaming = $classNaming;
|
||||
$this->shortNameResolver = $shortNameResolver;
|
||||
}
|
||||
/**
|
||||
* @return array<string, string[]>
|
||||
*/
|
||||
public function resolve(\Rector\Core\ValueObject\Application\File $file) : array
|
||||
{
|
||||
$useNamesAliasToName = [];
|
||||
$shortNames = $this->shortNameResolver->resolveFromFile($file);
|
||||
foreach ($shortNames as $alias => $useImport) {
|
||||
if (!\is_string($alias)) {
|
||||
continue;
|
||||
}
|
||||
$shortName = $this->classNaming->getShortName($useImport);
|
||||
if ($shortName === $alias) {
|
||||
continue;
|
||||
}
|
||||
$useNamesAliasToName[$shortName][] = $alias;
|
||||
}
|
||||
return $useNamesAliasToName;
|
||||
}
|
||||
}
|
@ -1,222 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CodingStyle\Rector\Use_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
use PhpParser\Node\Stmt\UseUse;
|
||||
use Rector\CodingStyle\ClassNameImport\ClassNameImportSkipper;
|
||||
use Rector\CodingStyle\Naming\NameRenamer;
|
||||
use Rector\CodingStyle\Node\DocAliasResolver;
|
||||
use Rector\CodingStyle\Node\UseNameAliasToNameResolver;
|
||||
use Rector\Core\PhpParser\NodeFinder\FullyQualifiedFromUseFinder;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NameImporting\NodeAnalyzer\UseAnalyzer;
|
||||
use Rector\NameImporting\ValueObject\NameAndParent;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\Tests\CodingStyle\Rector\Use_\RemoveUnusedAliasRector\RemoveUnusedAliasRectorTest
|
||||
*/
|
||||
final class RemoveUnusedAliasRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var NameAndParent[]
|
||||
*/
|
||||
private $namesAndParents = [];
|
||||
/**
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private $useNamesAliasToName = [];
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $resolvedDocPossibleAliases = [];
|
||||
/**
|
||||
* @var \Rector\CodingStyle\Node\DocAliasResolver
|
||||
*/
|
||||
private $docAliasResolver;
|
||||
/**
|
||||
* @var \Rector\NameImporting\NodeAnalyzer\UseAnalyzer
|
||||
*/
|
||||
private $useAnalyzer;
|
||||
/**
|
||||
* @var \Rector\CodingStyle\Node\UseNameAliasToNameResolver
|
||||
*/
|
||||
private $useNameAliasToNameResolver;
|
||||
/**
|
||||
* @var \Rector\CodingStyle\Naming\NameRenamer
|
||||
*/
|
||||
private $nameRenamer;
|
||||
/**
|
||||
* @var \Rector\CodingStyle\ClassNameImport\ClassNameImportSkipper
|
||||
*/
|
||||
private $classNameImportSkipper;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\NodeFinder\FullyQualifiedFromUseFinder
|
||||
*/
|
||||
private $fullyQualifiedFromUseFinder;
|
||||
public function __construct(\Rector\CodingStyle\Node\DocAliasResolver $docAliasResolver, \Rector\NameImporting\NodeAnalyzer\UseAnalyzer $useAnalyzer, \Rector\CodingStyle\Node\UseNameAliasToNameResolver $useNameAliasToNameResolver, \Rector\CodingStyle\Naming\NameRenamer $nameRenamer, \Rector\CodingStyle\ClassNameImport\ClassNameImportSkipper $classNameImportSkipper, \Rector\Core\PhpParser\NodeFinder\FullyQualifiedFromUseFinder $fullyQualifiedFromUseFinder)
|
||||
{
|
||||
$this->docAliasResolver = $docAliasResolver;
|
||||
$this->useAnalyzer = $useAnalyzer;
|
||||
$this->useNameAliasToNameResolver = $useNameAliasToNameResolver;
|
||||
$this->nameRenamer = $nameRenamer;
|
||||
$this->classNameImportSkipper = $classNameImportSkipper;
|
||||
$this->fullyQualifiedFromUseFinder = $fullyQualifiedFromUseFinder;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Removes unused use aliases. Keep annotation aliases like "Doctrine\\ORM\\Mapping as ORM" to keep convention format', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
use Symfony\Kernel as BaseKernel;
|
||||
|
||||
class SomeClass extends BaseKernel
|
||||
{
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
use Symfony\Kernel;
|
||||
|
||||
class SomeClass extends Kernel
|
||||
{
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Stmt\Use_::class];
|
||||
}
|
||||
/**
|
||||
* @param Use_ $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
if ($this->shouldSkipUse($node)) {
|
||||
return null;
|
||||
}
|
||||
$searchNode = $this->resolveSearchNode($node);
|
||||
if (!$searchNode instanceof \PhpParser\Node) {
|
||||
return null;
|
||||
}
|
||||
$this->namesAndParents = $this->useAnalyzer->resolveUsedNameNodes($searchNode);
|
||||
$this->resolvedDocPossibleAliases = $this->docAliasResolver->resolve($searchNode);
|
||||
$this->useNamesAliasToName = $this->useNameAliasToNameResolver->resolve($this->file);
|
||||
// lowercase
|
||||
$this->resolvedDocPossibleAliases = $this->lowercaseArray($this->resolvedDocPossibleAliases);
|
||||
$this->useNamesAliasToName = \array_change_key_case($this->useNamesAliasToName, \CASE_LOWER);
|
||||
foreach ($node->uses as $use) {
|
||||
if ($use->alias === null) {
|
||||
continue;
|
||||
}
|
||||
$lastName = $use->name->getLast();
|
||||
/** @var string $aliasName */
|
||||
$aliasName = $this->getName($use->alias);
|
||||
if ($this->shouldSkip($node, $lastName, $aliasName)) {
|
||||
continue;
|
||||
}
|
||||
// only last name is used → no need for alias
|
||||
$matchedNamesAndParents = $this->matchNamesAndParentsByShort($lastName);
|
||||
if ($matchedNamesAndParents !== []) {
|
||||
$use->alias = null;
|
||||
continue;
|
||||
}
|
||||
$this->refactorAliasName($node, $use->name->toString(), $lastName, $use);
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
private function shouldSkipUse(\PhpParser\Node\Stmt\Use_ $use) : bool
|
||||
{
|
||||
// skip cases without namespace, problematic to analyse
|
||||
$namespace = $this->betterNodeFinder->findParentType($use, \PhpParser\Node\Stmt\Namespace_::class);
|
||||
if (!$namespace instanceof \PhpParser\Node) {
|
||||
return \true;
|
||||
}
|
||||
return !$this->hasUseAlias($use);
|
||||
}
|
||||
/**
|
||||
* @param string[] $values
|
||||
* @return string[]
|
||||
*/
|
||||
private function lowercaseArray(array $values) : array
|
||||
{
|
||||
return \array_map('strtolower', $values);
|
||||
}
|
||||
private function shouldSkip(\PhpParser\Node\Stmt\Use_ $use, string $lastName, string $aliasName) : bool
|
||||
{
|
||||
// PHP is case insensitive
|
||||
$loweredLastName = \strtolower($lastName);
|
||||
$loweredAliasName = \strtolower($aliasName);
|
||||
// both are used → nothing to remove
|
||||
if ($this->areBothShortNamesUsed($loweredLastName, $loweredLastName)) {
|
||||
return \true;
|
||||
}
|
||||
// part of some @Doc annotation
|
||||
if (\in_array($loweredAliasName, $this->resolvedDocPossibleAliases, \true)) {
|
||||
return \true;
|
||||
}
|
||||
return (bool) $this->fullyQualifiedFromUseFinder->matchAliasNamespace($use, $loweredAliasName);
|
||||
}
|
||||
private function refactorAliasName(\PhpParser\Node\Stmt\Use_ $use, string $fullUseUseName, string $lastName, \PhpParser\Node\Stmt\UseUse $useUse) : void
|
||||
{
|
||||
$parentUse = $use->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
if (!$parentUse instanceof \PhpParser\Node) {
|
||||
return;
|
||||
}
|
||||
/** @var Use_[] $uses */
|
||||
$uses = $this->betterNodeFinder->find($parentUse, function (\PhpParser\Node $node) use($use) : bool {
|
||||
if ($node === $use) {
|
||||
return \false;
|
||||
}
|
||||
return $node instanceof \PhpParser\Node\Stmt\Use_;
|
||||
});
|
||||
if ($this->classNameImportSkipper->isShortNameInUseStatement(new \PhpParser\Node\Name($lastName), $uses)) {
|
||||
return;
|
||||
}
|
||||
$parentsAndNames = $this->matchNamesAndParentsByShort($fullUseUseName);
|
||||
if ($parentsAndNames === []) {
|
||||
return;
|
||||
}
|
||||
$this->nameRenamer->renameNameNode($parentsAndNames, $lastName);
|
||||
$useUse->alias = null;
|
||||
}
|
||||
private function hasUseAlias(\PhpParser\Node\Stmt\Use_ $use) : bool
|
||||
{
|
||||
foreach ($use->uses as $useUse) {
|
||||
if ($useUse->alias !== null) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
private function resolveSearchNode(\PhpParser\Node\Stmt\Use_ $use) : ?\PhpParser\Node
|
||||
{
|
||||
$searchNode = $use->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
if ($searchNode !== null) {
|
||||
return $searchNode;
|
||||
}
|
||||
return $use->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::NEXT_NODE);
|
||||
}
|
||||
private function areBothShortNamesUsed(string $firstName, string $secondName) : bool
|
||||
{
|
||||
$firstNamesAndParents = $this->matchNamesAndParentsByShort($firstName);
|
||||
$secondNamesAndParents = $this->matchNamesAndParentsByShort($secondName);
|
||||
return $firstNamesAndParents !== [] && $secondNamesAndParents !== [];
|
||||
}
|
||||
/**
|
||||
* @return NameAndParent[]
|
||||
*/
|
||||
private function matchNamesAndParentsByShort(string $shortName) : array
|
||||
{
|
||||
return \array_filter($this->namesAndParents, function (\Rector\NameImporting\ValueObject\NameAndParent $nameAndParent) use($shortName) : bool {
|
||||
return $nameAndParent->matchShortName($shortName);
|
||||
});
|
||||
}
|
||||
}
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '0c3527ebd8f871d71119b46e00cb001680fe76c1';
|
||||
public const PACKAGE_VERSION = '49aa15dbfb1932401ae68310c4064c273259ea4e';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-11-05 14:37:43';
|
||||
public const RELEASE_DATE = '2021-11-05 14:19:53';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20211105\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Core\PhpParser\NodeFinder;
|
||||
|
||||
use RectorPrefix20211105\Nette\Utils\Strings;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
final class FullyQualifiedFromUseFinder
|
||||
{
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
public function __construct(\Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
}
|
||||
public function matchAliasNamespace(\PhpParser\Node\Stmt\Use_ $use, string $loweredAliasName) : ?\PhpParser\Node
|
||||
{
|
||||
return $this->betterNodeFinder->findFirstNext($use, function (\PhpParser\Node $node) use($loweredAliasName) : bool {
|
||||
if (!$node instanceof \PhpParser\Node\Name\FullyQualified) {
|
||||
return \false;
|
||||
}
|
||||
$originalName = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::ORIGINAL_NAME);
|
||||
if (!$originalName instanceof \PhpParser\Node\Name) {
|
||||
return \false;
|
||||
}
|
||||
$loweredOriginalName = \strtolower($originalName->toString());
|
||||
$loweredOriginalNameNamespace = \RectorPrefix20211105\Nette\Utils\Strings::before($loweredOriginalName, '\\');
|
||||
return $loweredAliasName === $loweredOriginalNameNamespace;
|
||||
});
|
||||
}
|
||||
}
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit7ca76728edb0a984003398e31dc50a90::getLoader();
|
||||
return ComposerAutoloaderInit1597e5290d82f782f1db9173ddac309a::getLoader();
|
||||
|
7
vendor/composer/autoload_classmap.php
vendored
7
vendor/composer/autoload_classmap.php
vendored
@ -1410,7 +1410,6 @@ return array(
|
||||
'Rector\\CodingStyle\\Contract\\ClassNameImport\\ClassNameImportSkipVoterInterface' => $baseDir . '/rules/CodingStyle/Contract/ClassNameImport/ClassNameImportSkipVoterInterface.php',
|
||||
'Rector\\CodingStyle\\Enum\\PreferenceSelfThis' => $baseDir . '/rules/CodingStyle/Enum/PreferenceSelfThis.php',
|
||||
'Rector\\CodingStyle\\Naming\\ClassNaming' => $baseDir . '/rules/CodingStyle/Naming/ClassNaming.php',
|
||||
'Rector\\CodingStyle\\Naming\\NameRenamer' => $baseDir . '/rules/CodingStyle/Naming/NameRenamer.php',
|
||||
'Rector\\CodingStyle\\NodeAnalyzer\\ImplodeAnalyzer' => $baseDir . '/rules/CodingStyle/NodeAnalyzer/ImplodeAnalyzer.php',
|
||||
'Rector\\CodingStyle\\NodeAnalyzer\\SpreadVariablesCollector' => $baseDir . '/rules/CodingStyle/NodeAnalyzer/SpreadVariablesCollector.php',
|
||||
'Rector\\CodingStyle\\NodeAnalyzer\\UseImportNameMatcher' => $baseDir . '/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php',
|
||||
@ -1419,9 +1418,7 @@ return array(
|
||||
'Rector\\CodingStyle\\NodeFactory\\JsonEncodeStaticCallFactory' => $baseDir . '/rules/CodingStyle/NodeFactory/JsonEncodeStaticCallFactory.php',
|
||||
'Rector\\CodingStyle\\Node\\ConcatJoiner' => $baseDir . '/rules/CodingStyle/Node/ConcatJoiner.php',
|
||||
'Rector\\CodingStyle\\Node\\ConcatManipulator' => $baseDir . '/rules/CodingStyle/Node/ConcatManipulator.php',
|
||||
'Rector\\CodingStyle\\Node\\DocAliasResolver' => $baseDir . '/rules/CodingStyle/Node/DocAliasResolver.php',
|
||||
'Rector\\CodingStyle\\Node\\NameImporter' => $baseDir . '/rules/CodingStyle/Node/NameImporter.php',
|
||||
'Rector\\CodingStyle\\Node\\UseNameAliasToNameResolver' => $baseDir . '/rules/CodingStyle/Node/UseNameAliasToNameResolver.php',
|
||||
'Rector\\CodingStyle\\Rector\\Assign\\ManualJsonStringToJsonEncodeArrayRector' => $baseDir . '/rules/CodingStyle/Rector/Assign/ManualJsonStringToJsonEncodeArrayRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Assign\\PHPStormVarAnnotationRector' => $baseDir . '/rules/CodingStyle/Rector/Assign/PHPStormVarAnnotationRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Assign\\SplitDoubleAssignRector' => $baseDir . '/rules/CodingStyle/Rector/Assign/SplitDoubleAssignRector.php',
|
||||
@ -1459,7 +1456,6 @@ return array(
|
||||
'Rector\\CodingStyle\\Rector\\String_\\UseClassKeywordForClassNameResolutionRector' => $baseDir . '/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Switch_\\BinarySwitchToIfElseRector' => $baseDir . '/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Ternary\\TernaryConditionVariableAssignmentRector' => $baseDir . '/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Use_\\RemoveUnusedAliasRector' => $baseDir . '/rules/CodingStyle/Rector/Use_/RemoveUnusedAliasRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Use_\\SeparateMultiUseImportsRector' => $baseDir . '/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php',
|
||||
'Rector\\CodingStyle\\Reflection\\VendorLocationDetector' => $baseDir . '/rules/CodingStyle/Reflection/VendorLocationDetector.php',
|
||||
'Rector\\CodingStyle\\TypeAnalyzer\\IterableTypeAnalyzer' => $baseDir . '/rules/CodingStyle/TypeAnalyzer/IterableTypeAnalyzer.php',
|
||||
@ -1590,7 +1586,6 @@ return array(
|
||||
'Rector\\Core\\PhpParser\\ClassLikeAstResolver' => $baseDir . '/src/PhpParser/ClassLikeAstResolver.php',
|
||||
'Rector\\Core\\PhpParser\\Comparing\\ConditionSearcher' => $baseDir . '/src/PhpParser/Comparing/ConditionSearcher.php',
|
||||
'Rector\\Core\\PhpParser\\Comparing\\NodeComparator' => $baseDir . '/src/PhpParser/Comparing/NodeComparator.php',
|
||||
'Rector\\Core\\PhpParser\\NodeFinder\\FullyQualifiedFromUseFinder' => $baseDir . '/src/PhpParser/NodeFinder/FullyQualifiedFromUseFinder.php',
|
||||
'Rector\\Core\\PhpParser\\NodeFinder\\LocalConstantFinder' => $baseDir . '/src/PhpParser/NodeFinder/LocalConstantFinder.php',
|
||||
'Rector\\Core\\PhpParser\\NodeFinder\\LocalMethodCallFinder' => $baseDir . '/src/PhpParser/NodeFinder/LocalMethodCallFinder.php',
|
||||
'Rector\\Core\\PhpParser\\NodeFinder\\PropertyFetchFinder' => $baseDir . '/src/PhpParser/NodeFinder/PropertyFetchFinder.php',
|
||||
@ -1944,8 +1939,6 @@ return array(
|
||||
'Rector\\MysqlToMysqli\\Rector\\FuncCall\\MysqlFuncCallToMysqliRector' => $baseDir . '/rules/MysqlToMysqli/Rector/FuncCall/MysqlFuncCallToMysqliRector.php',
|
||||
'Rector\\MysqlToMysqli\\Rector\\FuncCall\\MysqlPConnectToMysqliConnectRector' => $baseDir . '/rules/MysqlToMysqli/Rector/FuncCall/MysqlPConnectToMysqliConnectRector.php',
|
||||
'Rector\\MysqlToMysqli\\Rector\\FuncCall\\MysqlQueryMysqlErrorWithLinkRector' => $baseDir . '/rules/MysqlToMysqli/Rector/FuncCall/MysqlQueryMysqlErrorWithLinkRector.php',
|
||||
'Rector\\NameImporting\\NodeAnalyzer\\UseAnalyzer' => $baseDir . '/packages/NameImporting/NodeAnalyzer/UseAnalyzer.php',
|
||||
'Rector\\NameImporting\\ValueObject\\NameAndParent' => $baseDir . '/packages/NameImporting/ValueObject/NameAndParent.php',
|
||||
'Rector\\Naming\\Contract\\Guard\\ConflictingNameGuardInterface' => $baseDir . '/rules/Naming/Contract/Guard/ConflictingNameGuardInterface.php',
|
||||
'Rector\\Naming\\Contract\\RenameParamValueObjectInterface' => $baseDir . '/rules/Naming/Contract/RenameParamValueObjectInterface.php',
|
||||
'Rector\\Naming\\Contract\\RenamePropertyValueObjectInterface' => $baseDir . '/rules/Naming/Contract/RenamePropertyValueObjectInterface.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 ComposerAutoloaderInit7ca76728edb0a984003398e31dc50a90
|
||||
class ComposerAutoloaderInit1597e5290d82f782f1db9173ddac309a
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit7ca76728edb0a984003398e31dc50a90
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit7ca76728edb0a984003398e31dc50a90', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit1597e5290d82f782f1db9173ddac309a', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit7ca76728edb0a984003398e31dc50a90', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit1597e5290d82f782f1db9173ddac309a', '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\ComposerStaticInit7ca76728edb0a984003398e31dc50a90::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit1597e5290d82f782f1db9173ddac309a::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInit7ca76728edb0a984003398e31dc50a90
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit7ca76728edb0a984003398e31dc50a90::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit1597e5290d82f782f1db9173ddac309a::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire7ca76728edb0a984003398e31dc50a90($fileIdentifier, $file);
|
||||
composerRequire1597e5290d82f782f1db9173ddac309a($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire7ca76728edb0a984003398e31dc50a90($fileIdentifier, $file)
|
||||
function composerRequire1597e5290d82f782f1db9173ddac309a($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
15
vendor/composer/autoload_static.php
vendored
15
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit7ca76728edb0a984003398e31dc50a90
|
||||
class ComposerStaticInit1597e5290d82f782f1db9173ddac309a
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
@ -1740,7 +1740,6 @@ class ComposerStaticInit7ca76728edb0a984003398e31dc50a90
|
||||
'Rector\\CodingStyle\\Contract\\ClassNameImport\\ClassNameImportSkipVoterInterface' => __DIR__ . '/../..' . '/rules/CodingStyle/Contract/ClassNameImport/ClassNameImportSkipVoterInterface.php',
|
||||
'Rector\\CodingStyle\\Enum\\PreferenceSelfThis' => __DIR__ . '/../..' . '/rules/CodingStyle/Enum/PreferenceSelfThis.php',
|
||||
'Rector\\CodingStyle\\Naming\\ClassNaming' => __DIR__ . '/../..' . '/rules/CodingStyle/Naming/ClassNaming.php',
|
||||
'Rector\\CodingStyle\\Naming\\NameRenamer' => __DIR__ . '/../..' . '/rules/CodingStyle/Naming/NameRenamer.php',
|
||||
'Rector\\CodingStyle\\NodeAnalyzer\\ImplodeAnalyzer' => __DIR__ . '/../..' . '/rules/CodingStyle/NodeAnalyzer/ImplodeAnalyzer.php',
|
||||
'Rector\\CodingStyle\\NodeAnalyzer\\SpreadVariablesCollector' => __DIR__ . '/../..' . '/rules/CodingStyle/NodeAnalyzer/SpreadVariablesCollector.php',
|
||||
'Rector\\CodingStyle\\NodeAnalyzer\\UseImportNameMatcher' => __DIR__ . '/../..' . '/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php',
|
||||
@ -1749,9 +1748,7 @@ class ComposerStaticInit7ca76728edb0a984003398e31dc50a90
|
||||
'Rector\\CodingStyle\\NodeFactory\\JsonEncodeStaticCallFactory' => __DIR__ . '/../..' . '/rules/CodingStyle/NodeFactory/JsonEncodeStaticCallFactory.php',
|
||||
'Rector\\CodingStyle\\Node\\ConcatJoiner' => __DIR__ . '/../..' . '/rules/CodingStyle/Node/ConcatJoiner.php',
|
||||
'Rector\\CodingStyle\\Node\\ConcatManipulator' => __DIR__ . '/../..' . '/rules/CodingStyle/Node/ConcatManipulator.php',
|
||||
'Rector\\CodingStyle\\Node\\DocAliasResolver' => __DIR__ . '/../..' . '/rules/CodingStyle/Node/DocAliasResolver.php',
|
||||
'Rector\\CodingStyle\\Node\\NameImporter' => __DIR__ . '/../..' . '/rules/CodingStyle/Node/NameImporter.php',
|
||||
'Rector\\CodingStyle\\Node\\UseNameAliasToNameResolver' => __DIR__ . '/../..' . '/rules/CodingStyle/Node/UseNameAliasToNameResolver.php',
|
||||
'Rector\\CodingStyle\\Rector\\Assign\\ManualJsonStringToJsonEncodeArrayRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Assign/ManualJsonStringToJsonEncodeArrayRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Assign\\PHPStormVarAnnotationRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Assign/PHPStormVarAnnotationRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Assign\\SplitDoubleAssignRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Assign/SplitDoubleAssignRector.php',
|
||||
@ -1789,7 +1786,6 @@ class ComposerStaticInit7ca76728edb0a984003398e31dc50a90
|
||||
'Rector\\CodingStyle\\Rector\\String_\\UseClassKeywordForClassNameResolutionRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Switch_\\BinarySwitchToIfElseRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Ternary\\TernaryConditionVariableAssignmentRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Use_\\RemoveUnusedAliasRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Use_/RemoveUnusedAliasRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Use_\\SeparateMultiUseImportsRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php',
|
||||
'Rector\\CodingStyle\\Reflection\\VendorLocationDetector' => __DIR__ . '/../..' . '/rules/CodingStyle/Reflection/VendorLocationDetector.php',
|
||||
'Rector\\CodingStyle\\TypeAnalyzer\\IterableTypeAnalyzer' => __DIR__ . '/../..' . '/rules/CodingStyle/TypeAnalyzer/IterableTypeAnalyzer.php',
|
||||
@ -1920,7 +1916,6 @@ class ComposerStaticInit7ca76728edb0a984003398e31dc50a90
|
||||
'Rector\\Core\\PhpParser\\ClassLikeAstResolver' => __DIR__ . '/../..' . '/src/PhpParser/ClassLikeAstResolver.php',
|
||||
'Rector\\Core\\PhpParser\\Comparing\\ConditionSearcher' => __DIR__ . '/../..' . '/src/PhpParser/Comparing/ConditionSearcher.php',
|
||||
'Rector\\Core\\PhpParser\\Comparing\\NodeComparator' => __DIR__ . '/../..' . '/src/PhpParser/Comparing/NodeComparator.php',
|
||||
'Rector\\Core\\PhpParser\\NodeFinder\\FullyQualifiedFromUseFinder' => __DIR__ . '/../..' . '/src/PhpParser/NodeFinder/FullyQualifiedFromUseFinder.php',
|
||||
'Rector\\Core\\PhpParser\\NodeFinder\\LocalConstantFinder' => __DIR__ . '/../..' . '/src/PhpParser/NodeFinder/LocalConstantFinder.php',
|
||||
'Rector\\Core\\PhpParser\\NodeFinder\\LocalMethodCallFinder' => __DIR__ . '/../..' . '/src/PhpParser/NodeFinder/LocalMethodCallFinder.php',
|
||||
'Rector\\Core\\PhpParser\\NodeFinder\\PropertyFetchFinder' => __DIR__ . '/../..' . '/src/PhpParser/NodeFinder/PropertyFetchFinder.php',
|
||||
@ -2274,8 +2269,6 @@ class ComposerStaticInit7ca76728edb0a984003398e31dc50a90
|
||||
'Rector\\MysqlToMysqli\\Rector\\FuncCall\\MysqlFuncCallToMysqliRector' => __DIR__ . '/../..' . '/rules/MysqlToMysqli/Rector/FuncCall/MysqlFuncCallToMysqliRector.php',
|
||||
'Rector\\MysqlToMysqli\\Rector\\FuncCall\\MysqlPConnectToMysqliConnectRector' => __DIR__ . '/../..' . '/rules/MysqlToMysqli/Rector/FuncCall/MysqlPConnectToMysqliConnectRector.php',
|
||||
'Rector\\MysqlToMysqli\\Rector\\FuncCall\\MysqlQueryMysqlErrorWithLinkRector' => __DIR__ . '/../..' . '/rules/MysqlToMysqli/Rector/FuncCall/MysqlQueryMysqlErrorWithLinkRector.php',
|
||||
'Rector\\NameImporting\\NodeAnalyzer\\UseAnalyzer' => __DIR__ . '/../..' . '/packages/NameImporting/NodeAnalyzer/UseAnalyzer.php',
|
||||
'Rector\\NameImporting\\ValueObject\\NameAndParent' => __DIR__ . '/../..' . '/packages/NameImporting/ValueObject/NameAndParent.php',
|
||||
'Rector\\Naming\\Contract\\Guard\\ConflictingNameGuardInterface' => __DIR__ . '/../..' . '/rules/Naming/Contract/Guard/ConflictingNameGuardInterface.php',
|
||||
'Rector\\Naming\\Contract\\RenameParamValueObjectInterface' => __DIR__ . '/../..' . '/rules/Naming/Contract/RenameParamValueObjectInterface.php',
|
||||
'Rector\\Naming\\Contract\\RenamePropertyValueObjectInterface' => __DIR__ . '/../..' . '/rules/Naming/Contract/RenamePropertyValueObjectInterface.php',
|
||||
@ -3529,9 +3522,9 @@ class ComposerStaticInit7ca76728edb0a984003398e31dc50a90
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit7ca76728edb0a984003398e31dc50a90::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit7ca76728edb0a984003398e31dc50a90::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit7ca76728edb0a984003398e31dc50a90::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit1597e5290d82f782f1db9173ddac309a::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit1597e5290d82f782f1db9173ddac309a::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit1597e5290d82f782f1db9173ddac309a::$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('RectorPrefix20211105\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit7ca76728edb0a984003398e31dc50a90', false) && !interface_exists('ComposerAutoloaderInit7ca76728edb0a984003398e31dc50a90', false) && !trait_exists('ComposerAutoloaderInit7ca76728edb0a984003398e31dc50a90', false)) {
|
||||
spl_autoload_call('RectorPrefix20211105\ComposerAutoloaderInit7ca76728edb0a984003398e31dc50a90');
|
||||
if (!class_exists('ComposerAutoloaderInit1597e5290d82f782f1db9173ddac309a', false) && !interface_exists('ComposerAutoloaderInit1597e5290d82f782f1db9173ddac309a', false) && !trait_exists('ComposerAutoloaderInit1597e5290d82f782f1db9173ddac309a', false)) {
|
||||
spl_autoload_call('RectorPrefix20211105\ComposerAutoloaderInit1597e5290d82f782f1db9173ddac309a');
|
||||
}
|
||||
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('RectorPrefix20211105\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -3306,9 +3306,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20211105\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire7ca76728edb0a984003398e31dc50a90')) {
|
||||
function composerRequire7ca76728edb0a984003398e31dc50a90() {
|
||||
return \RectorPrefix20211105\composerRequire7ca76728edb0a984003398e31dc50a90(...func_get_args());
|
||||
if (!function_exists('composerRequire1597e5290d82f782f1db9173ddac309a')) {
|
||||
function composerRequire1597e5290d82f782f1db9173ddac309a() {
|
||||
return \RectorPrefix20211105\composerRequire1597e5290d82f782f1db9173ddac309a(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user