*/ final class ConditionalTypeForParameterMapper implements TypeMapperInterface { /** * @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper */ private $phpStanStaticTypeMapper; public function autowire(PHPStanStaticTypeMapper $phpStanStaticTypeMapper) : void { $this->phpStanStaticTypeMapper = $phpStanStaticTypeMapper; } public function getNodeClass() : string { return ConditionalTypeForParameter::class; } /** * @param ConditionalTypeForParameter $type */ public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode { return $type->toPhpDocNode(); } /** * @param ConditionalTypeForParameter $type * @param TypeKind::* $typeKind */ public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node { $type = TypeCombinator::union($type->getIf(), $type->getElse()); return $this->phpStanStaticTypeMapper->mapToPhpParserNode($type, $typeKind); } }