[php-src] Issue #21284: php 8.5 ReflectionType->getName no longer returns "self"

From: Date: Tue, 24 Feb 2026 03:34:31 +0000
Subject: [php-src] Issue #21284: php 8.5 ReflectionType->getName no longer returns "self"
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251717@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/21284 Author: bkdotcom ### Description The following code: https://3v4l.org/5ACeW#v8.5.3 ```php <?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 ```plain 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

« previous php.bugs (#251717) next »