Skip to content

UnusedPrivateElements don't detect calls on clones #642

@amorimjuliana

Description

@amorimjuliana

I'm using the sniff SlevomatCodingStandard.Classes.UnusedPrivateElements and I've noticed that it cannot identify private method calls on clones.

Example:

public function foo() : void
{
    $clone = clone $this;
    $clone->writeFoo();
}

private function writeFoo() : void
{
}

public function bar() : void
{
    $this->writeBar();
}

private function writeBar() : void
{
}

Output:

ERROR | Class FooBar contains unused private method writeFoo().

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