Bug #78697 [PATCH]: ReflectionClass::implementsInterface - inaccurate error message with traits
Edit report at https://bugs.php.net/bug.php?id=78697&edit=1
ID: 78697
Patch added by: villfa@php.net
Reported by: villfa@php.net
Summary: ReflectionClass::implementsInterface - inaccurate
error message with traits
Status: Open
Type: Bug
Package: Reflection related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix bug #78697: inaccurate error message
On GitHub: https://github.com/php/php-src/pull/4834
Patch: https://github.com/php/php-src/pull/4834.patch
Previous Comments:
------------------------------------------------------------------------
[2019-10-19 19:35:07] villfa@php.net
Description:
------------
When ReflectionClass::implementsInterface receives a trait as a parameter the message of the thrown
exception says that the trait is a class.
Test script:
---------------
<?php
trait T {}
try {
(new ReflectionClass(new stdClass))->implementsInterface(T::class);
} catch (ReflectionException $e) {
echo $e->getMessage();
}
Expected result:
----------------
T is not an interface
Actual result:
--------------
Interface T is a Class
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78697&edit=1
Thread (3 messages)