Fix false positives about unreferenced class elements in subclasses for static:: (constants, methods, properties) #3803
Labels
enhancement
This improves the quality of Phan's analysis of a codebase
Reported on gitter today
Expected: PhanUndeclaredConstantOfClass is emitted, because
(new A())->foo()
(and so on) can be called.Observed: PhanUnreferencedProtectedClassConstant and PhanUndeclaredConstantOfClass is emitted
This is causing
PhanUnreferencedProtectedClassConstant
for B::SOME_CONST. Shouldn't phan be able to see the usage in A? using 2.5.0 (and 2.6.1-dev)Currently, Phan can't track this reference, because it only tracks references to elements that exist
Phan could track references to properties, methods, and class constants that don't exist separately from those that do exist, so that the reference to
static::SOME_CONST
,static::$some_prop
, andstatic::someMethod()
can be properly recorded.Note that Phan already warns about the constant not existing in the base class
The text was updated successfully, but these errors were encountered: