Skip to content

Allow declaring abstract final methods or classes to allow interface/abstract class providers to enforce exactly one non-abstract child implementation #18118

@stepo2

Description

@stepo2

Description

I always wondered why PHP does not allow abstract final methods or classes. This way an interface or an abstract class could enforce that only the first non-abstract child class in the hierarchy must implement the class or the method body, preventing further inheritance of the class/method.

Of course, the implementor of the first non-abstract class/method can optionally mark the first implementation as final already if he likes. But the interface/abstract provider currently can not enforce this, however. If it is optionally implementable from the concrete child perspective it should also be optionally enforcable from the abstract parent perspective.

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