Skip to content

Do not mutate function signature of inherited methods #63

@maks-rafalko

Description

@maks-rafalko

There is no need to mutate public to protected for methods from the implemented interface.

interface Doable
{
    public function do(): void;
}

class Foo implements Doable
{
    public function do(): void {}
}

Incorrect mutation:

class Foo implements Doable
{
-    public function do(): void {}
+    protected function do(): void {}
}

Expected result: no mutation, because it always leads to Fatal error: Access level to Foo::do() must be public (as in class Doable)...


At this point, we don't have information about parent classes/interfaces. It requires implementing a new smart feature with native reflection or BetterReflection.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions