phpinspectionsea
phpinspectionsea copied to clipboard
Suggest use is_a when it possible
Subject | Details |
---|---|
Issue type | Feature request |
Plugin | Php Inspections EA Extended v3.0.10 |
Language level | PHP 7.2 |
Current behaviour (description/screenshot:)
if (!in_array(ResultItemSubscriber::class, class_implements($resultBuilder))) {
throw new \RuntimeException(sprintf('Result builder class "%s" should implements "%s" interface.', $resultBuilder, ResultItemSubscriber::class));
}
For now code suggests only add true
3rd argument to in_array
function.
Expected behaviour
Would be nice suggest (and provide hotfix for it) for replasing this kind of code with is_a
call.
Environment details
PhpStorm 2018.3.3
Build #PS-183.5153.36, built on January 9, 2019
Licensed to XXX
Subscription is active until November 13, 2019
JRE: 1.8.0_152-release-1343-b26 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-43-generic
Thank you for the proposal @Koc, I'll evaluate the case.
PS: it also possible to use instanceof
here.
Hi @kalessil , it seems that it's the same as one of the cases here: https://github.com/kalessil/phpinspectionsea/issues/1143#issuecomment-450931889
PS: it also possible to use instanceof here.
no, because in this context $resultBuilder
is FQCN, not an object.
@koc: understood, thank you =) @orklah: moving upper in my list =)
Marking as a bug, to catch my eye