* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PropertyInfo; /** * Type value object (immutable). * * @author Kévin Dunglas * * @final */ class Type { public const BUILTIN_TYPE_INT = 'int'; public const BUILTIN_TYPE_FLOAT = 'float'; public const BUILTIN_TYPE_STRING = 'string'; public const BUILTIN_TYPE_BOOL = 'bool'; public const BUILTIN_TYPE_TRUE = 'true'; public const BUILTIN_TYPE_FALSE = 'false'; public const BUILTIN_TYPE_RESOURCE = 'resource'; public const BUILTIN_TYPE_OBJECT = 'object'; public const BUILTIN_TYPE_ARRAY = 'array'; public const BUILTIN_TYPE_NULL = 'null'; public const BUILTIN_TYPE_CALLABLE = 'callable'; public const BUILTIN_TYPE_ITERABLE = 'iterable'; /** * List of PHP builtin types. * * @var string[] */ public static $builtinTypes = [ self::BUILTIN_TYPE_INT, self::BUILTIN_TYPE_FLOAT, self::BUILTIN_TYPE_STRING, self::BUILTIN_TYPE_BOOL, self::BUILTIN_TYPE_TRUE, self::BUILTIN_TYPE_FALSE, self::BUILTIN_TYPE_RESOURCE, self::BUILTIN_TYPE_OBJECT, self::BUILTIN_TYPE_ARRAY, self::BUILTIN_TYPE_CALLABLE, self::BUILTIN_TYPE_NULL, self::BUILTIN_TYPE_ITERABLE, ]; private $builtinType; private $nullable; private $class; private $collection; private $collectionKeyType; private $collectionValueType; /** * @throws \InvalidArgumentException */ public function __construct(string $builtinType, bool $nullable = false, string $class = null, bool $collection = false, self $collectionKeyType = null, self $collectionValueType = null) { if (!\in_array($builtinType, self::$builtinTypes)) { throw new \InvalidArgumentException(sprintf('"%s" is not a valid PHP type.', $builtinType)); } $this->builtinType = $builtinType; $this->nullable = $nullable; $this->class = $class; $this->collection = $collection; $this->collectionKeyType = $collectionKeyType; $this->collectionValueType = $collectionValueType; } /** * Gets built-in type. * * Can be bool, int, float, string, array, object, resource, null, callback or iterable. */ public function getBuiltinType(): string { return $this->builtinType; } public function isNullable(): bool { return $this->nullable; } /** * Gets the class name. * * Only applicable if the built-in type is object. */ public function getClassName(): ?string { return $this->class; } public function isCollection(): bool { return $this->collection; } /** * Gets collection key type. * * Only applicable for a collection type. */ public function getCollectionKeyType(): ?self { return $this->collectionKeyType; } /** * Gets collection value type. * * Only applicable for a collection type. */ public function getCollectionValueType(): ?self { return $this->collectionValueType; } } __halt_compiler();----SIGNATURE:----eDz3XER4252yhgLVZTYm0mL4F6ez6xrpZK0V7lHaqcN53uyxSIj4BgKlES2GZu6/Mf9zB4HkHhCvPAlHP0M9rc1NKwwYypkzy2ZHis6uy/iZD35LpbfSAgfMjH/PMLPzg9JdjTlfZ1DjeQ0CP5gscKXz/S/3MABEd0ioMr3wW8KVD4bK2oKWaeJL8NgvjIIRcvc1s/WU53AOTsTo+Rt+v/mUdMKhHPzuDLuO/PbQMFhAB4gYUovSLKEVPk9qXOa58WzPGLrfxHMx5oHfZKtw0OtYFv4sfQxVgdjz5WPQY5c6sgwE2KJsuNsZxFOwR0r9TtkMWN7fTZHmcJBXK6Goh+1DjhMU32ruJ+gkaOVfH3Nww2w4eHUU5B2opf9T6YbfUcY3SK9uNItOLr7xmblieOohIlXBcNlCk3uf97/HGR/HSEdy/WWHpKpHZY2Wl6RuE8qUOBnALA2eV5cYiyA1VlDp/Q7UtnNuOCcmXYfujccT5S6pFSuYWGcSF9r6XufD7m/mVdgzTQmRt0hi9WRTTQ+lNNOmYbV4p0K1RLGuyU8nEfDuaQLznxgZ3FYK1wdkcU3WP0DREAJaiXZdbvzFlvaHMTaF0RximbUFqzHUHI+QPhP/JCQyhMTAFuVjKUGSD/kYw4DHT+x8o2EZ9DC8AxMzT8XC7k6JIobjcz/W2vQ=----ATTACHMENT:----NDY3MTg0NTA2ODIzMDI4OSAzODU5ODY2NDc5NTY0NTE3IDE3OTE4MDEzMTY0NTAyNDA=