Updated Rector to commit dbb0e196a43d8c14a9de6abeef8fe081e95c51c2

dbb0e196a4 Revert all is* changes (#3584)
This commit is contained in:
Tomas Votruba 2023-04-08 13:25:07 +00:00
parent 9d60770133
commit 3da290e4ab
33 changed files with 127 additions and 82 deletions

View File

@ -23,6 +23,8 @@ use PHPStan\Broker\ClassAutoloadingException;
use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ReflectionProvider; use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\Constant\ConstantBooleanType; use PHPStan\Type\Constant\ConstantBooleanType;
use PHPStan\Type\FloatType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\MixedType; use PHPStan\Type\MixedType;
use PHPStan\Type\NullType; use PHPStan\Type\NullType;
use PHPStan\Type\ObjectType; use PHPStan\Type\ObjectType;
@ -240,10 +242,10 @@ final class NodeTypeResolver
public function isNumberType(Expr $expr) : bool public function isNumberType(Expr $expr) : bool
{ {
$nodeType = $this->getType($expr); $nodeType = $this->getType($expr);
if ($nodeType->isInteger()->yes()) { if ($nodeType instanceof IntegerType) {
return \true; return \true;
} }
return $nodeType->isFloat()->yes(); return $nodeType instanceof FloatType;
} }
/** /**
* @api * @api

View File

@ -4,8 +4,11 @@ declare (strict_types=1);
namespace Rector\NodeTypeResolver\PHPStan\Type; namespace Rector\NodeTypeResolver\PHPStan\Type;
use PHPStan\Type\ArrayType; use PHPStan\Type\ArrayType;
use PHPStan\Type\BooleanType;
use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\Constant\ConstantArrayType;
use PHPStan\Type\ConstantScalarType; use PHPStan\Type\ConstantScalarType;
use PHPStan\Type\FloatType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\MixedType; use PHPStan\Type\MixedType;
use PHPStan\Type\NullType; use PHPStan\Type\NullType;
use PHPStan\Type\ObjectType; use PHPStan\Type\ObjectType;
@ -54,16 +57,16 @@ final class StaticTypeAnalyzer
if ($type instanceof NullType) { if ($type instanceof NullType) {
return \true; return \true;
} }
if ($type->isBoolean()->yes()) { if ($type instanceof BooleanType) {
return \true; return \true;
} }
if ($type->isString()->yes()) { if ($type->isString()->yes()) {
return \true; return \true;
} }
if ($type->isInteger()->yes()) { if ($type instanceof IntegerType) {
return \true; return \true;
} }
return $type->isFloat()->yes(); return $type instanceof FloatType;
} }
private function isAlwaysTruableUnionType(Type $type) : bool private function isAlwaysTruableUnionType(Type $type) : bool
{ {

View File

@ -3,7 +3,11 @@
declare (strict_types=1); declare (strict_types=1);
namespace Rector\NodeTypeResolver\TypeComparator; namespace Rector\NodeTypeResolver\TypeComparator;
use PHPStan\Type\BooleanType;
use PHPStan\Type\ClassStringType; use PHPStan\Type\ClassStringType;
use PHPStan\Type\FloatType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\StringType;
use PHPStan\Type\Type; use PHPStan\Type\Type;
/** /**
* @see \Rector\Tests\NodeTypeResolver\TypeComparator\ScalarTypeComparatorTest * @see \Rector\Tests\NodeTypeResolver\TypeComparator\ScalarTypeComparatorTest
@ -12,22 +16,22 @@ final class ScalarTypeComparator
{ {
public function areEqualScalar(Type $firstType, Type $secondType) : bool public function areEqualScalar(Type $firstType, Type $secondType) : bool
{ {
if ($firstType->isString()->yes() && $secondType->isString()->yes()) { if ($firstType instanceof StringType && $secondType instanceof StringType) {
// prevents "class-string" vs "string" // prevents "class-string" vs "string"
$firstTypeClass = \get_class($firstType); $firstTypeClass = \get_class($firstType);
$secondTypeClass = \get_class($secondType); $secondTypeClass = \get_class($secondType);
return $firstTypeClass === $secondTypeClass; return $firstTypeClass === $secondTypeClass;
} }
if ($firstType->isInteger()->yes() && $secondType->isInteger()->yes()) { if ($firstType instanceof IntegerType && $secondType instanceof IntegerType) {
return \true; return \true;
} }
if ($firstType->isFloat()->yes() && $secondType->isFloat()->yes()) { if ($firstType instanceof FloatType && $secondType instanceof FloatType) {
return \true; return \true;
} }
if (!$firstType->isBoolean()->yes()) { if (!$firstType instanceof BooleanType) {
return \false; return \false;
} }
return $secondType->isBoolean()->yes(); return $secondType instanceof BooleanType;
} }
/** /**
* E.g. first is string, second is bool * E.g. first is string, second is bool
@ -41,10 +45,10 @@ final class ScalarTypeComparator
return \false; return \false;
} }
// treat class-string and string the same // treat class-string and string the same
if ($firstType instanceof ClassStringType && $secondType->isString()->yes()) { if ($firstType instanceof ClassStringType && $secondType instanceof StringType) {
return \false; return \false;
} }
if (!$firstType->isString()->yes()) { if (!$firstType instanceof StringType) {
return \get_class($firstType) !== \get_class($secondType); return \get_class($firstType) !== \get_class($secondType);
} }
if (!$secondType instanceof ClassStringType) { if (!$secondType instanceof ClassStringType) {
@ -54,15 +58,15 @@ final class ScalarTypeComparator
} }
private function isScalarType(Type $type) : bool private function isScalarType(Type $type) : bool
{ {
if ($type->isString()->yes()) { if ($type instanceof StringType) {
return \true; return \true;
} }
if ($type->isFloat()->yes()) { if ($type instanceof FloatType) {
return \true; return \true;
} }
if ($type->isInteger()->yes()) { if ($type instanceof IntegerType) {
return \true; return \true;
} }
return $type->isBoolean()->yes(); return $type instanceof BooleanType;
} }
} }

View File

@ -3,6 +3,7 @@
declare (strict_types=1); declare (strict_types=1);
namespace Rector\PHPStanStaticTypeMapper\TypeAnalyzer; namespace Rector\PHPStanStaticTypeMapper\TypeAnalyzer;
use PHPStan\Type\BooleanType;
use PHPStan\Type\NullType; use PHPStan\Type\NullType;
use PHPStan\Type\UnionType; use PHPStan\Type\UnionType;
final class BoolUnionTypeAnalyzer final class BoolUnionTypeAnalyzer
@ -10,7 +11,7 @@ final class BoolUnionTypeAnalyzer
public function isBoolUnionType(UnionType $unionType) : bool public function isBoolUnionType(UnionType $unionType) : bool
{ {
foreach ($unionType->getTypes() as $unionedType) { foreach ($unionType->getTypes() as $unionedType) {
if (!$unionedType->isBoolean()->yes()) { if (!$unionedType instanceof BooleanType) {
return \false; return \false;
} }
} }
@ -24,7 +25,7 @@ final class BoolUnionTypeAnalyzer
$hasNullable = \true; $hasNullable = \true;
continue; continue;
} }
if ($unionedType->isBoolean()->yes()) { if ($unionedType instanceof BooleanType) {
continue; continue;
} }
return \false; return \false;

View File

@ -4,11 +4,15 @@ declare (strict_types=1);
namespace Rector\PHPStanStaticTypeMapper\TypeAnalyzer; namespace Rector\PHPStanStaticTypeMapper\TypeAnalyzer;
use PHPStan\Type\ArrayType; use PHPStan\Type\ArrayType;
use PHPStan\Type\BooleanType;
use PHPStan\Type\Constant\ConstantStringType; use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\FloatType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\IterableType; use PHPStan\Type\IterableType;
use PHPStan\Type\NullType; use PHPStan\Type\NullType;
use PHPStan\Type\ObjectType; use PHPStan\Type\ObjectType;
use PHPStan\Type\ObjectWithoutClassType; use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\StringType;
use PHPStan\Type\TypeWithClassName; use PHPStan\Type\TypeWithClassName;
use PHPStan\Type\UnionType; use PHPStan\Type\UnionType;
use Rector\PHPStanStaticTypeMapper\ValueObject\UnionTypeAnalysis; use Rector\PHPStanStaticTypeMapper\ValueObject\UnionTypeAnalysis;
@ -86,16 +90,16 @@ final class UnionTypeAnalyzer
return \false; return \false;
} }
foreach ($types as $type) { foreach ($types as $type) {
if ($type->isString()->yes() && !$type instanceof ConstantStringType) { if ($type instanceof StringType && !$type instanceof ConstantStringType) {
continue; continue;
} }
if ($type->isFloat()->yes()) { if ($type instanceof FloatType) {
continue; continue;
} }
if ($type->isInteger()->yes()) { if ($type instanceof IntegerType) {
continue; continue;
} }
if ($type->isBoolean()->yes()) { if ($type instanceof BooleanType) {
continue; continue;
} }
return \false; return \false;

View File

@ -14,6 +14,7 @@ use PHPStan\Type\ClassStringType;
use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\Constant\ConstantArrayType;
use PHPStan\Type\Constant\ConstantIntegerType; use PHPStan\Type\Constant\ConstantIntegerType;
use PHPStan\Type\Generic\GenericClassStringType; use PHPStan\Type\Generic\GenericClassStringType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\MixedType; use PHPStan\Type\MixedType;
use PHPStan\Type\NeverType; use PHPStan\Type\NeverType;
use PHPStan\Type\ObjectType; use PHPStan\Type\ObjectType;
@ -208,7 +209,7 @@ final class ArrayTypeMapper implements TypeMapperInterface
} }
private function isIntegerKeyAndNonNestedArray(ArrayType $arrayType) : bool private function isIntegerKeyAndNonNestedArray(ArrayType $arrayType) : bool
{ {
if (!$arrayType->getKeyType()->isInteger()->yes()) { if (!$arrayType->getKeyType() instanceof IntegerType) {
return \false; return \false;
} }
return !$arrayType->getItemType() instanceof ArrayType; return !$arrayType->getItemType() instanceof ArrayType;

View File

@ -204,7 +204,7 @@ final class UnionTypeMapper implements TypeMapperInterface
private function mapNullabledType(Type $nullabledType, string $typeKind) : ?Node private function mapNullabledType(Type $nullabledType, string $typeKind) : ?Node
{ {
// void cannot be nullable // void cannot be nullable
if ($nullabledType->isVoid()->yes()) { if ($nullabledType instanceof VoidType) {
return null; return null;
} }
$nullabledTypeNode = $this->phpStanStaticTypeMapper->mapToPhpParserNode($nullabledType, $typeKind); $nullabledTypeNode = $this->phpStanStaticTypeMapper->mapToPhpParserNode($nullabledType, $typeKind);

View File

@ -10,6 +10,8 @@ use PhpParser\Node\Scalar\String_;
use PHPStan\Reflection\ParameterReflection; use PHPStan\Reflection\ParameterReflection;
use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Reflection\ReflectionProvider; use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\BooleanType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\TypeCombinator; use PHPStan\Type\TypeCombinator;
use Rector\Core\PhpParser\Node\NodeFactory; use Rector\Core\PhpParser\Node\NodeFactory;
use Rector\StaticTypeMapper\StaticTypeMapper; use Rector\StaticTypeMapper\StaticTypeMapper;
@ -87,10 +89,10 @@ final class ExprParameterReflectionTypeCorrector
} }
$clearParameterType = TypeCombinator::removeNull($parameterType); $clearParameterType = TypeCombinator::removeNull($parameterType);
// correct type // correct type
if ($clearParameterType->isInteger()->yes() && $item instanceof String_) { if ($clearParameterType instanceof IntegerType && $item instanceof String_) {
return new LNumber((int) $item->value); return new LNumber((int) $item->value);
} }
if ($clearParameterType->isBoolean()->yes() && $item instanceof String_) { if ($clearParameterType instanceof BooleanType && $item instanceof String_) {
if (\strtolower($item->value) === 'true') { if (\strtolower($item->value) === 'true') {
return $this->nodeFactory->createTrue(); return $this->nodeFactory->createTrue();
} }

View File

@ -13,6 +13,7 @@ use PHPStan\Reflection\FunctionVariantWithPhpDocs;
use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\ReflectionProvider; use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\MixedType; use PHPStan\Type\MixedType;
use PHPStan\Type\VoidType;
use Rector\Core\FileSystem\FilePathHelper; use Rector\Core\FileSystem\FilePathHelper;
use Rector\Core\PhpParser\AstResolver; use Rector\Core\PhpParser\AstResolver;
use Rector\Core\PhpParser\Node\BetterNodeFinder; use Rector\Core\PhpParser\Node\BetterNodeFinder;
@ -185,7 +186,7 @@ final class ClassMethodReturnTypeOverrideGuard
return \true; return \true;
} }
$childReturnType = $this->returnTypeInferer->inferFunctionLike($method); $childReturnType = $this->returnTypeInferer->inferFunctionLike($method);
if ($returnType->isVoid()->yes() && !$childReturnType->isVoid()->yes()) { if ($returnType instanceof VoidType && !$childReturnType instanceof VoidType) {
return \true; return \true;
} }
} }

View File

@ -8,6 +8,7 @@ use PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\BinaryOp\NotIdentical;
use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\Cast\Bool_; use PhpParser\Node\Expr\Cast\Bool_;
use PHPStan\Type\BooleanType;
use PHPStan\Type\UnionType; use PHPStan\Type\UnionType;
use Rector\Core\PhpParser\Node\NodeFactory; use Rector\Core\PhpParser\Node\NodeFactory;
use Rector\NodeTypeResolver\NodeTypeResolver; use Rector\NodeTypeResolver\NodeTypeResolver;
@ -71,7 +72,7 @@ final class ExprBoolCaster
return \false; return \false;
} }
$exprType = $this->nodeTypeResolver->getType($expr); $exprType = $this->nodeTypeResolver->getType($expr);
if ($exprType->isBoolean()->yes()) { if ($exprType instanceof BooleanType) {
return \false; return \false;
} }
return !$expr instanceof BinaryOp; return !$expr instanceof BinaryOp;

View File

@ -11,6 +11,7 @@ use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\If_;
use PHPStan\Type\BooleanType;
use Rector\Core\NodeManipulator\BinaryOpManipulator; use Rector\Core\NodeManipulator\BinaryOpManipulator;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@ -84,7 +85,7 @@ CODE_SAMPLE
/** @var BooleanAnd|BooleanOr $booleanExpr */ /** @var BooleanAnd|BooleanOr $booleanExpr */
$booleanExpr = $expression->expr; $booleanExpr = $expression->expr;
$leftStaticType = $this->getType($booleanExpr->left); $leftStaticType = $this->getType($booleanExpr->left);
if (!$leftStaticType->isBoolean()->yes()) { if (!$leftStaticType instanceof BooleanType) {
return null; return null;
} }
$exprLeft = $booleanExpr->left instanceof BooleanNot ? $booleanExpr->left->expr : $booleanExpr->left; $exprLeft = $booleanExpr->left instanceof BooleanNot ? $booleanExpr->left->expr : $booleanExpr->left;

View File

@ -7,6 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Expr\BinaryOp\Identical; use PhpParser\Node\Expr\BinaryOp\Identical;
use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\BinaryOp\NotIdentical;
use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\BooleanNot;
use PHPStan\Type\BooleanType;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -66,11 +67,11 @@ CODE_SAMPLE
if ($node->expr instanceof Identical) { if ($node->expr instanceof Identical) {
$identical = $node->expr; $identical = $node->expr;
$leftType = $this->getType($identical->left); $leftType = $this->getType($identical->left);
if (!$leftType->isBoolean()->yes()) { if (!$leftType instanceof BooleanType) {
return null; return null;
} }
$rightType = $this->getType($identical->right); $rightType = $this->getType($identical->right);
if (!$rightType->isBoolean()->yes()) { if (!$rightType instanceof BooleanType) {
return null; return null;
} }
return new NotIdentical($identical->left, $identical->right); return new NotIdentical($identical->left, $identical->right);
@ -80,11 +81,11 @@ CODE_SAMPLE
private function processIdentical(Identical $identical) : ?NotIdentical private function processIdentical(Identical $identical) : ?NotIdentical
{ {
$leftType = $this->getType($identical->left); $leftType = $this->getType($identical->left);
if (!$leftType->isBoolean()->yes()) { if (!$leftType instanceof BooleanType) {
return null; return null;
} }
$rightType = $this->getType($identical->right); $rightType = $this->getType($identical->right);
if (!$rightType->isBoolean()->yes()) { if (!$rightType instanceof BooleanType) {
return null; return null;
} }
if ($identical->left instanceof BooleanNot) { if ($identical->left instanceof BooleanNot) {

View File

@ -9,6 +9,7 @@ use PhpParser\Node\Expr\BinaryOp\Identical;
use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\BinaryOp\NotIdentical;
use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\Variable; use PhpParser\Node\Expr\Variable;
use PHPStan\Type\BooleanType;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -54,11 +55,11 @@ CODE_SAMPLE
public function refactor(Node $node) : ?Node public function refactor(Node $node) : ?Node
{ {
$leftType = $this->getType($node->left); $leftType = $this->getType($node->left);
if ($leftType->isBoolean()->yes() && !$this->valueResolver->isTrueOrFalse($node->left)) { if ($leftType instanceof BooleanType && !$this->valueResolver->isTrueOrFalse($node->left)) {
return $this->processBoolTypeToNotBool($node, $node->left, $node->right); return $this->processBoolTypeToNotBool($node, $node->left, $node->right);
} }
$rightType = $this->getType($node->right); $rightType = $this->getType($node->right);
if (!$rightType->isBoolean()->yes()) { if (!$rightType instanceof BooleanType) {
return null; return null;
} }
if ($this->valueResolver->isTrueOrFalse($node->right)) { if ($this->valueResolver->isTrueOrFalse($node->right)) {
@ -88,7 +89,7 @@ CODE_SAMPLE
} }
$leftExprType = $this->getType($leftExpr); $leftExprType = $this->getType($leftExpr);
// keep as it is, readable enough // keep as it is, readable enough
if ($leftExpr instanceof Variable && $leftExprType->isBoolean()->yes()) { if ($leftExpr instanceof Variable && $leftExprType instanceof BooleanType) {
return null; return null;
} }
return new BooleanNot($leftExpr); return new BooleanNot($leftExpr);

View File

@ -22,6 +22,9 @@ use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Scalar\String_; use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\ElseIf_; use PhpParser\Node\Stmt\ElseIf_;
use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\If_;
use PHPStan\Type\BooleanType;
use PHPStan\Type\FloatType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\ObjectType; use PHPStan\Type\ObjectType;
use PHPStan\Type\Type; use PHPStan\Type\Type;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
@ -106,7 +109,7 @@ CODE_SAMPLE
return null; return null;
} }
$conditionStaticType = $this->getType($conditionNode); $conditionStaticType = $this->getType($conditionNode);
if ($conditionStaticType->isBoolean()->yes()) { if ($conditionStaticType instanceof BooleanType) {
return null; return null;
} }
$binaryOp = $this->resolveNewConditionNode($conditionNode, $isNegated); $binaryOp = $this->resolveNewConditionNode($conditionNode, $isNegated);
@ -143,10 +146,10 @@ CODE_SAMPLE
return $this->resolveString($isNegated, $expr); return $this->resolveString($isNegated, $expr);
} }
$exprType = $this->getType($expr); $exprType = $this->getType($expr);
if ($exprType->isInteger()->yes()) { if ($exprType instanceof IntegerType) {
return $this->resolveInteger($isNegated, $expr); return $this->resolveInteger($isNegated, $expr);
} }
if ($exprType->isFloat()->yes()) { if ($exprType instanceof FloatType) {
return $this->resolveFloat($isNegated, $expr); return $this->resolveFloat($isNegated, $expr);
} }
if ($this->nodeTypeResolver->isNullableTypeOfSpecificType($expr, ObjectType::class)) { if ($this->nodeTypeResolver->isNullableTypeOfSpecificType($expr, ObjectType::class)) {

View File

@ -9,6 +9,7 @@ use PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\Cast\Bool_; use PhpParser\Node\Expr\Cast\Bool_;
use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Expr\Ternary;
use PHPStan\Type\BooleanType;
use Rector\Core\PhpParser\Node\AssignAndBinaryMap; use Rector\Core\PhpParser\Node\AssignAndBinaryMap;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@ -93,7 +94,7 @@ final class UnnecessaryTernaryExpressionRector extends AbstractRector
private function processTrueIfExpressionWithFalseElseExpression(Expr $expr) : Expr private function processTrueIfExpressionWithFalseElseExpression(Expr $expr) : Expr
{ {
$exprType = $this->getType($expr); $exprType = $this->getType($expr);
if ($exprType->isBoolean()->yes()) { if ($exprType instanceof BooleanType) {
return $expr; return $expr;
} }
return new Bool_($expr); return new Bool_($expr);
@ -102,13 +103,13 @@ final class UnnecessaryTernaryExpressionRector extends AbstractRector
{ {
if ($expr instanceof BooleanNot) { if ($expr instanceof BooleanNot) {
$negatedExprType = $this->getType($expr->expr); $negatedExprType = $this->getType($expr->expr);
if ($negatedExprType->isBoolean()->yes()) { if ($negatedExprType instanceof BooleanType) {
return $expr->expr; return $expr->expr;
} }
return new Bool_($expr->expr); return new Bool_($expr->expr);
} }
$exprType = $this->getType($expr); $exprType = $this->getType($expr);
if ($exprType->isBoolean()->yes()) { if ($exprType instanceof BooleanType) {
return new BooleanNot($expr); return new BooleanNot($expr);
} }
return new BooleanNot(new Bool_($expr)); return new BooleanNot(new Bool_($expr));

View File

@ -9,6 +9,7 @@ use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassLike; use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\Property; use PhpParser\Node\Stmt\Property;
use PhpParser\Node\Stmt\Trait_; use PhpParser\Node\Stmt\Trait_;
use PHPStan\Type\BooleanType;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector; use Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@ -85,6 +86,6 @@ CODE_SAMPLE
private function isBoolDocType(Property $property) : bool private function isBoolDocType(Property $property) : bool
{ {
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property); $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
return $phpDocInfo->getVarType()->isBoolean()->yes(); return $phpDocInfo->getVarType() instanceof BooleanType;
} }
} }

View File

@ -13,6 +13,7 @@ use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\Return_;
use PhpParser\NodeTraverser; use PhpParser\NodeTraverser;
use PHPStan\Type\BooleanType;
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer; use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
use Rector\Core\NodeManipulator\IfManipulator; use Rector\Core\NodeManipulator\IfManipulator;
use Rector\Core\PhpParser\Comparing\NodeComparator; use Rector\Core\PhpParser\Comparing\NodeComparator;
@ -134,7 +135,7 @@ CODE_SAMPLE
return \false; return \false;
} }
$type = $this->nodeTypeResolver->getType($cond); $type = $this->nodeTypeResolver->getType($cond);
if (!$type->isBoolean()->yes()) { if (!$type instanceof BooleanType) {
return \false; return \false;
} }
$nextNode = $ifWithOnlyReturns[0]->getAttribute(AttributeKey::NEXT_NODE); $nextNode = $ifWithOnlyReturns[0]->getAttribute(AttributeKey::NEXT_NODE);

View File

@ -7,6 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Expr; use PhpParser\Node\Expr;
use PhpParser\Node\Expr\BinaryOp\BooleanAnd; use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Expr\Ternary;
use PHPStan\Type\BooleanType;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -69,7 +70,7 @@ CODE_SAMPLE
return null; return null;
} }
$ifType = $this->getType($node->if); $ifType = $this->getType($node->if);
if (!$ifType->isBoolean()->yes()) { if (!$ifType instanceof BooleanType) {
return null; return null;
} }
return new BooleanAnd($node->cond, $node->if); return new BooleanAnd($node->cond, $node->if);

View File

@ -35,6 +35,7 @@ use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Reflection\Php\PhpMethodReflection; use PHPStan\Reflection\Php\PhpMethodReflection;
use PHPStan\Type\MixedType; use PHPStan\Type\MixedType;
use PHPStan\Type\Type; use PHPStan\Type\Type;
use PHPStan\Type\VoidType;
use Rector\Core\PhpParser\AstResolver; use Rector\Core\PhpParser\AstResolver;
use Rector\Core\PhpParser\Node\BetterNodeFinder; use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\Core\PhpParser\Node\NodeFactory; use Rector\Core\PhpParser\Node\NodeFactory;
@ -359,7 +360,7 @@ final class AnonymousFunctionFactory
*/ */
private function resolveStmts(FunctionVariantWithPhpDocs $functionVariantWithPhpDocs, $innerMethodCall) : array private function resolveStmts(FunctionVariantWithPhpDocs $functionVariantWithPhpDocs, $innerMethodCall) : array
{ {
if ($functionVariantWithPhpDocs->getReturnType()->isVoid()->yes()) { if ($functionVariantWithPhpDocs->getReturnType() instanceof VoidType) {
return [new Expression($innerMethodCall)]; return [new Expression($innerMethodCall)];
} }
return [new Return_($innerMethodCall)]; return [new Return_($innerMethodCall)];

View File

@ -12,6 +12,8 @@ use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Expr\Ternary;
use PhpParser\Node\Expr\Variable; use PhpParser\Node\Expr\Variable;
use PHPStan\Type\ArrayType; use PHPStan\Type\ArrayType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\StringType;
use Rector\Core\Php\PhpVersionProvider; use Rector\Core\Php\PhpVersionProvider;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\PhpVersionFeature; use Rector\Core\ValueObject\PhpVersionFeature;
@ -134,13 +136,16 @@ CODE_SAMPLE
} }
private function isArrayKeyTypeAllowed(ArrayType $arrayType) : bool private function isArrayKeyTypeAllowed(ArrayType $arrayType) : bool
{ {
if ($arrayType->getKeyType()->isInteger()->yes()) { $allowedKeyTypes = [IntegerType::class];
return \true; if ($this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::ARRAY_SPREAD_STRING_KEYS)) {
$allowedKeyTypes[] = StringType::class;
} }
if (!$this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::ARRAY_SPREAD_STRING_KEYS)) { foreach ($allowedKeyTypes as $allowedKeyType) {
return \false; if ($arrayType->getKeyType() instanceof $allowedKeyType) {
return \true;
}
} }
return $arrayType->getKeyType()->isString()->yes(); return \false;
} }
private function resolveValue(Expr $expr) : Expr private function resolveValue(Expr $expr) : Expr
{ {

View File

@ -7,6 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Arg; use PhpParser\Node\Arg;
use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\LNumber;
use PHPStan\Type\IntegerType;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\PhpVersionFeature; use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\VersionBonding\Contract\MinPhpVersionInterface; use Rector\VersionBonding\Contract\MinPhpVersionInterface;
@ -52,7 +53,7 @@ final class MbStrrposEncodingArgumentPositionRector extends AbstractRector imple
return null; return null;
} }
$secondArgType = $this->getType($node->args[2]->value); $secondArgType = $this->getType($node->args[2]->value);
if ($secondArgType->isInteger()->yes()) { if ($secondArgType instanceof IntegerType) {
return null; return null;
} }
$node->args[3] = $node->args[2]; $node->args[3] = $node->args[2];

View File

@ -9,6 +9,7 @@ use PhpParser\Node\Stmt\Break_;
use PhpParser\Node\Stmt\Case_; use PhpParser\Node\Stmt\Case_;
use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\Return_;
use PhpParser\Node\Stmt\Switch_; use PhpParser\Node\Stmt\Switch_;
use PHPStan\Type\IntegerType;
use PHPStan\Type\MixedType; use PHPStan\Type\MixedType;
use Rector\NodeTypeResolver\NodeTypeResolver; use Rector\NodeTypeResolver\NodeTypeResolver;
use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory; use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
@ -45,7 +46,7 @@ final class SwitchAnalyzer
} }
$uniqueTypes = $this->typeFactory->uniquateTypes($types); $uniqueTypes = $this->typeFactory->uniquateTypes($types);
$countUniqueTypes = \count($uniqueTypes); $countUniqueTypes = \count($uniqueTypes);
if ($countUniqueTypes === 1 && $uniqueTypes[0]->isInteger()->yes()) { if ($countUniqueTypes === 1 && $uniqueTypes[0] instanceof IntegerType) {
$switchCondType = $this->nodeTypeResolver->getType($expr); $switchCondType = $this->nodeTypeResolver->getType($expr);
if (!$switchCondType instanceof MixedType && $switchCondType->isString()->maybe()) { if (!$switchCondType instanceof MixedType && $switchCondType->isString()->maybe()) {
return \true; return \true;

View File

@ -14,6 +14,8 @@ use PhpParser\Node\Expr\Instanceof_;
use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Scalar\String_; use PhpParser\Node\Scalar\String_;
use PHPStan\Type\BooleanType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\NullType; use PHPStan\Type\NullType;
use PHPStan\Type\Type; use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator; use PHPStan\Type\TypeCombinator;
@ -39,10 +41,10 @@ final class ExactCompareFactory
if ($exprType->isString()->yes()) { if ($exprType->isString()->yes()) {
return new Identical($expr, new String_('')); return new Identical($expr, new String_(''));
} }
if ($exprType->isInteger()->yes()) { if ($exprType instanceof IntegerType) {
return new Identical($expr, new LNumber(0)); return new Identical($expr, new LNumber(0));
} }
if ($exprType->isBoolean()->yes()) { if ($exprType instanceof BooleanType) {
return new Identical($expr, $this->nodeFactory->createFalse()); return new Identical($expr, $this->nodeFactory->createFalse());
} }
if ($exprType->isArray()->yes()) { if ($exprType->isArray()->yes()) {
@ -64,7 +66,7 @@ final class ExactCompareFactory
if ($exprType->isString()->yes()) { if ($exprType->isString()->yes()) {
return new NotIdentical($expr, new String_('')); return new NotIdentical($expr, new String_(''));
} }
if ($exprType->isInteger()->yes()) { if ($exprType instanceof IntegerType) {
return new NotIdentical($expr, new LNumber(0)); return new NotIdentical($expr, new LNumber(0));
} }
if ($exprType->isArray()->yes()) { if ($exprType->isArray()->yes()) {
@ -81,7 +83,7 @@ final class ExactCompareFactory
private function createFromUnionType(UnionType $unionType, Expr $expr, bool $treatAsNotEmpty) private function createFromUnionType(UnionType $unionType, Expr $expr, bool $treatAsNotEmpty)
{ {
$unionType = TypeCombinator::removeNull($unionType); $unionType = TypeCombinator::removeNull($unionType);
if ($unionType->isBoolean()->yes()) { if ($unionType instanceof BooleanType) {
return new Identical($expr, $this->nodeFactory->createTrue()); return new Identical($expr, $this->nodeFactory->createTrue());
} }
if ($unionType instanceof TypeWithClassName) { if ($unionType instanceof TypeWithClassName) {
@ -170,7 +172,7 @@ final class ExactCompareFactory
$compareExprs = $this->collectCompareExprs($unionType, $expr, $treatAsNonEmpty); $compareExprs = $this->collectCompareExprs($unionType, $expr, $treatAsNonEmpty);
return $this->createBooleanOr($compareExprs); return $this->createBooleanOr($compareExprs);
} }
if ($unionType->isBoolean()->yes()) { if ($unionType instanceof BooleanType) {
return new NotIdentical($expr, $this->nodeFactory->createTrue()); return new NotIdentical($expr, $this->nodeFactory->createTrue());
} }
if ($unionType instanceof TypeWithClassName) { if ($unionType instanceof TypeWithClassName) {

View File

@ -5,6 +5,7 @@ namespace Rector\TypeDeclaration\Rector\ArrowFunction;
use PhpParser\Node; use PhpParser\Node;
use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\ArrowFunction;
use PHPStan\Type\VoidType;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\PhpVersionFeature; use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind; use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
@ -42,7 +43,7 @@ CODE_SAMPLE
return null; return null;
} }
$type = $this->getType($node->expr); $type = $this->getType($node->expr);
if ($type->isVoid()->yes()) { if ($type instanceof VoidType) {
return null; return null;
} }
$returnTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($type, TypeKind::RETURN); $returnTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($type, TypeKind::RETURN);

View File

@ -19,6 +19,7 @@ use PhpParser\Node\UnionType as PhpParserUnionType;
use PHPStan\Type\NullType; use PHPStan\Type\NullType;
use PHPStan\Type\ObjectType; use PHPStan\Type\ObjectType;
use PHPStan\Type\UnionType; use PHPStan\Type\UnionType;
use PHPStan\Type\VoidType;
use Rector\Core\Php\PhpVersionProvider; use Rector\Core\Php\PhpVersionProvider;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\PhpVersionFeature; use Rector\Core\ValueObject\PhpVersionFeature;
@ -152,7 +153,7 @@ CODE_SAMPLE
{ {
$resolvedType = $this->nodeTypeResolver->getType($arrowFunction->expr); $resolvedType = $this->nodeTypeResolver->getType($arrowFunction->expr);
// void type is not accepted for arrow functions - https://www.php.net/manual/en/functions.arrow.php#125673 // void type is not accepted for arrow functions - https://www.php.net/manual/en/functions.arrow.php#125673
if ($resolvedType->isVoid()->yes()) { if ($resolvedType instanceof VoidType) {
return null; return null;
} }
$returnType = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($resolvedType, TypeKind::RETURN); $returnType = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($resolvedType, TypeKind::RETURN);
@ -170,7 +171,7 @@ CODE_SAMPLE
$inferReturnType = $this->returnTypeInferer->inferFunctionLike($node); $inferReturnType = $this->returnTypeInferer->inferFunctionLike($node);
if ($inferReturnType instanceof UnionType) { if ($inferReturnType instanceof UnionType) {
foreach ($inferReturnType->getTypes() as $type) { foreach ($inferReturnType->getTypes() as $type) {
if ($type->isVoid()->yes()) { if ($type instanceof VoidType) {
return \true; return \true;
} }
} }

View File

@ -118,13 +118,13 @@ final class AlwaysStrictScalarExprAnalyzer
if ($type->isString()->yes() && !$type instanceof ConstantStringType) { if ($type->isString()->yes() && !$type instanceof ConstantStringType) {
return \true; return \true;
} }
if ($type->isFloat()->yes()) { if ($type instanceof FloatType) {
return \true; return \true;
} }
if ($type->isInteger()->yes()) { if ($type instanceof IntegerType) {
return \true; return \true;
} }
return $type->isBoolean()->yes(); return $type instanceof BooleanType;
} }
private function resolveTypeFromScalar(Scalar $scalar) : ?\PHPStan\Type\Type private function resolveTypeFromScalar(Scalar $scalar) : ?\PHPStan\Type\Type
{ {

View File

@ -16,11 +16,13 @@ use PhpParser\Node\Stmt\Return_;
use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ReflectionProvider; use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\BenevolentUnionType; use PHPStan\Type\BenevolentUnionType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\MixedType; use PHPStan\Type\MixedType;
use PHPStan\Type\ThisType; use PHPStan\Type\ThisType;
use PHPStan\Type\Type; use PHPStan\Type\Type;
use PHPStan\Type\TypeWithClassName; use PHPStan\Type\TypeWithClassName;
use PHPStan\Type\UnionType; use PHPStan\Type\UnionType;
use PHPStan\Type\VoidType;
use Rector\Core\Enum\ObjectReference; use Rector\Core\Enum\ObjectReference;
use Rector\Core\Exception\ShouldNotHappenException; use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\Php\PhpVersionProvider; use Rector\Core\Php\PhpVersionProvider;
@ -144,7 +146,7 @@ final class ReturnTypeInferer
*/ */
private function resolveTypeWithVoidHandling($functionLike, Type $resolvedType) : Type private function resolveTypeWithVoidHandling($functionLike, Type $resolvedType) : Type
{ {
if ($resolvedType->isVoid()->yes()) { if ($resolvedType instanceof VoidType) {
if ($functionLike instanceof ArrowFunction) { if ($functionLike instanceof ArrowFunction) {
return new MixedType(); return new MixedType();
} }
@ -161,7 +163,7 @@ final class ReturnTypeInferer
} }
if ($resolvedType instanceof UnionType) { if ($resolvedType instanceof UnionType) {
$benevolentUnionTypeIntegerType = $this->resolveBenevolentUnionTypeInteger($functionLike, $resolvedType); $benevolentUnionTypeIntegerType = $this->resolveBenevolentUnionTypeInteger($functionLike, $resolvedType);
if ($benevolentUnionTypeIntegerType->isInteger()->yes()) { if ($benevolentUnionTypeIntegerType instanceof IntegerType) {
return $benevolentUnionTypeIntegerType; return $benevolentUnionTypeIntegerType;
} }
} }
@ -169,15 +171,16 @@ final class ReturnTypeInferer
} }
/** /**
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike
* @return \PHPStan\Type\UnionType|\PHPStan\Type\IntegerType
*/ */
private function resolveBenevolentUnionTypeInteger($functionLike, UnionType $unionType) : Type private function resolveBenevolentUnionTypeInteger($functionLike, UnionType $unionType)
{ {
$types = $unionType->getTypes(); $types = $unionType->getTypes();
$countTypes = \count($types); $countTypes = \count($types);
if ($countTypes !== 2) { if ($countTypes !== 2) {
return $unionType; return $unionType;
} }
if (!($types[0]->isInteger()->yes() && $types[1]->isString()->yes())) { if (!($types[0] instanceof IntegerType && $types[1]->isString()->yes())) {
return $unionType; return $unionType;
} }
if (!$functionLike instanceof ArrowFunction) { if (!$functionLike instanceof ArrowFunction) {

View File

@ -188,7 +188,7 @@ final class ReturnedNodesReturnTypeInfererTypeInferer
if ($resolvedType instanceof MixedType || $this->isArrayTypeMixed($resolvedType)) { if ($resolvedType instanceof MixedType || $this->isArrayTypeMixed($resolvedType)) {
$correctedType = $this->inferFromReturnedMethodCall($return, $functionLike); $correctedType = $this->inferFromReturnedMethodCall($return, $functionLike);
// override only if has some extra value // override only if has some extra value
if (!$correctedType instanceof MixedType && !$correctedType->isVoid()->yes()) { if (!$correctedType instanceof MixedType && !$correctedType instanceof VoidType) {
return $correctedType; return $correctedType;
} }
} }

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = 'e66317aeb276bb0b544e7b4b55057c9dab5fbb73'; public const PACKAGE_VERSION = 'dbb0e196a43d8c14a9de6abeef8fe081e95c51c2';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2023-04-08 12:28:02'; public const RELEASE_DATE = '2023-04-08 20:19:33';
/** /**
* @var int * @var int
*/ */

View File

@ -42,6 +42,7 @@ use PhpParser\Node\Expr\BinaryOp\SmallerOrEqual;
use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\Cast\Bool_; use PhpParser\Node\Expr\Cast\Bool_;
use PHPStan\Analyser\Scope; use PHPStan\Analyser\Scope;
use PHPStan\Type\BooleanType;
use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\NodeTypeResolver\Node\AttributeKey;
final class AssignAndBinaryMap final class AssignAndBinaryMap
{ {
@ -96,7 +97,7 @@ final class AssignAndBinaryMap
return new Bool_($expr); return new Bool_($expr);
} }
$type = $scope->getType($expr); $type = $scope->getType($expr);
if ($type->isBoolean()->yes()) { if ($type instanceof BooleanType) {
return $expr; return $expr;
} }
return new Bool_($expr); return new Bool_($expr);

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit827ced5e8bddbb7f983434d5761e2173::getLoader(); return ComposerAutoloaderInit5655b4feae432f84294783c771fa6ebd::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit827ced5e8bddbb7f983434d5761e2173 class ComposerAutoloaderInit5655b4feae432f84294783c771fa6ebd
{ {
private static $loader; private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit827ced5e8bddbb7f983434d5761e2173
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInit827ced5e8bddbb7f983434d5761e2173', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit5655b4feae432f84294783c771fa6ebd', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit827ced5e8bddbb7f983434d5761e2173', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit5655b4feae432f84294783c771fa6ebd', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit827ced5e8bddbb7f983434d5761e2173::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit5655b4feae432f84294783c771fa6ebd::getInitializer($loader));
$loader->setClassMapAuthoritative(true); $loader->setClassMapAuthoritative(true);
$loader->register(true); $loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit827ced5e8bddbb7f983434d5761e2173::$files; $filesToLoad = \Composer\Autoload\ComposerStaticInit5655b4feae432f84294783c771fa6ebd::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) { $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit827ced5e8bddbb7f983434d5761e2173 class ComposerStaticInit5655b4feae432f84294783c771fa6ebd
{ {
public static $files = array ( public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3135,9 +3135,9 @@ class ComposerStaticInit827ced5e8bddbb7f983434d5761e2173
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit827ced5e8bddbb7f983434d5761e2173::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit5655b4feae432f84294783c771fa6ebd::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit827ced5e8bddbb7f983434d5761e2173::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit5655b4feae432f84294783c771fa6ebd::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit827ced5e8bddbb7f983434d5761e2173::$classMap; $loader->classMap = ComposerStaticInit5655b4feae432f84294783c771fa6ebd::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }