From 0b834e609260175390b3b63fada6375b593a9ce4 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 12 Nov 2024 00:20:18 +0000 Subject: [PATCH] Updated Rector to commit 3949fc260b51c4355f86d21a26db7d2e4cae0b49 https://github.com/rectorphp/rector-src/commit/3949fc260b51c4355f86d21a26db7d2e4cae0b49 Move instanceof PHPStan Type to ->is*() take 1 (#6416) --- .../ClassMethod/ExplicitReturnNullRector.php | 3 +-- .../SimplifyEmptyCheckOnEmptyArrayRector.php | 11 +++++++---- .../If_/SimplifyIfNullableReturnRector.php | 7 +++---- .../Rector/If_/ReduceAlwaysFalseIfOrRector.php | 6 +----- .../If_/RemoveAlwaysTrueIfConditionRector.php | 14 +++----------- .../Switch_/ContinueToBreakInSwitchRector.php | 3 +-- .../Break_/RemoveZeroBreakContinueRector.php | 3 +-- .../Rector/FuncCall/GetClassOnNullRector.php | 3 +-- .../NullToStrictStringFuncCallArgRector.php | 3 +-- .../Strict/NodeFactory/ExactCompareFactory.php | 3 +-- .../NodeAnalyzer/CallTypesResolver.php | 3 +-- .../NodeAnalyzer/CallerParamMatcher.php | 3 +-- .../ClassMethodParamTypeCompleter.php | 5 ++--- .../TypeExpressionFromVarTagResolver.php | 3 +-- ...ReturnTypeFromBooleanStrictReturnsRector.php | 7 ++++--- .../ReturnTypeFromStrictTypedCallRector.php | 3 +-- .../PropertyTypeDefaultValueAnalyzer.php | 3 +-- .../TrustedClassMethodPropertyTypeInferer.php | 2 +- src/Application/VersionResolver.php | 4 ++-- src/NodeAnalyzer/PropertyAnalyzer.php | 6 ++---- src/NodeTypeResolver/NodeTypeResolver.php | 2 +- .../PHPStan/Type/StaticTypeAnalyzer.php | 3 +-- .../PHPStan/Type/TypeFactory.php | 17 +++++++---------- .../TypeComparator/ScalarTypeComparator.php | 3 +-- .../TypeComparator/TypeComparator.php | 3 +-- .../DoctrineTypeAnalyzer.php | 9 ++++----- .../TypeMapper/ArrayTypeMapper.php | 2 +- .../TypeMapper/BooleanTypeMapper.php | 13 +++++++++---- .../TypeMapper/UnionTypeMapper.php | 3 +-- .../Utils/TypeUnwrapper.php | 5 ++--- .../AnnotationToAttributeIntegerValueCaster.php | 5 ++--- vendor/composer/installed.php | 2 +- 32 files changed, 67 insertions(+), 95 deletions(-) diff --git a/rules/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector.php b/rules/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector.php index 6cf5d3d168c..b453bfdb28a 100644 --- a/rules/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector.php +++ b/rules/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector.php @@ -15,7 +15,6 @@ use PhpParser\Node\Stmt\Return_; use PhpParser\NodeTraverser; use PHPStan\Type\NullType; use PHPStan\Type\UnionType; -use PHPStan\Type\VoidType; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger; use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory; @@ -156,7 +155,7 @@ CODE_SAMPLE $newTypes = []; $hasChanged = \false; foreach ($returnType->getTypes() as $type) { - if ($type instanceof VoidType) { + if ($type->isVoid()->yes()) { $type = new NullType(); $hasChanged = \true; } diff --git a/rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php b/rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php index 21bfebb46f0..d1be8e6cc17 100644 --- a/rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php +++ b/rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php @@ -17,8 +17,8 @@ use PhpParser\Node\Identifier; use PhpParser\Node\Stmt\Property; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; -use PHPStan\Type\ArrayType; use PHPStan\Type\MixedType; +use PHPStan\Type\Type; use Rector\NodeAnalyzer\ExprAnalyzer; use Rector\Php\ReservedKeywordAnalyzer; use Rector\PhpParser\AstResolver; @@ -113,7 +113,7 @@ CODE_SAMPLE } private function isAllowedExpr(Expr $expr, Scope $scope) : bool { - if (!$scope->getType($expr) instanceof ArrayType) { + if (!$scope->getType($expr)->isArray()->yes()) { return \false; } if ($expr instanceof Variable) { @@ -136,7 +136,7 @@ CODE_SAMPLE $phpPropertyReflection = $classReflection->getNativeProperty($propertyName); $nativeType = $phpPropertyReflection->getNativeType(); if (!$nativeType instanceof MixedType) { - return $nativeType instanceof ArrayType; + return $nativeType->isArray()->yes(); } $property = $this->astResolver->resolvePropertyFromPropertyReflection($phpPropertyReflection); /** @@ -149,6 +149,9 @@ CODE_SAMPLE return \false; } $type = $this->allAssignNodePropertyTypeInferer->inferProperty($property, $classReflection, $this->file); - return $type instanceof ArrayType; + if (!$type instanceof Type) { + return \false; + } + return $type->isArray()->yes(); } } diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfNullableReturnRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfNullableReturnRector.php index cb8511916ff..c47701ce778 100644 --- a/rules/CodeQuality/Rector/If_/SimplifyIfNullableReturnRector.php +++ b/rules/CodeQuality/Rector/If_/SimplifyIfNullableReturnRector.php @@ -13,7 +13,6 @@ use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\Return_; -use PHPStan\Type\NullType; use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use PHPStan\Type\UnionType; @@ -200,10 +199,10 @@ CODE_SAMPLE if (\count($types) > 2) { return null; } - if ($types[0] instanceof FullyQualifiedObjectType && $types[1] instanceof NullType && $className === $types[0]->getClassName()) { + if ($types[0] instanceof FullyQualifiedObjectType && $types[1]->isNull()->yes() && $className === $types[0]->getClassName()) { return $this->createDirectReturn($expression, $expr, $unionType); } - if ($types[0] instanceof NullType && $types[1] instanceof FullyQualifiedObjectType && $className === $types[1]->getClassName()) { + if ($types[0]->isNull()->yes() && $types[1] instanceof FullyQualifiedObjectType && $className === $types[1]->getClassName()) { return $this->createDirectReturn($expression, $expr, $unionType); } if ($this->isNotTypedNullable($types, $className)) { @@ -219,7 +218,7 @@ CODE_SAMPLE if (!$types[0] instanceof ObjectType) { return \true; } - if (!$types[1] instanceof NullType) { + if (!$types[1]->isNull()->yes()) { return \true; } return $className !== $types[0]->getClassName(); diff --git a/rules/DeadCode/Rector/If_/ReduceAlwaysFalseIfOrRector.php b/rules/DeadCode/Rector/If_/ReduceAlwaysFalseIfOrRector.php index 3c741f2504b..87e3d6d0b4b 100644 --- a/rules/DeadCode/Rector/If_/ReduceAlwaysFalseIfOrRector.php +++ b/rules/DeadCode/Rector/If_/ReduceAlwaysFalseIfOrRector.php @@ -6,7 +6,6 @@ namespace Rector\DeadCode\Rector\If_; use PhpParser\Node; use PhpParser\Node\Expr\BinaryOp\BooleanOr; use PhpParser\Node\Stmt\If_; -use PHPStan\Type\Constant\ConstantBooleanType; use Rector\DeadCode\NodeAnalyzer\SafeLeftTypeBooleanAndOrAnalyzer; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -72,10 +71,7 @@ CODE_SAMPLE } $booleanOr = $node->cond; $conditionStaticType = $this->getType($booleanOr->left); - if (!$conditionStaticType instanceof ConstantBooleanType) { - return null; - } - if ($conditionStaticType->getValue()) { + if (!$conditionStaticType->isFalse()->yes()) { return null; } if (!$this->safeLeftTypeBooleanAndOrAnalyzer->isSafe($booleanOr)) { diff --git a/rules/DeadCode/Rector/If_/RemoveAlwaysTrueIfConditionRector.php b/rules/DeadCode/Rector/If_/RemoveAlwaysTrueIfConditionRector.php index 2138bea8747..b08b1e200fe 100644 --- a/rules/DeadCode/Rector/If_/RemoveAlwaysTrueIfConditionRector.php +++ b/rules/DeadCode/Rector/If_/RemoveAlwaysTrueIfConditionRector.php @@ -17,8 +17,6 @@ use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Else_; use PhpParser\Node\Stmt\If_; use PhpParser\NodeTraverser; -use PHPStan\Type\ArrayType; -use PHPStan\Type\Constant\ConstantBooleanType; use PHPStan\Type\IntersectionType; use Rector\DeadCode\NodeAnalyzer\SafeLeftTypeBooleanAndOrAnalyzer; use Rector\NodeAnalyzer\ExprAnalyzer; @@ -104,10 +102,7 @@ CODE_SAMPLE return null; } $conditionStaticType = $this->getType($node->cond); - if (!$conditionStaticType instanceof ConstantBooleanType) { - return null; - } - if (!$conditionStaticType->getValue()) { + if (!$conditionStaticType->isTrue()->yes()) { return null; } if ($this->shouldSkipExpr($node->cond)) { @@ -136,7 +131,7 @@ CODE_SAMPLE $type = $this->getType($variable); if ($type instanceof IntersectionType) { foreach ($type->getTypes() as $subType) { - if ($subType instanceof ArrayType) { + if ($subType->isArray()->yes()) { return \true; } } @@ -155,10 +150,7 @@ CODE_SAMPLE } $booleanAnd = $if->cond; $leftType = $this->getType($booleanAnd->left); - if (!$leftType instanceof ConstantBooleanType) { - return null; - } - if (!$leftType->getValue()) { + if (!$leftType->isTrue()->yes()) { return null; } if (!$this->safeLeftTypeBooleanAndOrAnalyzer->isSafe($booleanAnd)) { diff --git a/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php b/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php index 77587601ba4..ee77f74d991 100644 --- a/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php +++ b/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php @@ -20,7 +20,6 @@ use PhpParser\Node\Stmt\Switch_; use PhpParser\Node\Stmt\While_; use PhpParser\NodeTraverser; use PHPStan\Type\Constant\ConstantIntegerType; -use PHPStan\Type\ConstantType; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\PhpParser\Node\Value\ValueResolver; use Rector\Rector\AbstractRector; @@ -143,7 +142,7 @@ CODE_SAMPLE private function processVariableNum(Continue_ $continue, Variable $numVariable) { $staticType = $this->getType($numVariable); - if (!$staticType instanceof ConstantType) { + if (!$staticType->isConstantValue()->yes()) { return $continue; } if (!$staticType instanceof ConstantIntegerType) { diff --git a/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php b/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php index 93467812362..616e06063d3 100644 --- a/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php +++ b/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php @@ -10,7 +10,6 @@ use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt\Break_; use PhpParser\Node\Stmt\Continue_; use PHPStan\Type\Constant\ConstantIntegerType; -use PHPStan\Type\ConstantType; use Rector\PhpParser\Node\Value\ValueResolver; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; @@ -106,7 +105,7 @@ CODE_SAMPLE private function processVariableNum($stmt, Variable $numVariable) : ?Node { $staticType = $this->getType($numVariable); - if ($staticType instanceof ConstantType) { + if ($staticType->isConstantValue()->yes()) { if ($staticType instanceof ConstantIntegerType) { if ($staticType->getValue() === 0) { $stmt->num = null; diff --git a/rules/Php72/Rector/FuncCall/GetClassOnNullRector.php b/rules/Php72/Rector/FuncCall/GetClassOnNullRector.php index c1cd45aa49b..56e956be84b 100644 --- a/rules/Php72/Rector/FuncCall/GetClassOnNullRector.php +++ b/rules/Php72/Rector/FuncCall/GetClassOnNullRector.php @@ -11,7 +11,6 @@ use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Stmt\Class_; use PhpParser\NodeTraverser; use PHPStan\Analyser\Scope; -use PHPStan\Type\NullType; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Rector\AbstractScopeAwareRector; use Rector\ValueObject\PhpVersionFeature; @@ -87,7 +86,7 @@ CODE_SAMPLE } $firstArgValue = $firstArg->value; $firstArgType = $this->getType($firstArgValue); - if (!$this->nodeTypeResolver->isNullableType($firstArgValue) && !$firstArgType instanceof NullType) { + if (!$this->nodeTypeResolver->isNullableType($firstArgValue) && !$firstArgType->isNull()->yes()) { return null; } $notIdentical = new NotIdentical($firstArgValue, $this->nodeFactory->createNull()); diff --git a/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php b/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php index 93ef873e63e..2e035193a1e 100644 --- a/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php +++ b/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php @@ -21,7 +21,6 @@ use PHPStan\Reflection\Native\NativeParameterWithPhpDocsReflection; use PHPStan\Reflection\ParametersAcceptor; use PHPStan\Type\ErrorType; use PHPStan\Type\MixedType; -use PHPStan\Type\NullType; use PHPStan\Type\Type; use PHPStan\Type\UnionType; use Rector\NodeAnalyzer\ArgsAnalyzer; @@ -222,7 +221,7 @@ CODE_SAMPLE } private function shouldSkipType(Type $type) : bool { - return !$type instanceof MixedType && !$type instanceof NullType && !$this->isValidUnionType($type); + return !$type instanceof MixedType && !$type->isNull()->yes() && !$this->isValidUnionType($type); } private function shouldSkipTrait(Expr $expr, Type $type, bool $isTrait) : bool { diff --git a/rules/Strict/NodeFactory/ExactCompareFactory.php b/rules/Strict/NodeFactory/ExactCompareFactory.php index d386ad69148..e059d4266a0 100644 --- a/rules/Strict/NodeFactory/ExactCompareFactory.php +++ b/rules/Strict/NodeFactory/ExactCompareFactory.php @@ -20,7 +20,6 @@ use PhpParser\Node\Name; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; -use PHPStan\Type\NullType; use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; use PHPStan\Type\TypeWithClassName; @@ -54,7 +53,7 @@ final class ExactCompareFactory return new Identical($expr, $this->nodeFactory->createFalse()); } elseif ($exprType->isArray()->yes()) { return new Identical($expr, new Array_([])); - } elseif ($exprType instanceof NullType) { + } elseif ($exprType->isNull()->yes()) { return new Identical($expr, $this->nodeFactory->createNull()); } elseif (!$exprType instanceof UnionType) { return null; diff --git a/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php b/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php index 69d2eb70247..2bd8106828b 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php +++ b/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php @@ -9,7 +9,6 @@ use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Identifier; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\MixedType; -use PHPStan\Type\NullType; use PHPStan\Type\ObjectType; use PHPStan\Type\ThisType; use PHPStan\Type\Type; @@ -107,7 +106,7 @@ final class CallTypesResolver if (\count($staticTypeByArgumentPosition) !== 1) { return $staticTypeByArgumentPosition; } - if (!$staticTypeByArgumentPosition[0] instanceof NullType) { + if (!$staticTypeByArgumentPosition[0]->isNull()->yes()) { return $staticTypeByArgumentPosition; } return [new MixedType()]; diff --git a/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php b/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php index 11b5fc488ac..86a74f9ea8a 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php +++ b/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php @@ -21,7 +21,6 @@ use PhpParser\Node\UnionType; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; use PHPStan\Type\MixedType; -use PHPStan\Type\NullType; use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeTypeResolver\TypeComparator\TypeComparator; use Rector\PhpParser\AstResolver; @@ -82,7 +81,7 @@ final class CallerParamMatcher if ($this->typeComparator->isSubtype($defaultType, $callParamType)) { return $callParam->type; } - if (!$defaultType instanceof NullType) { + if (!$defaultType->isNull()->yes()) { return null; } if ($callParam->type instanceof Name || $callParam->type instanceof Identifier) { diff --git a/rules/TypeDeclaration/NodeAnalyzer/ClassMethodParamTypeCompleter.php b/rules/TypeDeclaration/NodeAnalyzer/ClassMethodParamTypeCompleter.php index 36f381016e9..87429855d47 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/ClassMethodParamTypeCompleter.php +++ b/rules/TypeDeclaration/NodeAnalyzer/ClassMethodParamTypeCompleter.php @@ -8,7 +8,6 @@ use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\Param; use PhpParser\Node\Stmt\ClassMethod; -use PHPStan\Type\CallableType; use PHPStan\Type\MixedType; use PHPStan\Type\ObjectType; use PHPStan\Type\Type; @@ -106,10 +105,10 @@ final class ClassMethodParamTypeCompleter } private function isClosureAndCallableType(Type $parameterStaticType, Type $argumentStaticType) : bool { - if ($parameterStaticType instanceof CallableType && $this->isClosureObjectType($argumentStaticType)) { + if ($parameterStaticType->isCallable()->yes() && $this->isClosureObjectType($argumentStaticType)) { return \true; } - return $argumentStaticType instanceof CallableType && $this->isClosureObjectType($parameterStaticType); + return $argumentStaticType->isCallable()->yes() && $this->isClosureObjectType($parameterStaticType); } private function isClosureObjectType(Type $type) : bool { diff --git a/rules/TypeDeclaration/PhpDocParser/TypeExpressionFromVarTagResolver.php b/rules/TypeDeclaration/PhpDocParser/TypeExpressionFromVarTagResolver.php index b43d86f44dd..f221a3c4a01 100644 --- a/rules/TypeDeclaration/PhpDocParser/TypeExpressionFromVarTagResolver.php +++ b/rules/TypeDeclaration/PhpDocParser/TypeExpressionFromVarTagResolver.php @@ -24,7 +24,6 @@ use PHPStan\Type\FloatType; use PHPStan\Type\IntegerType; use PHPStan\Type\IterableType; use PHPStan\Type\MixedType; -use PHPStan\Type\NullType; use PHPStan\Type\ObjectWithoutClassType; use PHPStan\Type\StringType; use Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareIntersectionTypeNode; @@ -50,7 +49,7 @@ final class TypeExpressionFromVarTagResolver $arg = new Arg($variable); return new FuncCall(new Name($scalarTypeFunction), [$arg]); } - if ($scalarType instanceof NullType) { + if ($scalarType->isNull()->yes()) { return new Identical($variable, new ConstFetch(new Name('null'))); } if ($scalarType instanceof ConstantBooleanType) { diff --git a/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector.php b/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector.php index b6ad26ef78b..3710ecd9838 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector.php @@ -28,7 +28,6 @@ use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ReflectionProvider; -use PHPStan\Type\BooleanType; use Rector\PhpParser\Node\BetterNodeFinder; use Rector\PhpParser\Node\Value\ValueResolver; use Rector\Rector\AbstractScopeAwareRector; @@ -177,9 +176,11 @@ CODE_SAMPLE return \false; } foreach ($functionReflection->getVariants() as $parametersAcceptorWithPhpDoc) { - return $parametersAcceptorWithPhpDoc->getNativeReturnType() instanceof BooleanType; + if (!$parametersAcceptorWithPhpDoc->getNativeReturnType()->isBoolean()->yes()) { + return \false; + } } - return \false; + return \true; } private function isBooleanOp(Expr $expr) : bool { diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php index d795a171225..546d4855333 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php @@ -15,7 +15,6 @@ use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; use PhpParser\Node\UnionType as PhpParserUnionType; use PHPStan\Analyser\Scope; -use PHPStan\Type\NullType; use PHPStan\Type\ObjectType; use PHPStan\Type\UnionType; use Rector\Php\PhpVersionProvider; @@ -194,7 +193,7 @@ CODE_SAMPLE private function processSingleUnionType($node, UnionType $unionType, NullableType $nullableType) { $types = $unionType->getTypes(); - $returnType = $types[0] instanceof ObjectType && $types[1] instanceof NullType ? new NullableType(new FullyQualified($types[0]->getClassName())) : $nullableType; + $returnType = $types[0] instanceof ObjectType && $types[1]->isNull()->yes() ? new NullableType(new FullyQualified($types[0]->getClassName())) : $nullableType; $node->returnType = $returnType; return $node; } diff --git a/rules/TypeDeclaration/TypeAnalyzer/PropertyTypeDefaultValueAnalyzer.php b/rules/TypeDeclaration/TypeAnalyzer/PropertyTypeDefaultValueAnalyzer.php index 861fea028f1..86bddc0b5a0 100644 --- a/rules/TypeDeclaration/TypeAnalyzer/PropertyTypeDefaultValueAnalyzer.php +++ b/rules/TypeDeclaration/TypeAnalyzer/PropertyTypeDefaultValueAnalyzer.php @@ -5,7 +5,6 @@ namespace Rector\TypeDeclaration\TypeAnalyzer; use PhpParser\Node\Expr; use PhpParser\Node\Stmt\PropertyProperty; -use PHPStan\Type\ArrayType; use PHPStan\Type\Type; use Rector\StaticTypeMapper\StaticTypeMapper; final class PropertyTypeDefaultValueAnalyzer @@ -26,7 +25,7 @@ final class PropertyTypeDefaultValueAnalyzer } // the defaults can be in conflict $defaultType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($propertyProperty->default); - if ($defaultType instanceof ArrayType && $propertyType instanceof ArrayType) { + if ($defaultType->isArray()->yes() && $propertyType->isArray()->yes()) { return \false; } // type is not matching, skip it diff --git a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/TrustedClassMethodPropertyTypeInferer.php b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/TrustedClassMethodPropertyTypeInferer.php index 3580addf43f..670508a441d 100644 --- a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/TrustedClassMethodPropertyTypeInferer.php +++ b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/TrustedClassMethodPropertyTypeInferer.php @@ -195,7 +195,7 @@ final class TrustedClassMethodPropertyTypeInferer } if ($param->default instanceof Expr) { $defaultValueStaticType = $this->nodeTypeResolver->getType($param->default); - if ($defaultValueStaticType instanceof NullType) { + if ($defaultValueStaticType->isNull()->yes()) { return \true; } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index b0a2b8d3d63..14e49d85cfb 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '29e89320f0b5c81e2130320ac55f0821daaf4e14'; + public const PACKAGE_VERSION = '3949fc260b51c4355f86d21a26db7d2e4cae0b49'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-11-10 00:33:41'; + public const RELEASE_DATE = '2024-11-12 07:18:02'; /** * @var int */ diff --git a/src/NodeAnalyzer/PropertyAnalyzer.php b/src/NodeAnalyzer/PropertyAnalyzer.php index 92b9a322406..2885a85a1e6 100644 --- a/src/NodeAnalyzer/PropertyAnalyzer.php +++ b/src/NodeAnalyzer/PropertyAnalyzer.php @@ -4,8 +4,6 @@ declare (strict_types=1); namespace Rector\NodeAnalyzer; use PhpParser\Node\Stmt\Property; -use PHPStan\Type\CallableType; -use PHPStan\Type\NullType; use PHPStan\Type\Type; use PHPStan\Type\TypeWithClassName; use PHPStan\Type\UnionType; @@ -25,7 +23,7 @@ final class PropertyAnalyzer public function hasForbiddenType(Property $property) : bool { $propertyType = $this->nodeTypeResolver->getType($property); - if ($propertyType instanceof NullType) { + if ($propertyType->isNull()->yes()) { return \true; } if ($this->isForbiddenType($propertyType)) { @@ -54,6 +52,6 @@ final class PropertyAnalyzer if ($type instanceof TypeWithClassName && $type->getClassName() === 'Closure') { return \false; } - return $type instanceof CallableType; + return $type->isCallable()->yes(); } } diff --git a/src/NodeTypeResolver/NodeTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver.php index 5f8fcae3fc7..5b7daa4e907 100644 --- a/src/NodeTypeResolver/NodeTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver.php @@ -381,7 +381,7 @@ final class NodeTypeResolver } private function isUnionTypeable(Type $first, Type $second) : bool { - return !$first instanceof UnionType && !$second instanceof UnionType && !$second instanceof NullType; + return !$first instanceof UnionType && !$second instanceof UnionType && !$second->isNull()->yes(); } private function isMatchingUnionType(Type $resolvedType, ObjectType $requiredObjectType) : bool { diff --git a/src/NodeTypeResolver/PHPStan/Type/StaticTypeAnalyzer.php b/src/NodeTypeResolver/PHPStan/Type/StaticTypeAnalyzer.php index b94e8619479..e91936e2b6c 100644 --- a/src/NodeTypeResolver/PHPStan/Type/StaticTypeAnalyzer.php +++ b/src/NodeTypeResolver/PHPStan/Type/StaticTypeAnalyzer.php @@ -7,7 +7,6 @@ use PHPStan\Type\ArrayType; use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\ConstantScalarType; use PHPStan\Type\MixedType; -use PHPStan\Type\NullType; use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use PHPStan\Type\UnionType; @@ -41,7 +40,7 @@ final class StaticTypeAnalyzer if ($type instanceof ObjectType) { return \true; } - if ($type instanceof ConstantScalarType && !$type instanceof NullType) { + if ($type instanceof ConstantScalarType && !$type->isNull()->yes()) { return (bool) $type->getValue(); } if ($type->isScalar()->yes()) { diff --git a/src/NodeTypeResolver/PHPStan/Type/TypeFactory.php b/src/NodeTypeResolver/PHPStan/Type/TypeFactory.php index b2137b85382..225709d151d 100644 --- a/src/NodeTypeResolver/PHPStan/Type/TypeFactory.php +++ b/src/NodeTypeResolver/PHPStan/Type/TypeFactory.php @@ -6,7 +6,6 @@ namespace Rector\NodeTypeResolver\PHPStan\Type; use PHPStan\Type\ArrayType; use PHPStan\Type\BooleanType; use PHPStan\Type\Constant\ConstantArrayType; -use PHPStan\Type\Constant\ConstantBooleanType; use PHPStan\Type\Constant\ConstantFloatType; use PHPStan\Type\Constant\ConstantIntegerType; use PHPStan\Type\Constant\ConstantStringType; @@ -93,15 +92,13 @@ final class TypeFactory } private function normalizeBooleanType(bool &$hasFalse, bool &$hasTrue, Type $type) : Type { - if ($type instanceof ConstantBooleanType) { - if ($type->getValue()) { - $hasTrue = \true; - } - if ($type->getValue() === \false) { - $hasFalse = \true; - } + if ($type->isTrue()->yes()) { + $hasTrue = \true; } - if ($hasFalse && $hasTrue && $type instanceof ConstantBooleanType) { + if ($type->isFalse()->yes()) { + $hasFalse = \true; + } + if ($hasFalse && $hasTrue && ($type->isTrue()->yes() || $type->isFalse()->yes())) { return new BooleanType(); } return $type; @@ -160,7 +157,7 @@ final class TypeFactory if ($type instanceof ConstantIntegerType) { return new IntegerType(); } - if ($type instanceof ConstantBooleanType) { + if ($type->isTrue()->yes() || $type->isFalse()->yes()) { return new BooleanType(); } return $type; diff --git a/src/NodeTypeResolver/TypeComparator/ScalarTypeComparator.php b/src/NodeTypeResolver/TypeComparator/ScalarTypeComparator.php index a7210e0092e..604df690a0f 100644 --- a/src/NodeTypeResolver/TypeComparator/ScalarTypeComparator.php +++ b/src/NodeTypeResolver/TypeComparator/ScalarTypeComparator.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\NodeTypeResolver\TypeComparator; -use PHPStan\Type\ClassStringType; use PHPStan\Type\Type; /** * @see \Rector\Tests\NodeTypeResolver\TypeComparator\ScalarTypeComparatorTest @@ -53,7 +52,7 @@ final class ScalarTypeComparator if (!$firstType->isString()->yes()) { return \get_class($firstType) !== \get_class($secondType); } - if (!$secondType instanceof ClassStringType) { + if (!$secondType->isClassStringType()->yes()) { return \get_class($firstType) !== \get_class($secondType); } return \false; diff --git a/src/NodeTypeResolver/TypeComparator/TypeComparator.php b/src/NodeTypeResolver/TypeComparator/TypeComparator.php index 5a5a4a6e08c..0d77bd010e5 100644 --- a/src/NodeTypeResolver/TypeComparator/TypeComparator.php +++ b/src/NodeTypeResolver/TypeComparator/TypeComparator.php @@ -8,7 +8,6 @@ use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Reflection\ClassReflection; use PHPStan\Type\ArrayType; use PHPStan\Type\BooleanType; -use PHPStan\Type\Constant\ConstantBooleanType; use PHPStan\Type\ConstantScalarType; use PHPStan\Type\Generic\TemplateType; use PHPStan\Type\MixedType; @@ -174,7 +173,7 @@ final class TypeComparator private function normalizeConstantBooleanType(Type $type) : Type { return TypeTraverser::map($type, static function (Type $type, callable $callable) : Type { - if ($type instanceof ConstantBooleanType) { + if ($type->isTrue()->yes() || $type->isFalse()->yes()) { return new BooleanType(); } return $callable($type); diff --git a/src/PHPStanStaticTypeMapper/DoctrineTypeAnalyzer.php b/src/PHPStanStaticTypeMapper/DoctrineTypeAnalyzer.php index 410a0d1cfd6..7bfea910c4f 100644 --- a/src/PHPStanStaticTypeMapper/DoctrineTypeAnalyzer.php +++ b/src/PHPStanStaticTypeMapper/DoctrineTypeAnalyzer.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper; -use PHPStan\Type\ArrayType; use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use PHPStan\Type\UnionType; @@ -14,20 +13,20 @@ final class DoctrineTypeAnalyzer if (!$type instanceof UnionType) { return \false; } - $arrayType = null; + $isArrayType = \false; $hasDoctrineCollectionType = \false; foreach ($type->getTypes() as $unionedType) { if ($this->isInstanceOfCollectionType($unionedType)) { $hasDoctrineCollectionType = \true; } - if ($unionedType instanceof ArrayType) { - $arrayType = $unionedType; + if ($unionedType->isArray()->yes()) { + $isArrayType = \true; } } if (!$hasDoctrineCollectionType) { return \false; } - return $arrayType instanceof ArrayType; + return $isArrayType; } public function isInstanceOfCollectionType(Type $type) : bool { diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php index 03ff5836977..a872ace4650 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php @@ -176,7 +176,7 @@ final class ArrayTypeMapper implements TypeMapperInterface if (!$arrayType->getKeyType()->isInteger()->yes()) { return \false; } - return !$arrayType->getItemType() instanceof ArrayType; + return !$arrayType->getItemType()->isArray()->yes(); } private function isClassStringArrayType(ArrayType $arrayType) : bool { diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/BooleanTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/BooleanTypeMapper.php index 14662ace74b..ee390bedb9c 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/BooleanTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/BooleanTypeMapper.php @@ -7,7 +7,6 @@ use PhpParser\Node; use PhpParser\Node\Identifier; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\BooleanType; -use PHPStan\Type\Constant\ConstantBooleanType; use PHPStan\Type\Type; use Rector\Php\PhpVersionProvider; use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface; @@ -49,11 +48,17 @@ final class BooleanTypeMapper implements TypeMapperInterface if ($typeKind === TypeKind::PROPERTY) { return new Identifier('bool'); } - if ($typeKind === TypeKind::UNION && $type instanceof ConstantBooleanType && $type->getValue() === \false) { + if ($typeKind === TypeKind::UNION && $type->isFalse()->yes()) { return new Identifier('false'); } - if ($this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::NULL_FALSE_TRUE_STANDALONE_TYPE) && $type instanceof ConstantBooleanType) { - return $type->getValue() ? new Identifier('true') : new Identifier('false'); + if (!$this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::NULL_FALSE_TRUE_STANDALONE_TYPE)) { + return new Identifier('bool'); + } + if ($type->isTrue()->yes()) { + return new Identifier('true'); + } + if ($type->isFalse()->yes()) { + return new Identifier('false'); } return new Identifier('bool'); } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php index 83458d09311..8f478b14bfa 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php @@ -12,7 +12,6 @@ use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\NullableType; use PhpParser\Node\UnionType as PhpParserUnionType; use PHPStan\PhpDocParser\Ast\Type\TypeNode; -use PHPStan\Type\CallableType; use PHPStan\Type\Type; use PHPStan\Type\UnionType; use Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode; @@ -164,7 +163,7 @@ final class UnionTypeMapper implements TypeMapperInterface return null; } // special callable type only not allowed on property - if ($typeKind === TypeKind::PROPERTY && $unionedType instanceof CallableType) { + if ($typeKind === TypeKind::PROPERTY && $unionedType->isCallable()->yes()) { return null; } $phpParserUnionedTypes[] = $phpParserNode; diff --git a/src/PHPStanStaticTypeMapper/Utils/TypeUnwrapper.php b/src/PHPStanStaticTypeMapper/Utils/TypeUnwrapper.php index 687576043df..d51073c1555 100644 --- a/src/PHPStanStaticTypeMapper/Utils/TypeUnwrapper.php +++ b/src/PHPStanStaticTypeMapper/Utils/TypeUnwrapper.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper\Utils; -use PHPStan\Type\CallableType; use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; use PHPStan\Type\TypeWithClassName; @@ -23,13 +22,13 @@ final class TypeUnwrapper } return $type; } - public function unwrapFirstCallableTypeFromUnionType(Type $type) : ?Type + public function unwrapFirstCallableTypeFromUnionType(Type $type) : Type { if (!$type instanceof UnionType) { return $type; } foreach ($type->getTypes() as $unionedType) { - if (!$unionedType instanceof CallableType) { + if (!$unionedType->isCallable()->yes()) { continue; } return $unionedType; diff --git a/src/PhpAttribute/NodeFactory/AnnotationToAttributeIntegerValueCaster.php b/src/PhpAttribute/NodeFactory/AnnotationToAttributeIntegerValueCaster.php index 1d6c48fe7ef..b53092e76e0 100644 --- a/src/PhpAttribute/NodeFactory/AnnotationToAttributeIntegerValueCaster.php +++ b/src/PhpAttribute/NodeFactory/AnnotationToAttributeIntegerValueCaster.php @@ -11,7 +11,6 @@ use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ParameterReflection; use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Reflection\ReflectionProvider; -use PHPStan\Type\IntegerType; use PHPStan\Type\Type; use PHPStan\Type\UnionType; use Rector\Php80\ValueObject\AnnotationToAttribute; @@ -71,14 +70,14 @@ final class AnnotationToAttributeIntegerValueCaster } private function containsInteger(Type $type) : bool { - if ($type instanceof IntegerType) { + if ($type->isInteger()->yes()) { return \true; } if (!$type instanceof UnionType) { return \false; } foreach ($type->getTypes() as $unionedType) { - if ($unionedType instanceof IntegerType) { + if ($unionedType->isInteger()->yes()) { return \true; } } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index fdfac0707ed..dc1a90a8329 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -2,4 +2,4 @@ namespace RectorPrefix202411; -return array('root' => array('name' => 'rector/rector-src', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('clue/ndjson-react' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0', 'type' => 'library', 'install_path' => __DIR__ . '/../clue/ndjson-react', 'aliases' => array(), 'dev_requirement' => \false), 'composer/pcre' => array('pretty_version' => '3.3.1', 'version' => '3.3.1.0', 'reference' => '63aaeac21d7e775ff9bc9d45021e1745c97521c4', 'type' => 'library', 'install_path' => __DIR__ . '/./pcre', 'aliases' => array(), 'dev_requirement' => \false), 'composer/semver' => array('pretty_version' => '3.4.3', 'version' => '3.4.3.0', 'reference' => '4313d26ada5e0c4edfbd1dc481a92ff7bff91f12', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'composer/xdebug-handler' => array('pretty_version' => '3.0.5', 'version' => '3.0.5.0', 'reference' => '6c1925561632e83d60a44492e0b344cf48ab85ef', 'type' => 'library', 'install_path' => __DIR__ . '/./xdebug-handler', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/inflector' => array('pretty_version' => '2.0.10', 'version' => '2.0.10.0', 'reference' => '5817d0659c5b50c9b950feb9af7b9668e2c436bc', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/inflector', 'aliases' => array(), 'dev_requirement' => \false), 'evenement/evenement' => array('pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), 'dev_requirement' => \false), 'fidry/cpu-core-counter' => array('pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'reference' => '8520451a140d3f46ac33042715115e290cf5785f', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/cpu-core-counter', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/container' => array('pretty_version' => 'v11.30.0', 'version' => '11.30.0.0', 'reference' => '06dfc614aff58384b28ba5ad191f6a02d6b192cb', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/container', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/contracts' => array('pretty_version' => 'v11.30.0', 'version' => '11.30.0.0', 'reference' => '56312862af937bd6da8e6dc8bbd88188dfb478f8', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), 'dev_requirement' => \false), 'nette/utils' => array('pretty_version' => 'v4.0.5', 'version' => '4.0.5.0', 'reference' => '736c567e257dbe0fcf6ce81b4d6dbe05c6899f96', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/utils', 'aliases' => array(), 'dev_requirement' => \false), 'nikic/php-parser' => array('pretty_version' => 'v4.19.4', 'version' => '4.19.4.0', 'reference' => '715f4d25e225bc47b293a8b997fe6ce99bf987d2', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \false), 'ondram/ci-detector' => array('pretty_version' => '4.2.0', 'version' => '4.2.0.0', 'reference' => '8b0223b5ed235fd377c75fdd1bfcad05c0f168b8', 'type' => 'library', 'install_path' => __DIR__ . '/../ondram/ci-detector', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpdoc-parser' => array('pretty_version' => '1.33.0', 'version' => '1.33.0.0', 'reference' => '82a311fd3690fb2bf7b64d5c98f912b3dd746140', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpstan' => array('dev_requirement' => \false, 'replaced' => array(0 => '1.12.8')), 'psr/container' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.1|2.0')), 'psr/log' => array('pretty_version' => '3.0.2', 'version' => '3.0.2.0', 'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'psr/log-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0|2.0|3.0')), 'psr/simple-cache' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/simple-cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/cache' => array('pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', 'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b', 'type' => 'library', 'install_path' => __DIR__ . '/../react/cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/child-process' => array('pretty_version' => 'v0.6.5', 'version' => '0.6.5.0', 'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43', 'type' => 'library', 'install_path' => __DIR__ . '/../react/child-process', 'aliases' => array(), 'dev_requirement' => \false), 'react/dns' => array('pretty_version' => 'v1.13.0', 'version' => '1.13.0.0', 'reference' => 'eb8ae001b5a455665c89c1df97f6fb682f8fb0f5', 'type' => 'library', 'install_path' => __DIR__ . '/../react/dns', 'aliases' => array(), 'dev_requirement' => \false), 'react/event-loop' => array('pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', 'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354', 'type' => 'library', 'install_path' => __DIR__ . '/../react/event-loop', 'aliases' => array(), 'dev_requirement' => \false), 'react/promise' => array('pretty_version' => 'v3.2.0', 'version' => '3.2.0.0', 'reference' => '8a164643313c71354582dc850b42b33fa12a4b63', 'type' => 'library', 'install_path' => __DIR__ . '/../react/promise', 'aliases' => array(), 'dev_requirement' => \false), 'react/socket' => array('pretty_version' => 'v1.16.0', 'version' => '1.16.0.0', 'reference' => '23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1', 'type' => 'library', 'install_path' => __DIR__ . '/../react/socket', 'aliases' => array(), 'dev_requirement' => \false), 'react/stream' => array('pretty_version' => 'v1.4.0', 'version' => '1.4.0.0', 'reference' => '1e5b0acb8fe55143b5b426817155190eb6f5b18d', 'type' => 'library', 'install_path' => __DIR__ . '/../react/stream', 'aliases' => array(), 'dev_requirement' => \false), 'rector/extension-installer' => array('pretty_version' => '0.11.2', 'version' => '0.11.2.0', 'reference' => '05544e9b195863b8571ae2a3b903cbec7fa062e0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../rector/extension-installer', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector' => array('dev_requirement' => \false, 'replaced' => array(0 => 'dev-main')), 'rector/rector-doctrine' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'e75008c293679e0bb0637bf09cf6dd43ff34526a', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-doctrine', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-downgrade-php' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'd9cef571617b93e642b3ac45981b7092e1a2e89a', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-downgrade-php', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-phpunit' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '1e74358f5fbaf95ab19d4d801f1667b6d6fdbc9d', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-phpunit', 'aliases' => array(0 => '0.11.x-dev'), 'dev_requirement' => \false), 'rector/rector-src' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector-symfony' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '799b454b63c240edc962c8fafea2c5a2a61e5393', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-symfony', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'sebastian/diff' => array('pretty_version' => '5.1.1', 'version' => '5.1.1.0', 'reference' => 'c41e007b4b62af48218231d6c2275e4c9b975b2e', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/console' => array('pretty_version' => 'v6.4.14', 'version' => '6.4.14.0', 'reference' => '897c2441ed4eec8a8a2c37b943427d24dba3f26b', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/filesystem' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => '4856c9cf585d5a0313d8d35afd681a526f038dd3', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/finder' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => 'daea9eca0b08d0ed1dc9ab702a46128fd1be4958', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-ctype' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-intl-grapheme' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-mbstring' => array('pretty_version' => 'v1.31.0', 'version' => '1.31.0.0', 'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/process' => array('pretty_version' => 'v6.4.14', 'version' => '6.4.14.0', 'reference' => '25214adbb0996d18112548de20c281be9f27279f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/service-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => 'bd1d9e59a81d8fa4acdcea3f617c581f7475a80f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/string' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/yaml' => array('pretty_version' => 'v7.1.6', 'version' => '7.1.6.0', 'reference' => '3ced3f29e4f0d6bce2170ff26719f1fe9aacc671', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/easy-parallel' => array('pretty_version' => '11.2.2', 'version' => '11.2.2.0', 'reference' => '8586c18bb8efb31cd192a4e5cc94ae7813f72ed9', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/easy-parallel', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/rule-doc-generator-contracts' => array('pretty_version' => '11.2.0', 'version' => '11.2.0.0', 'reference' => '479cfcfd46047f80624aba931d9789e50475b5c6', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/rule-doc-generator-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'webmozart/assert' => array('pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991', 'type' => 'library', 'install_path' => __DIR__ . '/../webmozart/assert', 'aliases' => array(), 'dev_requirement' => \false))); +return array('root' => array('name' => 'rector/rector-src', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('clue/ndjson-react' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0', 'type' => 'library', 'install_path' => __DIR__ . '/../clue/ndjson-react', 'aliases' => array(), 'dev_requirement' => \false), 'composer/pcre' => array('pretty_version' => '3.3.1', 'version' => '3.3.1.0', 'reference' => '63aaeac21d7e775ff9bc9d45021e1745c97521c4', 'type' => 'library', 'install_path' => __DIR__ . '/./pcre', 'aliases' => array(), 'dev_requirement' => \false), 'composer/semver' => array('pretty_version' => '3.4.3', 'version' => '3.4.3.0', 'reference' => '4313d26ada5e0c4edfbd1dc481a92ff7bff91f12', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'composer/xdebug-handler' => array('pretty_version' => '3.0.5', 'version' => '3.0.5.0', 'reference' => '6c1925561632e83d60a44492e0b344cf48ab85ef', 'type' => 'library', 'install_path' => __DIR__ . '/./xdebug-handler', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/inflector' => array('pretty_version' => '2.0.10', 'version' => '2.0.10.0', 'reference' => '5817d0659c5b50c9b950feb9af7b9668e2c436bc', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/inflector', 'aliases' => array(), 'dev_requirement' => \false), 'evenement/evenement' => array('pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), 'dev_requirement' => \false), 'fidry/cpu-core-counter' => array('pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'reference' => '8520451a140d3f46ac33042715115e290cf5785f', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/cpu-core-counter', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/container' => array('pretty_version' => 'v11.30.0', 'version' => '11.30.0.0', 'reference' => '06dfc614aff58384b28ba5ad191f6a02d6b192cb', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/container', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/contracts' => array('pretty_version' => 'v11.30.0', 'version' => '11.30.0.0', 'reference' => '56312862af937bd6da8e6dc8bbd88188dfb478f8', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), 'dev_requirement' => \false), 'nette/utils' => array('pretty_version' => 'v4.0.5', 'version' => '4.0.5.0', 'reference' => '736c567e257dbe0fcf6ce81b4d6dbe05c6899f96', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/utils', 'aliases' => array(), 'dev_requirement' => \false), 'nikic/php-parser' => array('pretty_version' => 'v4.19.4', 'version' => '4.19.4.0', 'reference' => '715f4d25e225bc47b293a8b997fe6ce99bf987d2', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \false), 'ondram/ci-detector' => array('pretty_version' => '4.2.0', 'version' => '4.2.0.0', 'reference' => '8b0223b5ed235fd377c75fdd1bfcad05c0f168b8', 'type' => 'library', 'install_path' => __DIR__ . '/../ondram/ci-detector', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpdoc-parser' => array('pretty_version' => '1.33.0', 'version' => '1.33.0.0', 'reference' => '82a311fd3690fb2bf7b64d5c98f912b3dd746140', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpstan' => array('dev_requirement' => \false, 'replaced' => array(0 => '1.12.10')), 'psr/container' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.1|2.0')), 'psr/log' => array('pretty_version' => '3.0.2', 'version' => '3.0.2.0', 'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'psr/log-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0|2.0|3.0')), 'psr/simple-cache' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/simple-cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/cache' => array('pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', 'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b', 'type' => 'library', 'install_path' => __DIR__ . '/../react/cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/child-process' => array('pretty_version' => 'v0.6.5', 'version' => '0.6.5.0', 'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43', 'type' => 'library', 'install_path' => __DIR__ . '/../react/child-process', 'aliases' => array(), 'dev_requirement' => \false), 'react/dns' => array('pretty_version' => 'v1.13.0', 'version' => '1.13.0.0', 'reference' => 'eb8ae001b5a455665c89c1df97f6fb682f8fb0f5', 'type' => 'library', 'install_path' => __DIR__ . '/../react/dns', 'aliases' => array(), 'dev_requirement' => \false), 'react/event-loop' => array('pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', 'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354', 'type' => 'library', 'install_path' => __DIR__ . '/../react/event-loop', 'aliases' => array(), 'dev_requirement' => \false), 'react/promise' => array('pretty_version' => 'v3.2.0', 'version' => '3.2.0.0', 'reference' => '8a164643313c71354582dc850b42b33fa12a4b63', 'type' => 'library', 'install_path' => __DIR__ . '/../react/promise', 'aliases' => array(), 'dev_requirement' => \false), 'react/socket' => array('pretty_version' => 'v1.16.0', 'version' => '1.16.0.0', 'reference' => '23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1', 'type' => 'library', 'install_path' => __DIR__ . '/../react/socket', 'aliases' => array(), 'dev_requirement' => \false), 'react/stream' => array('pretty_version' => 'v1.4.0', 'version' => '1.4.0.0', 'reference' => '1e5b0acb8fe55143b5b426817155190eb6f5b18d', 'type' => 'library', 'install_path' => __DIR__ . '/../react/stream', 'aliases' => array(), 'dev_requirement' => \false), 'rector/extension-installer' => array('pretty_version' => '0.11.2', 'version' => '0.11.2.0', 'reference' => '05544e9b195863b8571ae2a3b903cbec7fa062e0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../rector/extension-installer', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector' => array('dev_requirement' => \false, 'replaced' => array(0 => 'dev-main')), 'rector/rector-doctrine' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'e75008c293679e0bb0637bf09cf6dd43ff34526a', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-doctrine', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-downgrade-php' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'd9cef571617b93e642b3ac45981b7092e1a2e89a', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-downgrade-php', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-phpunit' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '1e74358f5fbaf95ab19d4d801f1667b6d6fdbc9d', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-phpunit', 'aliases' => array(0 => '0.11.x-dev'), 'dev_requirement' => \false), 'rector/rector-src' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector-symfony' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '799b454b63c240edc962c8fafea2c5a2a61e5393', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-symfony', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'sebastian/diff' => array('pretty_version' => '5.1.1', 'version' => '5.1.1.0', 'reference' => 'c41e007b4b62af48218231d6c2275e4c9b975b2e', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/console' => array('pretty_version' => 'v6.4.14', 'version' => '6.4.14.0', 'reference' => '897c2441ed4eec8a8a2c37b943427d24dba3f26b', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/filesystem' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => '4856c9cf585d5a0313d8d35afd681a526f038dd3', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/finder' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => 'daea9eca0b08d0ed1dc9ab702a46128fd1be4958', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-ctype' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-intl-grapheme' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-mbstring' => array('pretty_version' => 'v1.31.0', 'version' => '1.31.0.0', 'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/process' => array('pretty_version' => 'v6.4.14', 'version' => '6.4.14.0', 'reference' => '25214adbb0996d18112548de20c281be9f27279f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/service-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => 'bd1d9e59a81d8fa4acdcea3f617c581f7475a80f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/string' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/yaml' => array('pretty_version' => 'v7.1.6', 'version' => '7.1.6.0', 'reference' => '3ced3f29e4f0d6bce2170ff26719f1fe9aacc671', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/easy-parallel' => array('pretty_version' => '11.2.2', 'version' => '11.2.2.0', 'reference' => '8586c18bb8efb31cd192a4e5cc94ae7813f72ed9', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/easy-parallel', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/rule-doc-generator-contracts' => array('pretty_version' => '11.2.0', 'version' => '11.2.0.0', 'reference' => '479cfcfd46047f80624aba931d9789e50475b5c6', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/rule-doc-generator-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'webmozart/assert' => array('pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991', 'type' => 'library', 'install_path' => __DIR__ . '/../webmozart/assert', 'aliases' => array(), 'dev_requirement' => \false)));