Bug #80153 [NEW]: Self return type and ReflectionClass->getReturnType

From: Date: Sat, 26 Sep 2020 11:46:19 +0000
Subject: Bug #80153 [NEW]: Self return type and ReflectionClass->getReturnType
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229224@lists.php.net to get a copy of this message
From: spychala dot adam at gmail dot com Operating system: Ubuntu PHP version: 7.4.10 Package: Class/Object related Bug Type: Bug Bug description:Self return type and ReflectionClass->getReturnType Description: ------------ There is question on SO regarding return type of class methods which has 'self' return type https://stackoverflow.com/questions/64073093/how-to-get-return-type-of-a-class-method-in-php I think it should return corresponding return type, not self (or in the future static type). Test script: --------------- interface A { public function getSomething(): self; } class B implements A { public function getSomething(): self { return $this; } } print((new ReflectionClass(new B()))->getMethod('getSomething')->getReturnType()); Expected result: ---------------- A Actual result: -------------- self -- Edit bug report at https://bugs.php.net/bug.php?id=80153&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80153&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80153&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80153&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80153&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80153&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80153&r=support Expected behavior: https://bugs.php.net/fix.php?id=80153&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80153&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80153&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80153&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80153&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80153&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80153&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80153&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80153&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80153&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80153&r=mysqlcfg

« previous php.bugs (#229224) next »