You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When "copying" a class through the static factory method ClassType::from(...), it appears that all parent interfaces are applied, not only the ones directly set on the class.
Steps To Reproduce
Create some class that implements interfaces
class Query implements \ArrayAccess, \Countable, \Iterator
{
# ...
}
Then create a ClassType instance through: $class = ClassType::from('MyClass');
Convert it to a string and take a closer look on the result:
The instance of ClassType should be exactly the same as the original one.
Instead, it implements the parental interface Traversable which then leads to an E_COMPILE_ERROR, due to the interface beeing implemented twice:
Class Melior\Database\Query\Query cannot implement previously implemented interface Traversable
Possible Solution
I don't got any handy solution on this, but it seems as ReflectionClass doesn't care about whether something has been defined directly in the class or has been inherited from parents.
So gathering the interfaces from the ReflectionClass results in all interfaces and their parents, not just the ones directly named behind implements.
The text was updated successfully, but these errors were encountered:
Version: v3.1.2
Bug Description
When "copying" a class through the static factory method
ClassType::from(...)
, it appears that all parent interfaces are applied, not only the ones directly set on the class.Steps To Reproduce
ClassType
instance through:$class = ClassType::from('MyClass');
Expected Behavior
The instance of
ClassType
should be exactly the same as the original one.Instead, it implements the parental interface
Traversable
which then leads to anE_COMPILE_ERROR
, due to the interface beeing implemented twice:Possible Solution
I don't got any handy solution on this, but it seems as ReflectionClass doesn't care about whether something has been defined directly in the class or has been inherited from parents.
So gathering the interfaces from the ReflectionClass results in all interfaces and their parents, not just the ones directly named behind
implements
.The text was updated successfully, but these errors were encountered: