php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80097 ReflectionAttribute is not a Reflector
Submitted: 2020-09-12 15:06 UTC Modified: 2020-09-12 15:24 UTC
From: me at derrabus dot de Assigned: beberlei (profile)
Status: Assigned Package: Reflection related
PHP Version: 8.0.0beta3 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: me at derrabus dot de
New email:
PHP Version: OS:

 

 [2020-09-12 15:06 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-12 15:24 UTC] beberlei@php.net
-Assigned To: +Assigned To: beberlei
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 30 06:01:28 2020 UTC