You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do vendor/bin/phan --init --init-no-composer --init-analyze-file=test.php
Run vendor/bin/phan
Expected results
No issues reported, successful exit code.
Actual results
test.php:7 PhanUndeclaredConstant Reference to undeclared constant \SOME_CONSTANT. This will cause a thrown Error in php 8.0+.
Other notes
In the production case where I encountered this, the class and constant are in separate files, with the constant's file being processed after the class's. Switching the processing order of the two files makes the bug go away.
The @var phpdoc is required, the bug doesn't reproduce without it.
Despite the message, PHP 8.3 throws no errors when executing this test code, nor when instantiating the class defined by this code. It seems PHP doesn't try to resolve the constant until the first time the class is instantiated or a static member is accessed.
The text was updated successfully, but these errors were encountered:
Phan version: 5.4.3, v5.x-dev 790e4f7
Reproduction
vendor/bin/phan --init --init-no-composer --init-analyze-file=test.php
vendor/bin/phan
Expected results
No issues reported, successful exit code.
Actual results
Other notes
In the production case where I encountered this, the class and constant are in separate files, with the constant's file being processed after the class's. Switching the processing order of the two files makes the bug go away.
The
@var
phpdoc is required, the bug doesn't reproduce without it.Despite the message, PHP 8.3 throws no errors when executing this test code, nor when instantiating the class defined by this code. It seems PHP doesn't try to resolve the constant until the first time the class is instantiated or a static member is accessed.
The text was updated successfully, but these errors were encountered: