null, 'float' => null, 'string' => null, 'bool' => null, 'callable' => null, 'self' => null, 'parent' => null, 'array' => null, 'iterable' => null, 'object' => null, 'void' => null, 'mixed' => null, 'static' => null, 'null' => null, 'never' => null, 'false' => null, 'true' => null, ]; /** @var non-empty-string */ private string $name; /** @internal */ public function __construct( private Reflector $reflector, private ReflectionParameter|ReflectionMethod|ReflectionFunction|ReflectionEnum|ReflectionProperty $owner, Identifier|Name $type, ) { $name = $type->toString(); assert($name !== ''); $this->name = $name; } /** @internal */ public function withOwner(ReflectionParameter|ReflectionMethod|ReflectionFunction|ReflectionEnum|ReflectionProperty $owner): static { $clone = clone $this; $clone->owner = $owner; return $clone; } /** @return non-empty-string */ public function getName(): string { return $this->name; } /** * Checks if it is a built-in type (i.e., it's not an object...) * * @see https://php.net/manual/en/reflectiontype.isbuiltin.php */ public function isBuiltin(): bool { return array_key_exists(strtolower($this->name), self::BUILT_IN_TYPES); } public function getClass(): ReflectionClass { if (! $this->isBuiltin()) { return $this->reflector->reflectClass($this->name); } if ( $this->owner instanceof ReflectionEnum || $this->owner instanceof ReflectionFunction || ($this->owner instanceof ReflectionParameter && $this->owner->getDeclaringFunction() instanceof ReflectionFunction) ) { throw new LogicException(sprintf('The type %s cannot be resolved to class', $this->name)); } $lowercaseName = strtolower($this->name); if ($lowercaseName === 'self') { $class = $this->owner->getImplementingClass(); assert($class instanceof ReflectionClass); return $class; } if ($lowercaseName === 'parent') { $class = $this->owner->getDeclaringClass(); assert($class instanceof ReflectionClass); $parentClass = $class->getParentClass(); assert($parentClass instanceof ReflectionClass); return $parentClass; } if ( $this->owner instanceof ReflectionMethod && $lowercaseName === 'static' ) { return $this->owner->getCurrentClass(); } throw new LogicException(sprintf('The type %s cannot be resolved to class', $this->name)); } public function allowsNull(): bool { return match (strtolower($this->name)) { 'mixed' => true, 'null' => true, default => false, }; } /** @return non-empty-string */ public function __toString(): string { return $this->getName(); } } __halt_compiler();----SIGNATURE:----v4yYWeroRuBoqf5S8cfD6OQgHbbRG+VTsDvrK1D99oE2bUyNZsPTbpYNeWgt/zs1VVy0JCDEYAMNCcNXpwMLQPMHDnwhXNdSE1XkGAOAX8SrX4ltcEK9DxPcT40nkE0in74be2p8o0+Y4U/V7uyliZCTKm/IPAI0d/2+rPTfOLQxG2yDdJwz1xWyK2HHP7TD8H1pVWd4+l+pCjtyyz58cYKDGdrjXcjofXxP9P8M0j7enYavpIh44G2Em0WMHEDtS/J8BMf43wg3lR7Nafk5r4abRMymFm5i89jD3ST8DwaGfOZiZhDUkSluyNH3XQHynddN96bQoxWl75fUnWcvpEd865g3RyiNdAf29yRdQs7VuqC+UJKxZcZjQWm05Bv4ATl/AkoywoR7WPLt3dx+R3KvFGIts4x4uRQukfalKmkqUqoD4CrwOEBuI0tjvVny41JOjGmorHXuccMcidPTtZqCADF/qk6rU7qrE9Lq6OtnwXiIHKmP1ipDwEacHowTGtRqpUeNREBXLkeUEBFkwlZbaySBsR+UtVapSQM/uxKeQ8KhDhjRsdZ6tiJ1wdd9+KQeEhsKMoZvOyI80kQ2DkayuWkQLE79QDw+8z3MwqNlosAcJpd5JOEEHpRgzXlgyTFE36zZecpePzl8kZgTWAG48aSmAJQU0NT02ubMo4I=----ATTACHMENT:----NTk3NTc1MTU2NjcxMDE2OSA4NzQ4NjIxNTMyNjM0MDMgNDAzOTA5MTU2OTA3NjE1NA==