False positive: PHP S1185 Overriding methods should do more than simply call the same method in the

Inspection S1185 for PHP (Overriding methods should do more than simply call the same method in super class) generates false positive when the child only changes visibility in the signature.

Example:

class A
{
    public function __construct()
    {
        // some code
    }
}

class B extends A
{
    private function __construct()
    {
        parent::__construct();
    }

    public static function factoryMethod(): self {
        // do something
        return new self();
    }
}

Hi @13dagger ,
Welcome to the community and thanks for this report!

You are correct, this is a false positive and we should not raise an issue. I’ve created a ticket to fix this issue, which will be tackled in the next development iteration of the PHP Analyzer.

Thanks for the contribution,
Jonas

1 Like