1<?php declare(strict_types = 1);
3namespace DaveRandom\CallbackValidator;
25 if ($reflection->returnsReference()) {
30 $typeReflection = $reflection->getReturnType();
32 if ($typeReflection instanceof \ReflectionNamedType) {
33 $typeName = $typeReflection->getName();
35 if ($typeReflection->allowsNull()) {
38 } elseif ($typeReflection !==
null) {
39 throw new \LogicException(
"Unsupported reflection type " . get_class($typeReflection));
42 return new self($typeName, $flags);
49 public function __construct($typeName =
null, $flags = self::COVARIANT)
53 parent::__construct($typeName, $flags, ($flags & self::COVARIANT) !== 0, ($flags & self::CONTRAVARIANT) !== 0);
61 return $this->isNullable && $this->typeName !==
null
62 ?
'?' . $this->typeName
63 : (string)$this->typeName;
__construct($typeName=null, $flags=self::COVARIANT)
static createFromReflectionFunctionAbstract($reflection, $flags=0)