Skip to content

AddOverrideAttributeToOverriddenMethodsRector does not add attribute to overriden interface methods #9699

@hockdudu

Description

@hockdudu

Bug Report

Subject Details
Rector version 2.3.9

Rector does not add the #[\Override] attribute to methods that implement an interface anymore. This worked until Rector 2.3.1, but stopped working at 2.3.2.

I was able to pinpoint the issue to a specific commit (rectorphp/rector-src@cb73a3a#diff-deb1504f632c91138aff129b8a830b448e34c2da62fa77a63171317104e969b1R140-R143). Here, skipping all interfaces but \Stringable seems intentional.

Is this a new intended behavior? Could this be made configurable?

As we also use Psalm on our projects, Rector not adding the attributes is leading to https://psalm.dev/358.

Minimal PHP Code Causing Issue

https://getrector.com/demo/e3e3c9e1-de63-4f4a-bce9-cac275474a6d

Expected Behaviour

Rector should add the #[\Override] attribute to methods that implement an interface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions