Bug #80097 [PATCH]: ReflectionAttribute is not a Reflector

From: Date: Sat, 14 Nov 2020 21:17:04 +0000
Subject: Bug #80097 [PATCH]: ReflectionAttribute is not a Reflector
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230355@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80097&edit=1 ID: 80097 Patch added by: carusogabriel@php.net Reported by: me at derrabus dot de Summary: ReflectionAttribute is not a Reflector Status: Assigned Type: Bug Package: Reflection related Operating System: any PHP Version: 8.0.0beta3 Assigned To: beberlei Block user comment: N Private report: N New Comment: The following pull request has been associated: Patch Name: Bugfix 80097: Have ReflectionAttribute implement Reflector, __toString On GitHub: https://github.com/php/php-src/pull/6117 Patch: https://github.com/php/php-src/pull/6117.patch Previous Comments: ------------------------------------------------------------------------ [2020-09-12 15:06:14] me at derrabus dot de Description: ------------ The new ReflectionAttribute class does not implement the Reflector interface. This is not really a big problem, but feels inconsistent and somewhat unintended. Test script: --------------- <?php $classes = [ 'ReflectionClass', 'ReflectionClassConstant', 'ReflectionZendExtension', 'ReflectionExtension', 'ReflectionFunction', 'ReflectionFunctionAbstract', 'ReflectionMethod', 'ReflectionNamedType', 'ReflectionObject', 'ReflectionParameter', 'ReflectionProperty', 'ReflectionType', 'ReflectionAttribute', ]; foreach ($classes as $class) { $isReflector = class_implements($class, 'Reflector') ? 'yes' : 'no'; $class = str_pad($class, 30); echo "$class$isReflector\n"; } Expected result: ---------------- ReflectionClass yes ReflectionClassConstant yes ReflectionZendExtension yes ReflectionExtension yes ReflectionFunction yes ReflectionFunctionAbstract yes ReflectionMethod yes ReflectionNamedType yes ReflectionObject yes ReflectionParameter yes ReflectionProperty yes ReflectionType yes ReflectionAttribute yes Actual result: -------------- ReflectionClass yes ReflectionClassConstant yes ReflectionZendExtension yes ReflectionExtension yes ReflectionFunction yes ReflectionFunctionAbstract yes ReflectionMethod yes ReflectionNamedType yes ReflectionObject yes ReflectionParameter yes ReflectionProperty yes ReflectionType yes ReflectionAttribute no ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80097&edit=1

« previous php.bugs (#230355) next »