phpinspectionsea
phpinspectionsea copied to clipboard
FP: LongInheritanceChainInspection and 3rdparty class extends
Subject | Details |
---|---|
Plugin | Php Inspections (EA Ultimate), 3.0.4.2 |
Language level | PHP 7.3 |
Current behaviour
<?php
declare(strict_types=1);
final class Select extends \Zend\Db\Sql\Select
{
}
The code above leads to an error in the inspection "LongInheritanceChainInspection". The documentation says:
Note: the inspection is context aware and also takes into account Zend Framework 2+, PhpUnit and Yii 2+ specific.
Expected behaviour
I would suggest that the inspection "long inheritance chain" doesn't take into account if a class extends from a 3rdparty library as it's basically out of control of the developer. I admit it might not be a best practice to extend from a 3rdparty library class, but still I think it shouldn't be reported.
Thank you for reporting @andreasschroth. I'm understanding your point, except criteria for "3rd party library". Can you elaborate a little bit more what are you considering to be "3rd party library"?
Well, I guess the technical definition would be anything outside the current vendor namespace?
E.g. if the current vendor namespace is Demo
and the class extends from \Zend\Db\Sql\Select
, then Demo
!== Zend
, thus I'd consider it 3rdparty.