-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed as not planned
Labels
Description
Description
The following code:
<?php
class Bar
{
}
class Foo extends Bar
{
function getSelf (self $a): self
{
}
function getStatic (): static
{
}
}
$refMethodSelf = new ReflectionMethod('Foo', 'getSelf');
$refMethodStatic = new ReflectionMethod('Foo', 'getStatic');
$refParam = $refMethodSelf->getParameters()[0];
print_r(array(
'paramType' => $refParam->getType()->getName(),
'returnTypeSelf' => $refMethodSelf->getReturnType()->getName(),
'returnTypeStatic' => $refMethodStatic->getReturnType()->getName(),
));Resulted in this output:
Array
(
[paramType] => Foo
[returnTypeSelf] => Foo
[returnTypeStatic] => static
)
But I expected this output instead:
Array
(
[paramType] => self
[returnTypeSelf] => self
[returnTypeStatic] => static
)
PHP Version
PHP 8.5.3 (cli) (built: Feb 10 2026 18:25:51) (NTS)
Copyright (c) The PHP Group
Built by Shivam Mathur
Zend Engine v4.5.3, Copyright (c) Zend Technologies
with Zend OPcache v8.5.3, Copyright (c), by Zend Technologies
Operating System
MacOS 15.7.4
Reactions are currently unavailable