Updated Rector to commit 4680c56d00

4680c56d00 Bump Rector package deps (#1087)
This commit is contained in:
Tomas Votruba 2021-10-27 23:25:15 +00:00
parent 2e2f586bf9
commit 0c54ea5aa9
43 changed files with 150 additions and 121 deletions

View File

@ -30,5 +30,7 @@
"rector/rector-cakephp": "*",
"rector/rector-laravel": "*",
"rector/rector-phpoffice": "*"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

View File

@ -15,7 +15,7 @@ final class PropertyType
*/
private $varType;
/**
* @var \PhpParser\Node\Name|\PhpParser\Node\NullableType|PhpParserUnionType|null
* @var Name|NullableType|PhpParserUnionType|null
*/
private $propertyTypeNode;
/**

View File

@ -65,7 +65,7 @@ final class NodeNameResolver
return \false;
}
/**
* @param Node|Node[] $node
* @param \PhpParser\Node|mixed[] $node
*/
public function isName($node, string $name) : bool
{

View File

@ -27,7 +27,7 @@ final class ClassAndInterfaceTypeResolver implements \Rector\NodeTypeResolver\Co
return [\PhpParser\Node\Stmt\Class_::class, \PhpParser\Node\Stmt\Interface_::class];
}
/**
* @param Class_|Interface_ $node
* @param \PhpParser\Node $node
*/
public function resolve($node) : \PHPStan\Type\Type
{

View File

@ -35,7 +35,7 @@ final class ClassMethodOrClassConstTypeResolver implements \Rector\NodeTypeResol
return [\PhpParser\Node\Stmt\ClassMethod::class, \PhpParser\Node\Stmt\ClassConst::class];
}
/**
* @param ClassMethod|ClassConst $node
* @param \PhpParser\Node $node
*/
public function resolve($node) : \PHPStan\Type\Type
{

View File

@ -51,7 +51,7 @@ final class StaticCallMethodCallTypeResolver implements \Rector\NodeTypeResolver
return [\PhpParser\Node\Expr\StaticCall::class, \PhpParser\Node\Expr\MethodCall::class];
}
/**
* @param StaticCall|MethodCall $node
* @param \PhpParser\Node $node
*/
public function resolve($node) : \PHPStan\Type\Type
{

View File

@ -11,28 +11,28 @@ use PHPStan\Type\Constant\ConstantFloatType;
use PHPStan\Type\Constant\ConstantIntegerType;
use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\FloatType;
use PHPStan\Type\Generic\GenericObjectType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\MixedType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\StringType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeTraverser;
use PHPStan\Type\TypeUtils;
use PHPStan\Type\VerbosityLevel;
use Rector\NodeTypeResolver\PHPStan\TypeHasher;
use Rector\StaticTypeMapper\TypeFactory\UnionTypeFactory;
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType;
final class TypeFactory
{
/**
* @var \Rector\StaticTypeMapper\TypeFactory\UnionTypeFactory
*/
private $unionTypeFactory;
public function __construct(\Rector\StaticTypeMapper\TypeFactory\UnionTypeFactory $unionTypeFactory)
/**
* @var \Rector\NodeTypeResolver\PHPStan\TypeHasher
*/
private $typeHasher;
public function __construct(\Rector\StaticTypeMapper\TypeFactory\UnionTypeFactory $unionTypeFactory, \Rector\NodeTypeResolver\PHPStan\TypeHasher $typeHasher)
{
$this->unionTypeFactory = $unionTypeFactory;
$this->typeHasher = $typeHasher;
}
/**
* @param Type[] $types
@ -64,8 +64,7 @@ final class TypeFactory
if (!$keepConstant) {
$type = $this->removeValueFromConstantType($type);
}
$type = $this->normalizeObjectTypes($type);
$typeHash = $type->describe(\PHPStan\Type\VerbosityLevel::cache());
$typeHash = $this->typeHasher->createTypeHash($type);
$uniqueTypes[$typeHash] = $type;
}
// re-index
@ -151,16 +150,4 @@ final class TypeFactory
}
return $unwrappedTypes;
}
private function normalizeObjectTypes(\PHPStan\Type\Type $type) : \PHPStan\Type\Type
{
return \PHPStan\Type\TypeTraverser::map($type, function (\PHPStan\Type\Type $currentType, callable $traverseCallback) : Type {
if ($currentType instanceof \Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType) {
return new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType($currentType->getFullyQualifiedName());
}
if ($currentType instanceof \PHPStan\Type\ObjectType && !$currentType instanceof \PHPStan\Type\Generic\GenericObjectType && !$currentType instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType && $currentType->getClassName() !== 'Iterator') {
return new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType($currentType->getClassName());
}
return $traverseCallback($currentType);
});
}
}

View File

@ -7,7 +7,9 @@ use PHPStan\Type\ArrayType;
use PHPStan\Type\BooleanType;
use PHPStan\Type\ConstantType;
use PHPStan\Type\Generic\GenericObjectType;
use PHPStan\Type\IterableType;
use PHPStan\Type\MixedType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeTraverser;
use PHPStan\Type\TypeWithClassName;
@ -23,7 +25,7 @@ final class TypeHasher
{
return $this->createTypeHash($firstType) === $this->createTypeHash($secondType);
}
private function createTypeHash(\PHPStan\Type\Type $type) : string
public function createTypeHash(\PHPStan\Type\Type $type) : string
{
if ($type instanceof \PHPStan\Type\MixedType) {
return \serialize($type) . $type->isExplicitMixed();
@ -43,6 +45,17 @@ final class TypeHasher
if ($type instanceof \PHPStan\Type\UnionType) {
return $this->createUnionTypeHash($type);
}
$type = $this->normalizeObjectType($type);
// normalize iterable
$type = \PHPStan\Type\TypeTraverser::map($type, function (\PHPStan\Type\Type $currentType, callable $traverseCallback) : Type {
if (!$currentType instanceof \PHPStan\Type\ObjectType) {
return $traverseCallback($currentType);
}
if ($currentType->getClassName() === 'iterable') {
return new \PHPStan\Type\IterableType(new \PHPStan\Type\MixedType(), new \PHPStan\Type\MixedType());
}
return $traverseCallback($currentType);
});
return $type->describe(\PHPStan\Type\VerbosityLevel::value());
}
private function resolveUniqueTypeWithClassNameHash(\PHPStan\Type\TypeWithClassName $typeWithClassName) : string
@ -51,7 +64,7 @@ final class TypeHasher
return $typeWithClassName->getFullyQualifiedName();
}
if ($typeWithClassName instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType) {
return $typeWithClassName->getFullyQualifiedClass();
return $typeWithClassName->getFullyQualifiedName();
}
return $typeWithClassName->getClassName();
}
@ -66,11 +79,26 @@ final class TypeHasher
$normalizedUnionType = clone $sortedUnionType;
// change alias to non-alias
$normalizedUnionType = \PHPStan\Type\TypeTraverser::map($normalizedUnionType, function (\PHPStan\Type\Type $type, callable $callable) : Type {
if (!$type instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType) {
if (!$type instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType && !$type instanceof \Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType) {
return $callable($type);
}
return new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType($type->getFullyQualifiedClass());
return new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType($type->getFullyQualifiedName());
});
return $normalizedUnionType->describe(\PHPStan\Type\VerbosityLevel::precise());
}
private function normalizeObjectType(\PHPStan\Type\Type $type) : \PHPStan\Type\Type
{
return \PHPStan\Type\TypeTraverser::map($type, function (\PHPStan\Type\Type $currentType, callable $traverseCallback) : Type {
if ($currentType instanceof \Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType) {
return new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType($currentType->getFullyQualifiedName());
}
if ($currentType instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType) {
return new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType($currentType->getFullyQualifiedName());
}
if ($currentType instanceof \PHPStan\Type\ObjectType && !$currentType instanceof \PHPStan\Type\Generic\GenericObjectType && !$currentType instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType && $currentType->getClassName() !== 'Iterator' && $currentType->getClassName() !== 'iterable') {
return new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType($currentType->getClassName());
}
return $traverseCallback($currentType);
});
}
}

View File

@ -57,6 +57,11 @@ final class TypeComparator
}
public function areTypesEqual(\PHPStan\Type\Type $firstType, \PHPStan\Type\Type $secondType) : bool
{
$firstTypeHash = $this->typeHasher->createTypeHash($firstType);
$secondTypeHash = $this->typeHasher->createTypeHash($secondType);
if ($firstTypeHash === $secondTypeHash) {
return \true;
}
if ($this->scalarTypeComparator->areEqualScalar($firstType, $secondType)) {
return \true;
}
@ -99,8 +104,7 @@ final class TypeComparator
}
private function areAliasedObjectMatchingFqnObject(\PHPStan\Type\Type $firstType, \PHPStan\Type\Type $secondType) : bool
{
if ($firstType instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType && $secondType instanceof \PHPStan\Type\ObjectType && $firstType->getFullyQualifiedClass() === $secondType->getClassName()) {
return \true;
if ($firstType instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType && $secondType instanceof \PHPStan\Type\ObjectType && $firstType->getFullyQualifiedName() === $secondType->getClassName()) {
}
if (!$secondType instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType) {
return \false;
@ -108,7 +112,7 @@ final class TypeComparator
if (!$firstType instanceof \PHPStan\Type\ObjectType) {
return \false;
}
return $secondType->getFullyQualifiedClass() === $firstType->getClassName();
return $secondType->getFullyQualifiedName() === $firstType->getClassName();
}
/**
* E.g. class A extends B, class B A[] is subtype of B[] keep A[]

View File

@ -48,7 +48,7 @@ final class CallableTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contra
return new \Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareCallableTypeNode(new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('callable'), [], $returnTypeNode);
}
/**
* @param CallableType|ClosureType $type
* @param \PHPStan\Type\Type $type
* @param \Rector\PHPStanStaticTypeMapper\Enum\TypeKind $typeKind
*/
public function mapToPhpParserNode($type, $typeKind) : ?\PhpParser\Node

View File

@ -21,7 +21,7 @@ final class AliasedObjectType extends \PHPStan\Type\ObjectType
$this->fullyQualifiedClass = $fullyQualifiedClass;
parent::__construct($alias);
}
public function getFullyQualifiedClass() : string
public function getFullyQualifiedName() : string
{
return $this->fullyQualifiedClass;
}
@ -55,7 +55,7 @@ final class AliasedObjectType extends \PHPStan\Type\ObjectType
{
// compare with FQN classes
if ($type instanceof \PHPStan\Type\TypeWithClassName) {
if ($type instanceof self && $this->fullyQualifiedClass === $type->getFullyQualifiedClass()) {
if ($type instanceof self && $this->fullyQualifiedClass === $type->getFullyQualifiedName()) {
return \true;
}
if ($this->fullyQualifiedClass === $type->getClassName()) {

View File

@ -21,6 +21,7 @@ use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
use Rector\Core\Rector\AbstractRector;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -153,6 +154,11 @@ CODE_SAMPLE
if ($varTagValueNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode) {
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $varTagValueNode);
}
return new \PhpParser\Node\Expr\BooleanNot(new \PhpParser\Node\Expr\Instanceof_($expr, new \PhpParser\Node\Name\FullyQualified($type->getClassName())));
if ($type instanceof \Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType) {
$fullyQualifiedType = $type->getFullyQualifiedName();
} else {
$fullyQualifiedType = $type->getClassName();
}
return new \PhpParser\Node\Expr\BooleanNot(new \PhpParser\Node\Expr\Instanceof_($expr, new \PhpParser\Node\Name\FullyQualified($fullyQualifiedType)));
}
}

View File

@ -9,7 +9,7 @@ use PhpParser\Node\Name;
final class NameAndParent
{
/**
* @var \PhpParser\Node\Name|\PhpParser\Node\Identifier
* @var Name|Identifier
*/
private $nameNode;
/**

View File

@ -14,11 +14,11 @@ use PhpParser\Node\Expr\Variable;
final class VariableAssignPair
{
/**
* @var \PhpParser\Node\Expr\Variable|\PhpParser\Node\Expr\ArrayDimFetch|\PhpParser\Node\Expr\PropertyFetch|\PhpParser\Node\Expr\StaticPropertyFetch
* @var Variable|ArrayDimFetch|PropertyFetch|StaticPropertyFetch
*/
private $variable;
/**
* @var \PhpParser\Node\Expr\Assign|\PhpParser\Node\Expr\AssignOp|\PhpParser\Node\Expr\AssignRef
* @var Assign|AssignOp|AssignRef
*/
private $assign;
/**

View File

@ -237,7 +237,7 @@ CODE_SAMPLE
return \false;
}
if ($type instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType) {
$typeName = $type->getFullyQualifiedClass();
$typeName = $type->getFullyQualifiedName();
}
return !$this->reflectionProvider->hasClass($typeName);
}

View File

@ -53,7 +53,7 @@ final class StrncmpMatchAndRefactor implements \Rector\Php80\Contract\StrStartWi
$this->argsAnalyzer = $argsAnalyzer;
}
/**
* @param Identical|NotIdentical $binaryOp
* @param \PhpParser\Node\Expr\BinaryOp $binaryOp
*/
public function match($binaryOp) : ?\Rector\Php80\ValueObject\StrStartsWith
{

View File

@ -43,7 +43,7 @@ final class StrposMatchAndRefactor implements \Rector\Php80\Contract\StrStartWit
$this->argsAnalyzer = $argsAnalyzer;
}
/**
* @param Identical|NotIdentical $binaryOp
* @param \PhpParser\Node\Expr\BinaryOp $binaryOp
*/
public function match($binaryOp) : ?\Rector\Php80\ValueObject\StrStartsWith
{

View File

@ -49,7 +49,7 @@ final class SubstrMatchAndRefactor implements \Rector\Php80\Contract\StrStartWit
$this->argsAnalyzer = $argsAnalyzer;
}
/**
* @param Identical|NotIdentical $binaryOp
* @param \PhpParser\Node\Expr\BinaryOp $binaryOp
*/
public function match($binaryOp) : ?\Rector\Php80\ValueObject\StrStartsWith
{

View File

@ -21,7 +21,7 @@ final class ReturnTagReturnTypeInferer implements \Rector\TypeDeclaration\Contra
$this->phpDocInfoFactory = $phpDocInfoFactory;
}
/**
* @param ClassMethod|Closure|Function_ $functionLike
* @param \PhpParser\Node\FunctionLike $functionLike
*/
public function inferFunctionLike($functionLike) : \PHPStan\Type\Type
{

View File

@ -75,7 +75,7 @@ final class ReturnedNodesReturnTypeInferer implements \Rector\TypeDeclaration\Co
$this->reflectionResolver = $reflectionResolver;
}
/**
* @param ClassMethod|Closure|Function_ $functionLike
* @param \PhpParser\Node\FunctionLike $functionLike
*/
public function inferFunctionLike($functionLike) : \PHPStan\Type\Type
{

View File

@ -41,7 +41,7 @@ final class YieldNodesReturnTypeInferer implements \Rector\TypeDeclaration\Contr
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
}
/**
* @param ClassMethod|Function_|Closure $functionLike
* @param \PhpParser\Node\FunctionLike $functionLike
*/
public function inferFunctionLike($functionLike) : \PHPStan\Type\Type
{

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '4eb4b46fa32517a38e42d654d6cb8a1566b49b83';
public const PACKAGE_VERSION = '4680c56d005b2dfade49fa14144e75862a9a8b1f';
/**
* @var string
*/
public const RELEASE_DATE = '2021-10-27 21:38:28';
public const RELEASE_DATE = '2021-10-27 23:06:12';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20211027\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

View File

@ -101,7 +101,7 @@ final class RectorKernel extends \RectorPrefix20211027\Symfony\Component\HttpKer
}
/**
* This allows to use "%vendor%" variables in imports
* @param ContainerInterface|ContainerBuilder $container
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
*/
protected function getContainerLoader($container) : \RectorPrefix20211027\Symfony\Component\Config\Loader\DelegatingLoader
{

View File

@ -24,7 +24,7 @@ final class NodeComparator
}
/**
* Removes all comments from both nodes
* @param Node|Node[]|null $node
* @param \PhpParser\Node|mixed[]|null $node
*/
public function printWithoutComments($node) : string
{
@ -33,8 +33,8 @@ final class NodeComparator
return \trim($content);
}
/**
* @param Node|Node[]|null $firstNode
* @param Node|Node[]|null $secondNode
* @param \PhpParser\Node|mixed[]|null $firstNode
* @param \PhpParser\Node|mixed[]|null $secondNode
*/
public function areNodesEqual($firstNode, $secondNode) : bool
{

View File

@ -87,7 +87,7 @@ final class BetterNodeFinder
/**
* @template T of Node
* @param array<class-string<T>> $types
* @param Node|Node[]|Stmt[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
* @return T[]
*/
public function findInstancesOf($nodes, array $types) : array
@ -102,7 +102,7 @@ final class BetterNodeFinder
/**
* @template T of Node
* @param class-string<T> $type
* @param Node|Node[]|Stmt[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
* @return T[]
*/
public function findInstanceOf($nodes, string $type) : array
@ -112,7 +112,7 @@ final class BetterNodeFinder
/**
* @template T of Node
* @param class-string<T> $type
* @param Node|Node[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
*/
public function findFirstInstanceOf($nodes, string $type) : ?\PhpParser\Node
{
@ -121,7 +121,7 @@ final class BetterNodeFinder
}
/**
* @param class-string<Node> $type
* @param Node|Node[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
*/
public function hasInstanceOfName($nodes, string $type, string $name) : bool
{
@ -129,14 +129,14 @@ final class BetterNodeFinder
return (bool) $this->findInstanceOfName($nodes, $type, $name);
}
/**
* @param Node|Node[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
*/
public function hasVariableOfName($nodes, string $name) : bool
{
return (bool) $this->findVariableOfName($nodes, $name);
}
/**
* @param Node|Node[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
* @return Variable|null
*/
public function findVariableOfName($nodes, string $name) : ?\PhpParser\Node
@ -144,7 +144,7 @@ final class BetterNodeFinder
return $this->findInstanceOfName($nodes, \PhpParser\Node\Expr\Variable::class, $name);
}
/**
* @param Node|Node[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
* @param array<class-string<Node>> $types
*/
public function hasInstancesOf($nodes, array $types) : bool
@ -162,7 +162,7 @@ final class BetterNodeFinder
/**
* @template T of Node
* @param class-string<T> $type
* @param Node|Node[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
*/
public function findLastInstanceOf($nodes, string $type) : ?\PhpParser\Node
{
@ -176,7 +176,7 @@ final class BetterNodeFinder
return $foundInstances[$lastItemKey];
}
/**
* @param Node|Node[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
* @return Node[]
*/
public function find($nodes, callable $filter) : array
@ -186,7 +186,7 @@ final class BetterNodeFinder
/**
* Excludes anonymous classes!
*
* @param Node[]|Node $nodes
* @param mixed[]|\PhpParser\Node $nodes
* @return ClassLike[]
*/
public function findClassLikes($nodes) : array
@ -214,7 +214,7 @@ final class BetterNodeFinder
});
}
/**
* @param Node|Node[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
*/
public function findFirst($nodes, callable $filter) : ?\PhpParser\Node
{
@ -346,7 +346,7 @@ final class BetterNodeFinder
}
/**
* @template T of Node
* @param Node|Node[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
* @param class-string<T> $type
*/
private function findInstanceOfName($nodes, string $type, string $name) : ?\PhpParser\Node

View File

@ -103,7 +103,7 @@ final class BetterStandardPrinter extends \PhpParser\PrettyPrinter\Standard
return $content;
}
/**
* @param Node|Node[]|null $node
* @param \PhpParser\Node|mixed[]|null $node
*/
public function print($node) : string
{

View File

@ -340,14 +340,14 @@ abstract class AbstractRector extends \PhpParser\NodeVisitorAbstract implements
return $this->nodeTypeResolver->getType($node);
}
/**
* @param Node|Node[] $nodes
* @param \PhpParser\Node|mixed[] $nodes
*/
protected function traverseNodesWithCallable($nodes, callable $callable) : void
{
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($nodes, $callable);
}
/**
* @param Node|Node[]|null $node
* @param \PhpParser\Node|mixed[]|null $node
*/
protected function print($node) : string
{

View File

@ -14,7 +14,7 @@ if (!\function_exists('dn')) {
}
if (!\function_exists('dump_node')) {
/**
* @param Node|Node[] $node
* @param \PhpParser\Node|mixed[] $node
*/
function dump_node($node, int $depth = 2) : void
{
@ -26,7 +26,7 @@ if (!\function_exists('dump_node')) {
}
if (!\function_exists('print_node')) {
/**
* @param Node|Node[] $node
* @param \PhpParser\Node|mixed[] $node
*/
function print_node($node) : void
{

2
vendor/autoload.php vendored
View File

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

View File

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

View File

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

View File

@ -1418,17 +1418,17 @@
},
{
"name": "rector\/rector-phpoffice",
"version": "0.11.4",
"version_normalized": "0.11.4.0",
"version": "0.11.6",
"version_normalized": "0.11.6.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpoffice.git",
"reference": "ed905225deea7710855dc20154b9761a8e5a3ae7"
"reference": "4a2cc96c46922633ac22ba30d5a1ad65b159cdb3"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpoffice\/zipball\/ed905225deea7710855dc20154b9761a8e5a3ae7",
"reference": "ed905225deea7710855dc20154b9761a8e5a3ae7",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpoffice\/zipball\/4a2cc96c46922633ac22ba30d5a1ad65b159cdb3",
"reference": "4a2cc96c46922633ac22ba30d5a1ad65b159cdb3",
"shasum": ""
},
"require": {
@ -1439,16 +1439,17 @@
},
"require-dev": {
"phpstan\/extension-installer": "^1.1",
"phpstan\/phpstan": "^1.0",
"phpunit\/phpunit": "^9.5",
"rector\/phpstan-rules": "^0.4.4",
"rector\/rector-generator": "^0.2",
"rector\/phpstan-rules": "^0.4.7",
"rector\/rector-generator": "^0.4",
"rector\/rector-src": "dev-main",
"symplify\/easy-coding-standard": "^9.4",
"symplify\/phpstan-extensions": "^9.4",
"symplify\/phpstan-rules": "^9.4",
"symplify\/rule-doc-generator": "^9.4"
"symplify\/easy-coding-standard": "^9.5",
"symplify\/phpstan-extensions": "^9.5",
"symplify\/phpstan-rules": "^9.5",
"symplify\/rule-doc-generator": "^9.5"
},
"time": "2021-10-07T19:05:12+00:00",
"time": "2021-10-27T19:54:32+00:00",
"type": "rector-extension",
"extra": {
"branch-alias": {
@ -1473,7 +1474,7 @@
"description": "Rector upgrades rules for PHP Office",
"support": {
"issues": "https:\/\/github.com\/rectorphp\/rector-phpoffice\/issues",
"source": "https:\/\/github.com\/rectorphp\/rector-phpoffice\/tree\/0.11.4"
"source": "https:\/\/github.com\/rectorphp\/rector-phpoffice\/tree\/0.11.6"
},
"install-path": "..\/rector\/rector-phpoffice"
},
@ -3812,19 +3813,19 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/astral.git",
"reference": "aba9535e02a5e6a6df96e303665cda29ed3dfbf3"
"reference": "e7743704216bd62e58eea37bcc27739210fdf71e"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/astral\/zipball\/aba9535e02a5e6a6df96e303665cda29ed3dfbf3",
"reference": "aba9535e02a5e6a6df96e303665cda29ed3dfbf3",
"url": "https:\/\/api.github.com\/repos\/symplify\/astral\/zipball\/e7743704216bd62e58eea37bcc27739210fdf71e",
"reference": "e7743704216bd62e58eea37bcc27739210fdf71e",
"shasum": ""
},
"require": {
"nette\/utils": "^3.2",
"nikic\/php-parser": "^4.13",
"php": ">=8.0",
"phpstan\/phpstan": "1.0.x-dev as 0.12.99",
"phpstan\/phpstan": "1.0.x-dev as 1.0",
"symfony\/dependency-injection": "^5.3|^6.0",
"symfony\/http-kernel": "^5.3|^6.0",
"symplify\/package-builder": "^9.5",
@ -3864,7 +3865,7 @@
"phpunit\/phpunit": "^9.5",
"symplify\/easy-testing": "^9.5"
},
"time": "2021-10-27T18:06:39+00:00",
"time": "2021-10-27T23:06:13+00:00",
"default-branch": true,
"type": "phpstan-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.6'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.26'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.8'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.31'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.4'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.14'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.31'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.26'));
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.6'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.26'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.8'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.31'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.6'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.14'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.31'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.26'));
private function __construct()
{
}

View File

@ -20,7 +20,7 @@ final class VariableWithType
*/
private $type;
/**
* @var \PhpParser\Node\Identifier|\PhpParser\Node\Name|\PhpParser\Node\NullableType|\PhpParser\Node\UnionType|null
* @var Identifier|Name|NullableType|UnionType|null
*/
private $phpParserTypeNode;
/**

View File

@ -25,7 +25,7 @@ final class ParamFinder
$this->nodeComparator = $nodeComparator;
}
/**
* @param Node|Node[] $nodeHaystack
* @param \PhpParser\Node|mixed[] $nodeHaystack
*/
public function isInAssign($nodeHaystack, \PhpParser\Node\Param $param) : bool
{

View File

@ -8,14 +8,15 @@
},
"require-dev": {
"phpstan\/extension-installer": "^1.1",
"rector\/phpstan-rules": "^0.4.4",
"rector\/phpstan-rules": "^0.4.7",
"phpstan\/phpstan": "^1.0",
"phpunit\/phpunit": "^9.5",
"symplify\/phpstan-rules": "^9.4",
"symplify\/phpstan-extensions": "^9.4",
"symplify\/easy-coding-standard": "^9.4",
"symplify\/rule-doc-generator": "^9.4",
"symplify\/phpstan-rules": "^9.5",
"symplify\/phpstan-extensions": "^9.5",
"symplify\/easy-coding-standard": "^9.5",
"symplify\/rule-doc-generator": "^9.5",
"rector\/rector-src": "dev-main",
"rector\/rector-generator": "^0.2"
"rector\/rector-generator": "^0.4"
},
"autoload": {
"psr-4": {

View File

@ -68,7 +68,7 @@ CODE_SAMPLE
private function castArgumentToArrayIfNotArrayType(\PhpParser\Node\Expr\MethodCall $methodCall) : void
{
$firstArgumentValue = $methodCall->args[0]->value;
$firstArgumentStaticType = $this->getStaticType($firstArgumentValue);
$firstArgumentStaticType = $this->getType($firstArgumentValue);
if ($firstArgumentStaticType instanceof \PHPStan\Type\ArrayType) {
return;
}

View File

@ -11,7 +11,7 @@ use PhpParser\Node\Stmt\Expression;
final class ExpectationMock
{
/**
* @var \PhpParser\Node\Expr\Variable|\PhpParser\Node\Expr\PropertyFetch
* @var Variable|PropertyFetch
*/
private $expectationVariable;
/**

View File

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

View File

@ -8,7 +8,7 @@
"nette\/utils": "^3.2",
"symfony\/dependency-injection": "^5.3|^6.0",
"symplify\/smart-file-system": "^9.5",
"phpstan\/phpstan": "1.0.x-dev as 0.12.99",
"phpstan\/phpstan": "1.0.x-dev as 1.0",
"symfony\/http-kernel": "^5.3|^6.0",
"nikic\/php-parser": "^4.13",
"symplify\/package-builder": "^9.5"

View File

@ -20,7 +20,7 @@ final class IdentifierNodeNameResolver implements \RectorPrefix20211027\Symplify
return $node instanceof \PhpParser\Node\Name;
}
/**
* @param Identifier|Name $node
* @param \PhpParser\Node $node
*/
public function resolve($node) : ?string
{

View File

@ -12,7 +12,7 @@ use RectorPrefix20211027\Symplify\Astral\NodeVisitor\CallableNodeVisitor;
final class SimpleCallableNodeTraverser
{
/**
* @param Node|Node[]|null $nodes
* @param \PhpParser\Node|mixed[]|null $nodes
*/
public function traverseNodesWithCallable($nodes, callable $callable) : void
{