phpinspectionsea icon indicating copy to clipboard operation
phpinspectionsea copied to clipboard

FP: LongInheritanceChainInspection and 3rdparty class extends

Open andreasschroth opened this issue 5 years ago • 2 comments

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.

andreasschroth avatar Oct 16 '19 14:10 andreasschroth

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"?

kalessil avatar Nov 25 '19 09:11 kalessil

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.

andreasschroth avatar Nov 25 '19 19:11 andreasschroth