Skip to content

Issue with the order of used inherited traits since 8.3.8/8.2.20 #14495

@lernhart

Description

@lernhart

Description

The following code:
https://3v4l.org/lFFsD

Resulted in this output:

Fatal error: Uncaught Error: Call to protected method ParentClass::doSomething() from scope ChildClass in /in/lFFsD:25
Stack trace:
#0 /in/lFFsD(29): ChildClass->__construct()
#1 {main}
  thrown in /in/lFFsD on line 25

Process exited with code 255.

But I expected this output instead:

FOO (result of method of parent trait)

The order of the used traits does matter since 8.3.8 and 8.2.20.
As seen in the 3v4l example, the trait TraitA, which implements the method is used after the TraitB, which declares the abstract method.

The order of the traits does not matter, if the child class directly uses the traits.

This commit may relate to the issue ?

PHP Version

8.3.8

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions