📁 File Manager Pro
v10.0.3 | PHP: 8.2.31
Server: LiteSpeed
2026-07-03 14:38:20
📂
/ (Root)
/
home
/
orkouolp
/
web
/
testing.orkobd
/
laravel
/
vendor
/
nette
/
utils
/
tests
/
Utils
📍 /home/orkouolp/web/testing.orkobd/laravel/vendor/nette/utils/tests/Utils
🔄 Refresh
✏️
Editing: Type.fromReflection.method.phpt
Writable
<?php declare(strict_types=1); use Nette\Utils\Type; use Tester\Assert; require __DIR__ . '/../bootstrap.php'; $type = Type::fromReflection((new ReflectionObject(new class { public function foo(): string { } }))->getMethod('foo')); Assert::same(['string'], $type->getNames()); Assert::same('string', (string) $type); $type = Type::fromReflection((new ReflectionObject(new class { public function foo(): ?string { } }))->getMethod('foo')); Assert::same(['string', 'null'], $type->getNames()); Assert::same('?string', (string) $type); $class = new class { public function foo(): self { } }; $type = Type::fromReflection((new ReflectionObject($class))->getMethod('foo')); Assert::same([$class::class], $type->getNames()); Assert::same($class::class, (string) $type); class ParentClass { public function foo(): static { } } class ChildClass extends ParentClass { } $type = Type::fromReflection(new Nette\Utils\ReflectionMethod(ChildClass::class, 'foo')); Assert::same([ChildClass::class], $type->getNames()); Assert::same(ChildClass::class, (string) $type);
💾 Save Changes
❌ Cancel