Code Inspection: Parameter's name changed during inheritance

The inspection "Code Inspection: Parameter's name changed during inheritance" makes sense... if the parent method is not abstract .

Defining an interface, for instance, like

abstract protected function setEntity($entityID);

Then in the derived class

protected function setEntity($productID) { ...

since 'entity' is known to be a product. And that issues a warning in PS, and possibly an error in PHP 8 (?).
In PHP 8, maybe the PHP designers want us to create an intermediate method, like

protected function setEntity($entityID) {
$this->setProduct($entityID);
}

private function setProduct($productID) {
...
}

But, IMHO, this requirement should not exist for an originally 'abstract' method (which doesn't exist until defined later).

My question:
Is this a (tiny) issue in PS (2021.1.2) due to not taking into account the 'abstract' factor,
or will PHP 8 really flag an abstract method which parameter name changed?

NB: currently using PHP 7.2

 

0

You can share this in a comments to https://youtrack.jetbrains.com/issue/WI-58531 or even submit a separate report about this. We'll link it to  https://youtrack.jetbrains.com/issue/WI-58531 for a further discussion with development team

1

请先登录再写评论。