-
-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CachedAspectLoader::load() does not comply with \Go\Core\AspectLoader::load() signature #471
Comments
Hmmm? Which version of framework do you use? Also, framework/src/Core/AspectLoader.php Line 71 in 596fcae
Regarding static analysis: this project uses PhpStan now, every single PR is analysed, see https://github.com/goaop/framework/blob/master/phpstan.neon |
Hey @lisachenko, I am using 2.3.4, but this is still present in the master. Even though there are return type hints in the doc block and a return type defined, the code does not comply with those: https://github.com/goaop/framework/blob/master/src/Core/CachedAspectLoader.php#L104-L105 Both I know that this is probably not supposed to happen, but with filesystems becoming unavailable or files getting corrupted, because processes are killed mid-writing, I would say, that it is possible that cases like these occur. I think the decision here is: Is an invalid cache a problem that goaop WANTS to handle, or do we simply crash? It is great that you are using phpstan :) I found sooooo many bugs with it already, that I wonder how I could ever live without static code analysis 🤷 :D |
@func0der Checked your comment - could you please send a PR with additional guard/exception to ensure that no false was returned from both |
The method called in
framework/src/Core/CachedAspectLoader.php
Line 66 in 596fcae
can result in
false
, which is then returned.\Go\Core\AspectLoader::load()
and their respective implementations are not supposed to returnfalse
, but onlyarray
s.Simple fix is to not just put the return value in
$loadedItems
.An idea to prevent such problems in the future could be static code analysis.
The text was updated successfully, but these errors were encountered: