mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 03:40:50 +00:00
Updated Rector to commit 24b8ea974a
24b8ea974a
[PHP 8.1] Add IntersectionTypesRector (#1227)
This commit is contained in:
parent
6630ebdb90
commit
d4c101be43
|
@ -8,6 +8,7 @@ use Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector;
|
|||
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
|
||||
use Rector\Php81\Rector\ClassMethod\NewInInitializerRector;
|
||||
use Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector;
|
||||
use Rector\Php81\Rector\FunctionLike\IntersectionTypesRector;
|
||||
use Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector;
|
||||
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
|
||||
|
@ -22,4 +23,5 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
|
|||
$services->set(\Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector::class);
|
||||
$services->set(\Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector::class);
|
||||
$services->set(\Rector\Php81\Rector\ClassMethod\NewInInitializerRector::class);
|
||||
$services->set(\Rector\Php81\Rector\FunctionLike\IntersectionTypesRector::class);
|
||||
};
|
||||
|
|
|
@ -4,17 +4,16 @@ declare (strict_types=1);
|
|||
namespace Rector\FamilyTree\Reflection;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\StaticPropertyFetch;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Interface_;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PhpParser\Node\UnionType as PhpParserUnionType;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
|
@ -81,7 +80,7 @@ final class FamilyRelationsAnalyzer
|
|||
return $childrenClassReflections;
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Name|\PhpParser\Node\NullableType|PhpParserUnionType|null $propertyTypeNode
|
||||
* @param \PhpParser\Node\ComplexType|\PhpParser\Node\Name|null $propertyTypeNode
|
||||
*/
|
||||
public function getPossibleUnionPropertyType(\PhpParser\Node\Stmt\Property $property, \PHPStan\Type\Type $varType, ?\PHPStan\Analyser\Scope $scope, $propertyTypeNode) : \Rector\FamilyTree\ValueObject\PropertyType
|
||||
{
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\FamilyTree\ValueObject;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\UnionType as PhpParserUnionType;
|
||||
use PHPStan\Type\Type;
|
||||
final class PropertyType
|
||||
{
|
||||
|
@ -15,13 +13,13 @@ final class PropertyType
|
|||
*/
|
||||
private $varType;
|
||||
/**
|
||||
* @var Name|NullableType|PhpParserUnionType|null
|
||||
* @var \PhpParser\Node\ComplexType|\PhpParser\Node\Name|null
|
||||
*/
|
||||
private $propertyTypeNode;
|
||||
/**
|
||||
* @param Name|NullableType|PhpParserUnionType|null $propertyTypeNode
|
||||
* @param \PhpParser\Node\ComplexType|\PhpParser\Node\Name|null $propertyTypeNode
|
||||
*/
|
||||
public function __construct(\PHPStan\Type\Type $varType, ?\PhpParser\Node $propertyTypeNode)
|
||||
public function __construct(\PHPStan\Type\Type $varType, $propertyTypeNode)
|
||||
{
|
||||
$this->varType = $varType;
|
||||
$this->propertyTypeNode = $propertyTypeNode;
|
||||
|
@ -31,9 +29,9 @@ final class PropertyType
|
|||
return $this->varType;
|
||||
}
|
||||
/**
|
||||
* @return Name|NullableType|PhpParserUnionType|null
|
||||
* @return \PhpParser\Node\ComplexType|\PhpParser\Node\Name|null
|
||||
*/
|
||||
public function getPropertyTypeNode() : ?\PhpParser\Node
|
||||
public function getPropertyTypeNode()
|
||||
{
|
||||
return $this->propertyTypeNode;
|
||||
}
|
||||
|
|
|
@ -4,14 +4,13 @@ declare (strict_types=1);
|
|||
namespace Rector\PHPStanStaticTypeMapper\Contract;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\UnionType;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||
/**
|
||||
* @template T of Type
|
||||
* @template TType of Type
|
||||
*/
|
||||
interface TypeMapperInterface
|
||||
{
|
||||
|
@ -26,7 +25,7 @@ interface TypeMapperInterface
|
|||
public function mapToPHPStanPhpDocTypeNode($type, $typeKind) : \PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
/**
|
||||
* @param \PHPStan\Type\Type $type
|
||||
* @return Name|NullableType|UnionType|null
|
||||
* @return Name|ComplexType|null
|
||||
* @param \Rector\PHPStanStaticTypeMapper\Enum\TypeKind $typeKind
|
||||
*/
|
||||
public function mapToPhpParserNode($type, $typeKind) : ?\PhpParser\Node;
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\PHPStanStaticTypeMapper;
|
||||
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\UnionType;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\Type\Accessory\AccessoryNumericStringType;
|
||||
|
@ -44,7 +43,7 @@ final class PHPStanStaticTypeMapper
|
|||
throw new \Rector\Core\Exception\NotImplementedYetException(__METHOD__ . ' for ' . \get_class($type));
|
||||
}
|
||||
/**
|
||||
* @return \PhpParser\Node\Name|\PhpParser\Node\NullableType|\PhpParser\Node\UnionType|null
|
||||
* @return \PhpParser\Node\ComplexType|\PhpParser\Node\Name|null
|
||||
*/
|
||||
public function mapToPhpParserNode(\PHPStan\Type\Type $type, \Rector\PHPStanStaticTypeMapper\Enum\TypeKind $typeKind)
|
||||
{
|
||||
|
|
|
@ -4,10 +4,14 @@ declare (strict_types=1);
|
|||
namespace Rector\PHPStanStaticTypeMapper\TypeMapper;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\Type\IntersectionType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareIntersectionTypeNode;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\Php\PhpVersionProvider;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
|
||||
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
|
||||
|
@ -21,6 +25,14 @@ final class IntersectionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Co
|
|||
* @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper
|
||||
*/
|
||||
private $phpStanStaticTypeMapper;
|
||||
/**
|
||||
* @var \Rector\Core\Php\PhpVersionProvider
|
||||
*/
|
||||
private $phpVersionProvider;
|
||||
public function __construct(\Rector\Core\Php\PhpVersionProvider $phpVersionProvider)
|
||||
{
|
||||
$this->phpVersionProvider = $phpVersionProvider;
|
||||
}
|
||||
/**
|
||||
* @required
|
||||
*/
|
||||
|
@ -46,6 +58,9 @@ final class IntersectionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Co
|
|||
$intersectionTypesNodes[] = $this->phpStanStaticTypeMapper->mapToPHPStanPhpDocTypeNode($intersectionedType, $typeKind);
|
||||
}
|
||||
$intersectionTypesNodes = \array_unique($intersectionTypesNodes);
|
||||
if (\count($intersectionTypesNodes) === 1) {
|
||||
return $intersectionTypesNodes[0];
|
||||
}
|
||||
return new \Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareIntersectionTypeNode($intersectionTypesNodes);
|
||||
}
|
||||
/**
|
||||
|
@ -54,7 +69,17 @@ final class IntersectionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Co
|
|||
*/
|
||||
public function mapToPhpParserNode($type, $typeKind) : ?\PhpParser\Node
|
||||
{
|
||||
// intersection types in PHP are not yet supported
|
||||
return null;
|
||||
if (!$this->phpVersionProvider->isAtLeastPhpVersion(\Rector\Core\ValueObject\PhpVersionFeature::INTERSECTION_TYPES)) {
|
||||
return null;
|
||||
}
|
||||
$intersectionedTypeNodes = [];
|
||||
foreach ($type->getTypes() as $intersectionedType) {
|
||||
$resolvedType = $this->phpStanStaticTypeMapper->mapToPhpParserNode($intersectionedType, $typeKind);
|
||||
if (!$resolvedType instanceof \PhpParser\Node\Name) {
|
||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||
}
|
||||
$intersectionedTypeNodes[] = $resolvedType;
|
||||
}
|
||||
return new \PhpParser\Node\IntersectionType($intersectionedTypeNodes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ declare (strict_types=1);
|
|||
namespace Rector\PHPStanStaticTypeMapper\TypeMapper;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
|
@ -142,7 +143,7 @@ final class UnionTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract\
|
|||
if ($nullabledTypeNode instanceof \PhpParser\Node\NullableType) {
|
||||
return $nullabledTypeNode;
|
||||
}
|
||||
if ($nullabledTypeNode instanceof \PhpParser\Node\UnionType) {
|
||||
if ($nullabledTypeNode instanceof \PhpParser\Node\ComplexType) {
|
||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||
}
|
||||
return new \PhpParser\Node\NullableType($nullabledTypeNode);
|
||||
|
|
|
@ -5,10 +5,13 @@ namespace Rector\StaticTypeMapper\Contract\PhpParser;
|
|||
|
||||
use PhpParser\Node;
|
||||
use PHPStan\Type\Type;
|
||||
/**
|
||||
* @template TNode as \PhpParser\Node
|
||||
*/
|
||||
interface PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @return class-string<Node>
|
||||
* @return class-string<TNode>
|
||||
*/
|
||||
public function getNodeType() : string;
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\StaticTypeMapper\PhpDocParser;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PHPStan\Analyser\NameScope;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\Type\IntersectionType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\StaticTypeMapper\Contract\PhpDocParser\PhpDocTypeMapperInterface;
|
||||
use Rector\StaticTypeMapper\PhpDoc\PhpDocTypeMapper;
|
||||
use RectorPrefix20211114\Symfony\Contracts\Service\Attribute\Required;
|
||||
final class IntersectionTypeMapper implements \Rector\StaticTypeMapper\Contract\PhpDocParser\PhpDocTypeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\PhpDoc\PhpDocTypeMapper
|
||||
*/
|
||||
private $phpDocTypeMapper;
|
||||
/**
|
||||
* @return class-string<TypeNode>
|
||||
*/
|
||||
public function getNodeType() : string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class;
|
||||
}
|
||||
/**
|
||||
* @required
|
||||
*/
|
||||
public function autowireUnionTypeMapper(\Rector\StaticTypeMapper\PhpDoc\PhpDocTypeMapper $phpDocTypeMapper) : void
|
||||
{
|
||||
$this->phpDocTypeMapper = $phpDocTypeMapper;
|
||||
}
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\Type\TypeNode $typeNode
|
||||
* @param \PhpParser\Node $node
|
||||
* @param \PHPStan\Analyser\NameScope $nameScope
|
||||
*/
|
||||
public function mapToPHPStanType($typeNode, $node, $nameScope) : \PHPStan\Type\Type
|
||||
{
|
||||
$intersectionedTypes = [];
|
||||
foreach ($typeNode->types as $intersectionedTypeNode) {
|
||||
$intersectionedTypes[] = $this->phpDocTypeMapper->mapToPHPStanType($intersectionedTypeNode, $node, $nameScope);
|
||||
}
|
||||
return new \PHPStan\Type\IntersectionType($intersectionedTypes);
|
||||
}
|
||||
}
|
|
@ -10,6 +10,9 @@ use PHPStan\Type\MixedType;
|
|||
use PHPStan\Type\Type;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
|
||||
/**
|
||||
* @implements PhpParserNodeMapperInterface<Expr>
|
||||
*/
|
||||
final class ExprNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,9 @@ use Rector\NodeTypeResolver\Node\AttributeKey;
|
|||
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
/**
|
||||
* @implements PhpParserNodeMapperInterface<FullyQualified>
|
||||
*/
|
||||
final class FullyQualifiedNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,9 @@ use PhpParser\Node\Identifier;
|
|||
use PHPStan\Type\Type;
|
||||
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
|
||||
use Rector\StaticTypeMapper\Mapper\ScalarStringToTypeMapper;
|
||||
/**
|
||||
* @implements PhpParserNodeMapperInterface<Identifier>
|
||||
*/
|
||||
final class IdentifierNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\StaticTypeMapper\PhpParser;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PHPStan\Type\IntersectionType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
|
||||
use Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper;
|
||||
use RectorPrefix20211114\Symfony\Contracts\Service\Attribute\Required;
|
||||
/**
|
||||
* @implements PhpParserNodeMapperInterface<Node\IntersectionType>
|
||||
*/
|
||||
final class IntersectionTypeNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper
|
||||
*/
|
||||
private $phpParserNodeMapper;
|
||||
/**
|
||||
* @required
|
||||
*/
|
||||
public function autowireUnionTypeNodeMapper(\Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper $phpParserNodeMapper) : void
|
||||
{
|
||||
$this->phpParserNodeMapper = $phpParserNodeMapper;
|
||||
}
|
||||
/**
|
||||
* @return class-string<Node>
|
||||
*/
|
||||
public function getNodeType() : string
|
||||
{
|
||||
return \PhpParser\Node\IntersectionType::class;
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node $node
|
||||
*/
|
||||
public function mapToPHPStan($node) : \PHPStan\Type\Type
|
||||
{
|
||||
$types = [];
|
||||
foreach ($node->types as $intersectionedType) {
|
||||
$types[] = $this->phpParserNodeMapper->mapToPHPStanType($intersectionedType);
|
||||
}
|
||||
return new \PHPStan\Type\IntersectionType($types);
|
||||
}
|
||||
}
|
|
@ -27,6 +27,9 @@ use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
|
|||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\ParentObjectWithoutClassType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\ParentStaticType;
|
||||
/**
|
||||
* @implements PhpParserNodeMapperInterface<Name>
|
||||
*/
|
||||
final class NameNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,9 @@ use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
|
|||
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
|
||||
use Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper;
|
||||
use RectorPrefix20211114\Symfony\Contracts\Service\Attribute\Required;
|
||||
/**
|
||||
* @implements PhpParserNodeMapperInterface<NullableType>
|
||||
*/
|
||||
final class NullableTypeNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,9 @@ use PhpParser\Node\Scalar\String_;
|
|||
use PHPStan\Type\StringType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
|
||||
/**
|
||||
* @implements PhpParserNodeMapperInterface<String_>
|
||||
*/
|
||||
final class StringNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -10,6 +10,9 @@ use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
|
|||
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
|
||||
use Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper;
|
||||
use RectorPrefix20211114\Symfony\Contracts\Service\Attribute\Required;
|
||||
/**
|
||||
* @implements PhpParserNodeMapperInterface<UnionType>
|
||||
*/
|
||||
final class UnionTypeNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -4,11 +4,10 @@ declare (strict_types=1);
|
|||
namespace Rector\StaticTypeMapper;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\UnionType as PhpParserUnionType;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
|
||||
|
@ -59,7 +58,7 @@ final class StaticTypeMapper
|
|||
return $this->phpStanStaticTypeMapper->mapToPHPStanPhpDocTypeNode($phpStanType, $typeKind);
|
||||
}
|
||||
/**
|
||||
* @return Name|NullableType|PhpParserUnionType|null
|
||||
* @return Name|ComplexType|null
|
||||
*/
|
||||
public function mapPHPStanTypeToPhpParserNode(\PHPStan\Type\Type $phpStanType, \Rector\PHPStanStaticTypeMapper\Enum\TypeKind $typeKind) : ?\PhpParser\Node
|
||||
{
|
||||
|
|
|
@ -129,7 +129,7 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
// Make it nullable?
|
||||
if ($node->returnType instanceof \PhpParser\Node\NullableType && !$parentReturnTypeNode instanceof \PhpParser\Node\NullableType && !$parentReturnTypeNode instanceof \PhpParser\Node\UnionType) {
|
||||
if ($node->returnType instanceof \PhpParser\Node\NullableType && !$parentReturnTypeNode instanceof \PhpParser\Node\ComplexType) {
|
||||
$parentReturnTypeNode = new \PhpParser\Node\NullableType($parentReturnTypeNode);
|
||||
}
|
||||
// skip if type is already set
|
||||
|
|
|
@ -4,13 +4,13 @@ declare (strict_types=1);
|
|||
namespace Rector\Php74\Rector\Property;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PhpParser\Node\Stmt\Trait_;
|
||||
use PhpParser\Node\UnionType as PhpParserUnionType;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\Generic\TemplateType;
|
||||
use PHPStan\Type\MixedType;
|
||||
|
@ -196,7 +196,7 @@ CODE_SAMPLE
|
|||
return \Rector\Core\ValueObject\PhpVersionFeature::TYPED_PROPERTIES;
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Name|\PhpParser\Node\NullableType|PhpParserUnionType|null $node
|
||||
* @param \PhpParser\Node\ComplexType|\PhpParser\Node\Name|null $node
|
||||
*/
|
||||
private function isNullOrNonClassLikeTypeOrMixedOrVendorLockedIn($node, \PhpParser\Node\Stmt\Property $property, \PHPStan\Type\Type $type) : bool
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ CODE_SAMPLE
|
|||
return \true;
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Name|\PhpParser\Node\NullableType|PhpParserUnionType $node
|
||||
* @param \PhpParser\Node\ComplexType|\PhpParser\Node\Name $node
|
||||
*/
|
||||
private function shouldSkipNonClassLikeType($node, \PHPStan\Type\Type $type) : bool
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\Php74\TypeAnalyzer;
|
||||
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PHPStan\Type\NullType;
|
||||
|
@ -11,7 +12,7 @@ use PHPStan\Type\UnionType;
|
|||
final class PropertyUnionTypeResolver
|
||||
{
|
||||
/**
|
||||
* @param \PhpParser\Node\Name|\PhpParser\Node\NullableType|\PhpParser\Node\UnionType $phpUnionType
|
||||
* @param \PhpParser\Node\ComplexType|\PhpParser\Node\Name $phpUnionType
|
||||
*/
|
||||
public function resolve($phpUnionType, \PHPStan\Type\Type $possibleUnionType) : \PHPStan\Type\Type
|
||||
{
|
||||
|
|
93
rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php
Normal file
93
rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php
Normal file
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Php81\Rector\FunctionLike;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\ArrowFunction;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PHPStan\Type\IntersectionType;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\Tests\Php81\Rector\FunctionLike\IntersectionTypesRector\IntersectionTypesRectorTest
|
||||
*/
|
||||
final class IntersectionTypesRector extends \Rector\Core\Rector\AbstractRector implements \Rector\VersionBonding\Contract\MinPhpVersionInterface
|
||||
{
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Change docs to intersection types, where possible (properties are covered by TypedPropertyRector (@todo))', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
/**
|
||||
* @param string&int $types
|
||||
*/
|
||||
public function process($types)
|
||||
{
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
public function process(string&int $types)
|
||||
{
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Expr\ArrowFunction::class, \PhpParser\Node\Expr\Closure::class, \PhpParser\Node\Stmt\ClassMethod::class, \PhpParser\Node\Stmt\Function_::class];
|
||||
}
|
||||
/**
|
||||
* @param ArrowFunction|Closure|ClassMethod|Function_ $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($node);
|
||||
if (!$phpDocInfo instanceof \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo) {
|
||||
return null;
|
||||
}
|
||||
$this->refactorParamTypes($node, $phpDocInfo);
|
||||
// $this->refactorReturnType($node, $phpDocInfo);
|
||||
return $node;
|
||||
}
|
||||
public function provideMinPhpVersion() : int
|
||||
{
|
||||
return \Rector\Core\ValueObject\PhpVersionFeature::INTERSECTION_TYPES;
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Expr\ArrowFunction|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_ $functionLike
|
||||
*/
|
||||
private function refactorParamTypes($functionLike, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo) : void
|
||||
{
|
||||
foreach ($functionLike->params as $param) {
|
||||
if ($param->type !== null) {
|
||||
continue;
|
||||
}
|
||||
/** @var string $paramName */
|
||||
$paramName = $this->getName($param->var);
|
||||
$paramType = $phpDocInfo->getParamType($paramName);
|
||||
if (!$paramType instanceof \PHPStan\Type\IntersectionType) {
|
||||
continue;
|
||||
}
|
||||
$phpParserIntersectionType = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($paramType, \Rector\PHPStanStaticTypeMapper\Enum\TypeKind::PARAM());
|
||||
if (!$phpParserIntersectionType instanceof \PhpParser\Node\IntersectionType) {
|
||||
continue;
|
||||
}
|
||||
$param->type = $phpParserIntersectionType;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,11 +9,11 @@ use PhpParser\Node\Expr\PropertyFetch;
|
|||
use PhpParser\Node\FunctionLike;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\UnionType;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\Php\PhpPropertyReflection;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
|
@ -112,7 +112,7 @@ CODE_SAMPLE
|
|||
return \Rector\Core\ValueObject\PhpVersionFeature::TYPED_PROPERTIES;
|
||||
}
|
||||
/**
|
||||
* @return Node\Name|UnionType|NullableType|null
|
||||
* @return Node\Name|Node\ComplexType|null
|
||||
*/
|
||||
private function matchPropertySingleTypeNode(\PhpParser\Node\Expr\PropertyFetch $propertyFetch) : ?\PhpParser\Node
|
||||
{
|
||||
|
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '62f2c303585f9e4c6467d66c6a333bafce26b613';
|
||||
public const PACKAGE_VERSION = '24b8ea974aad71ece8f6f4ea5d0549247c969a5e';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-11-14 16:18:50';
|
||||
public const RELEASE_DATE = '2021-11-14 11:50:57';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20211114\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
|
|
@ -433,4 +433,9 @@ final class PhpVersionFeature
|
|||
* @var int
|
||||
*/
|
||||
public const NEW_INITIALIZERS = \Rector\Core\ValueObject\PhpVersion::PHP_81;
|
||||
/**
|
||||
* @see https://wiki.php.net/rfc/pure-intersection-types
|
||||
* @var int
|
||||
*/
|
||||
public const INTERSECTION_TYPES = \Rector\Core\ValueObject\PhpVersion::PHP_81;
|
||||
}
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -4,4 +4,4 @@
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitfdda04122218d22f3d1286c001e6865b::getLoader();
|
||||
return ComposerAutoloaderInit66c79d459c0fd56f56e8cc9903398fee::getLoader();
|
||||
|
|
3
vendor/composer/autoload_classmap.php
vendored
3
vendor/composer/autoload_classmap.php
vendored
|
@ -2484,6 +2484,7 @@ return array(
|
|||
'Rector\\Php81\\Rector\\Class_\\MyCLabsClassToEnumRector' => $baseDir . '/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php',
|
||||
'Rector\\Php81\\Rector\\Class_\\SpatieEnumClassToEnumRector' => $baseDir . '/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php',
|
||||
'Rector\\Php81\\Rector\\FuncCall\\Php81ResourceReturnToObjectRector' => $baseDir . '/rules/Php81/Rector/FuncCall/Php81ResourceReturnToObjectRector.php',
|
||||
'Rector\\Php81\\Rector\\FunctionLike\\IntersectionTypesRector' => $baseDir . '/rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php',
|
||||
'Rector\\Php81\\Rector\\MethodCall\\MyCLabsMethodCallToEnumConstRector' => $baseDir . '/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php',
|
||||
'Rector\\Php81\\Rector\\Property\\ReadOnlyPropertyRector' => $baseDir . '/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php',
|
||||
'Rector\\PhpAttribute\\NodeAnalyzer\\NamedArgumentsResolver' => $baseDir . '/packages/PhpAttribute/NodeAnalyzer/NamedArgumentsResolver.php',
|
||||
|
@ -2618,12 +2619,14 @@ return array(
|
|||
'Rector\\StaticTypeMapper\\Mapper\\ScalarStringToTypeMapper' => $baseDir . '/packages/StaticTypeMapper/Mapper/ScalarStringToTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\Naming\\NameScopeFactory' => $baseDir . '/packages/StaticTypeMapper/Naming/NameScopeFactory.php',
|
||||
'Rector\\StaticTypeMapper\\PhpDocParser\\IdentifierTypeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpDocParser/IdentifierTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpDocParser\\IntersectionTypeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpDocParser/IntersectionTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpDocParser\\NullableTypeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpDocParser/NullableTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpDocParser\\UnionTypeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpDocParser/UnionTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpDoc\\PhpDocTypeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpDoc/PhpDocTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\ExprNodeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpParser/ExprNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\FullyQualifiedNodeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpParser/FullyQualifiedNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\IdentifierNodeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpParser/IdentifierNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\IntersectionTypeNodeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\NameNodeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpParser/NameNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\NullableTypeNodeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpParser/NullableTypeNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\StringNodeMapper' => $baseDir . '/packages/StaticTypeMapper/PhpParser/StringNodeMapper.php',
|
||||
|
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitfdda04122218d22f3d1286c001e6865b
|
||||
class ComposerAutoloaderInit66c79d459c0fd56f56e8cc9903398fee
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInitfdda04122218d22f3d1286c001e6865b
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitfdda04122218d22f3d1286c001e6865b', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit66c79d459c0fd56f56e8cc9903398fee', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitfdda04122218d22f3d1286c001e6865b', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit66c79d459c0fd56f56e8cc9903398fee', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitfdda04122218d22f3d1286c001e6865b::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit66c79d459c0fd56f56e8cc9903398fee::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInitfdda04122218d22f3d1286c001e6865b
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitfdda04122218d22f3d1286c001e6865b::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit66c79d459c0fd56f56e8cc9903398fee::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequirefdda04122218d22f3d1286c001e6865b($fileIdentifier, $file);
|
||||
composerRequire66c79d459c0fd56f56e8cc9903398fee($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequirefdda04122218d22f3d1286c001e6865b($fileIdentifier, $file)
|
||||
function composerRequire66c79d459c0fd56f56e8cc9903398fee($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
|
11
vendor/composer/autoload_static.php
vendored
11
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitfdda04122218d22f3d1286c001e6865b
|
||||
class ComposerStaticInit66c79d459c0fd56f56e8cc9903398fee
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -2814,6 +2814,7 @@ class ComposerStaticInitfdda04122218d22f3d1286c001e6865b
|
|||
'Rector\\Php81\\Rector\\Class_\\MyCLabsClassToEnumRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php',
|
||||
'Rector\\Php81\\Rector\\Class_\\SpatieEnumClassToEnumRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php',
|
||||
'Rector\\Php81\\Rector\\FuncCall\\Php81ResourceReturnToObjectRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/FuncCall/Php81ResourceReturnToObjectRector.php',
|
||||
'Rector\\Php81\\Rector\\FunctionLike\\IntersectionTypesRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php',
|
||||
'Rector\\Php81\\Rector\\MethodCall\\MyCLabsMethodCallToEnumConstRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php',
|
||||
'Rector\\Php81\\Rector\\Property\\ReadOnlyPropertyRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php',
|
||||
'Rector\\PhpAttribute\\NodeAnalyzer\\NamedArgumentsResolver' => __DIR__ . '/../..' . '/packages/PhpAttribute/NodeAnalyzer/NamedArgumentsResolver.php',
|
||||
|
@ -2948,12 +2949,14 @@ class ComposerStaticInitfdda04122218d22f3d1286c001e6865b
|
|||
'Rector\\StaticTypeMapper\\Mapper\\ScalarStringToTypeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/Mapper/ScalarStringToTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\Naming\\NameScopeFactory' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/Naming/NameScopeFactory.php',
|
||||
'Rector\\StaticTypeMapper\\PhpDocParser\\IdentifierTypeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpDocParser/IdentifierTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpDocParser\\IntersectionTypeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpDocParser/IntersectionTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpDocParser\\NullableTypeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpDocParser/NullableTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpDocParser\\UnionTypeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpDocParser/UnionTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpDoc\\PhpDocTypeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpDoc/PhpDocTypeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\ExprNodeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpParser/ExprNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\FullyQualifiedNodeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpParser/FullyQualifiedNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\IdentifierNodeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpParser/IdentifierNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\IntersectionTypeNodeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\NameNodeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpParser/NameNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\NullableTypeNodeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpParser/NullableTypeNodeMapper.php',
|
||||
'Rector\\StaticTypeMapper\\PhpParser\\StringNodeMapper' => __DIR__ . '/../..' . '/packages/StaticTypeMapper/PhpParser/StringNodeMapper.php',
|
||||
|
@ -3542,9 +3545,9 @@ class ComposerStaticInitfdda04122218d22f3d1286c001e6865b
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitfdda04122218d22f3d1286c001e6865b::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitfdda04122218d22f3d1286c001e6865b::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitfdda04122218d22f3d1286c001e6865b::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit66c79d459c0fd56f56e8cc9903398fee::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit66c79d459c0fd56f56e8cc9903398fee::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit66c79d459c0fd56f56e8cc9903398fee::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
|
@ -12,8 +12,8 @@ if (!class_exists('GenerateChangelogCommand', false) && !interface_exists('Gener
|
|||
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
||||
spl_autoload_call('RectorPrefix20211114\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInitfdda04122218d22f3d1286c001e6865b', false) && !interface_exists('ComposerAutoloaderInitfdda04122218d22f3d1286c001e6865b', false) && !trait_exists('ComposerAutoloaderInitfdda04122218d22f3d1286c001e6865b', false)) {
|
||||
spl_autoload_call('RectorPrefix20211114\ComposerAutoloaderInitfdda04122218d22f3d1286c001e6865b');
|
||||
if (!class_exists('ComposerAutoloaderInit66c79d459c0fd56f56e8cc9903398fee', false) && !interface_exists('ComposerAutoloaderInit66c79d459c0fd56f56e8cc9903398fee', false) && !trait_exists('ComposerAutoloaderInit66c79d459c0fd56f56e8cc9903398fee', false)) {
|
||||
spl_autoload_call('RectorPrefix20211114\ComposerAutoloaderInit66c79d459c0fd56f56e8cc9903398fee');
|
||||
}
|
||||
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
|
||||
spl_autoload_call('RectorPrefix20211114\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
|
@ -3309,9 +3309,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20211114\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequirefdda04122218d22f3d1286c001e6865b')) {
|
||||
function composerRequirefdda04122218d22f3d1286c001e6865b() {
|
||||
return \RectorPrefix20211114\composerRequirefdda04122218d22f3d1286c001e6865b(...func_get_args());
|
||||
if (!function_exists('composerRequire66c79d459c0fd56f56e8cc9903398fee')) {
|
||||
function composerRequire66c79d459c0fd56f56e8cc9903398fee() {
|
||||
return \RectorPrefix20211114\composerRequire66c79d459c0fd56f56e8cc9903398fee(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user