Closed hurtsky closed 2 years ago
Because CodeIgniter\Session\Session::$something
is not defined, so the PHPStan errors seem to be reasonable.
should not have error because it doesn't trigger any error before merging the new update
It is not true. If the checking of PHPStan gets more strict, a new error might be reported even if you don't change anything.
but @kenjis the use of session()->something
is documented on documentation. so it should not produce error, or documentation need an update?
PHPStan, as a static analyzer, has no way of telling that accessing the members of session()
will yield something. It will know that if it runs the code but running the code is not what static analysis do.
It is not a bug on the framework. It is just that PHPStan has no mechanism to check that. However, if we can somehow create a return type specifying extension for session()
, we can aide PHPStan in analysing the code.
PHP Version
8.1
CodeIgniter4 Version
develop
CodeIgniter4 Installation Method
Git
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
MariaDB 10.4
What happened?
after updating to latest daed3f82e090aa1f61e3f2f9fd9482054e35f9b1
im getting alot of error of
Access to an undefined property CodeIgniter\Session\Session::$something
. when running composer analyze , which did not happen before.it seem the error only produce if I try getting the session through the magic getter..
session()->something
, if usingsession()->get('something')
function phpstan not complaining anything.Steps to Reproduce
and run composer analyze
Expected Output
should not have error because it doesn't trigger any error before merging the new update
Anything else?
No response