<?php //declare(strict_types = 1); interface FooIface{} class FooClass{} function fooNullable(?string $a,?int $b, ?float $c, ?bool $d, ?FooIface $e, ?FooClass $g) : ?int {} function foo ( string $a, int $b, float $c, bool $d, FooIface $e, FooClass $g) : int {} function printTypes(string $fn) { $reflectionFunction = new \ReflectionFunction($fn); $functionParameters = $reflectionFunction->getParameters(); foreach ($functionParameters as $parameter) { var_dump($parameter->getType()->__toString()); } echo "return:"; var_dump($reflectionFunction->getReturnType()->__toString()); return; } echo " ---not nullable--- "; printTypes('foo'); echo " --nullable-- "; printTypes('fooNullable');
You have javascript disabled. You will not be able to edit any code.