| 1: | <?php | 
| 2: |  | 
| 3: | declare(strict_types=1); | 
| 4: |  | 
| 5: | namespace PHPStan\BetterReflection\Reflection\Adapter; | 
| 6: |  | 
| 7: | use ReflectionIntersectionType as CoreReflectionIntersectionType; | 
| 8: | use PHPStan\BetterReflection\Reflection\ReflectionIntersectionType as BetterReflectionIntersectionType; | 
| 9: | use PHPStan\BetterReflection\Reflection\ReflectionNamedType as BetterReflectionNamedType; | 
| 10: |  | 
| 11: | use function array_map; | 
| 12: | use function assert; | 
| 13: |  | 
| 14: | class ReflectionIntersectionType extends CoreReflectionIntersectionType | 
| 15: | { | 
| 16: |  | 
| 17: |  | 
| 18: |  | 
| 19: | private $betterReflectionType; | 
| 20: | public function __construct(BetterReflectionIntersectionType $betterReflectionType) | 
| 21: | { | 
| 22: | $this->betterReflectionType = $betterReflectionType; | 
| 23: | } | 
| 24: |  | 
| 25: |  | 
| 26: | public function getTypes(): array | 
| 27: | { | 
| 28: | return array_map(static function (BetterReflectionNamedType $type): ReflectionNamedType { | 
| 29: | $adapterType = ReflectionType::fromType($type); | 
| 30: | assert($adapterType instanceof ReflectionNamedType); | 
| 31: |  | 
| 32: | return $adapterType; | 
| 33: | }, $this->betterReflectionType->getTypes()); | 
| 34: | } | 
| 35: |  | 
| 36: | public function __toString(): string | 
| 37: | { | 
| 38: | return $this->betterReflectionType->__toString(); | 
| 39: | } | 
| 40: |  | 
| 41: | public function allowsNull(): bool | 
| 42: | { | 
| 43: | return $this->betterReflectionType->allowsNull(); | 
| 44: | } | 
| 45: | } | 
| 46: |  |