rector/packages/PHPStanStaticTypeMapper/TypeMapper/StrictMixedTypeMapper.php
Tomas Votruba d793888f8a Updated Rector to commit 53c6c5fcaf92b3ff40b6f45e476ff981b9028e95
53c6c5fcaf Remove Kind from doc mapper, as used just once (#4234)
2023-06-16 03:34:15 +00:00

44 lines
1.0 KiB
PHP

<?php
declare (strict_types=1);
namespace Rector\PHPStanStaticTypeMapper\TypeMapper;
use PhpParser\Node;
use PhpParser\Node\Identifier;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\StrictMixedType;
use PHPStan\Type\Type;
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
/**
* @implements TypeMapperInterface<StrictMixedType>
*/
final class StrictMixedTypeMapper implements TypeMapperInterface
{
/**
* @var string
*/
private const MIXED = 'mixed';
/**
* @return class-string<Type>
*/
public function getNodeClass() : string
{
return StrictMixedType::class;
}
/**
* @param StrictMixedType $type
*/
public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode
{
return new IdentifierTypeNode(self::MIXED);
}
/**
* @param StrictMixedType $type
*/
public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node
{
return new Identifier(self::MIXED);
}
}