DaveLiddament / php-language-extensions

Attributes to define new PHP language features (that are enforced by static analysis)
MIT License
135 stars 5 forks source link

Feature request: Override #20

Closed priyadi closed 1 year ago

priyadi commented 1 year ago

Like Java's override: a method with #[Override] must override a method in the parent class, or implements a method of an interface.

DaveLiddament commented 1 year ago

Love the suggestion. This is actually coming to PHP in 8.3 as a native language feature. https://wiki.php.net/rfc/marking_overriden_methods

I'd image the static analysis tools will support this once released.

In the mean time I will add a simple version (that does not take into account traits)

DaveLiddament commented 1 year ago

Added in #22