Bug #80097 [Asn->Csd]: ReflectionAttribute is not a Reflector

From: Date: Wed, 07 Jul 2021 10:42:21 +0000
Subject: Bug #80097 [Asn->Csd]: ReflectionAttribute is not a Reflector
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234856@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
 Updated by:         git@php.net
 Reported by:        me at derrabus dot de
 Summary:            ReflectionAttribute is not a Reflector
-Status:             Assigned
+Status:             Closed
 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:

Automatic comment on behalf of beberlei (author) and nikic (committer)
Revision: https://github.com/php/php-src/commit/bc39abe8c3c492e29bc5d60ca58442040bbf063b
Log: Fix #80097: Have ReflectionAttribute implement Reflector and __toString


Previous Comments:
------------------------------------------------------------------------
[2020-11-14 21:17:04] carusogabriel@php.net

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

------------------------------------------------------------------------
[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


Thread (3 messages)

« previous php.bugs (#234856) next »