58 $parameterName = $reflection->getName();
60 if ($reflection->isPassedByReference()) {
64 if ($reflection->isVariadic()) {
68 if ($reflection->isOptional()) {
73 $typeReflection = $reflection->getType();
75 if ($typeReflection instanceof \ReflectionNamedType) {
76 $typeName = $typeReflection->getName();
78 if ($typeReflection->allowsNull()) {
81 } elseif ($typeReflection !==
null) {
82 throw new \LogicException(
"Unsupported reflection type " . get_class($typeReflection));
85 return new self($parameterName, $typeName, $flags);
93 public function __construct($parameterName, $typeName =
null, $flags = self::CONTRAVARIANT)
97 parent::__construct($typeName, $flags, ($flags & self::COVARIANT) !== 0, ($flags & self::CONTRAVARIANT) !== 0);
99 $this->parameterName = (string)$parameterName;
100 $this->isOptional = (bool)($flags & self::OPTIONAL);
101 $this->isVariadic = (bool)($flags & self::VARIADIC);