Skip to content
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

(PhpStan) fix analyzer level = 1 issues #14

Merged
merged 6 commits into from
Dec 12, 2023
Merged

Conversation

alchalade
Copy link
Contributor

This MR fixes the issues which are listed by phpstan.level 1. The goal is reach level 8 but that would be a long journey.

level1: possibly undefined variables, unknown magic methods and properties on classes with __call and __get

output for level 8
image

For more details abou the rule levels : https://phpstan.org/user-guide/rule-levels

@alchalade alchalade force-pushed the improve-code-quality branch 2 times, most recently from aa4817e to 88e7c69 Compare December 1, 2023 19:41
@dmohns
Copy link
Member

dmohns commented Dec 4, 2023

Hey @alchalade if I understand correctly, after this PR, if we run phpstan with rule level 1 over the code base no warnings will be raised? If you, could you also add a small Github Actions that does exactly this?

@alchalade
Copy link
Contributor Author

@dmohns I think this phpstan.level=1 check is already in a gitaction. Please check the laravel-lint action. Its one of the steps. For now it will catch us but won't block the PR.

After this one is merged, I will increase the level to 5 and try to address those issues. But for now level 1 should already run on new code and all reported issues should be addressed.

@alchalade alchalade force-pushed the improve-code-quality branch from 828db5f to bed4b29 Compare December 4, 2023 08:53
@dmohns
Copy link
Member

dmohns commented Dec 7, 2023

@dmohns I think this phpstan.level=1 check is already in a gitaction. Please check the laravel-lint action. Its one of the steps. For now it will catch us but won't block the PR.

After this one is merged, I will increase the level to 5 and try to address those issues. But for now level 1 should already run on new code and all reported issues should be addressed.

Ohh, I see. So, we "could" remove the continue-on-error: true from the PHP Lint action as part of this PR. But totally fine to do it in a different PR as well.

dmohns
dmohns previously approved these changes Dec 7, 2023
@alchalade alchalade force-pushed the improve-code-quality branch 2 times, most recently from c53946c to ddd801e Compare December 7, 2023 20:55
@alchalade alchalade force-pushed the improve-code-quality branch from ddd801e to 4dff18d Compare December 7, 2023 20:57
dmohns
dmohns previously approved these changes Dec 11, 2023
Copy link
Member

@dmohns dmohns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :shipit:

@alchalade alchalade enabled auto-merge (squash) December 12, 2023 03:03
@alchalade alchalade disabled auto-merge December 12, 2023 03:04
@alchalade alchalade merged commit 3354585 into main Dec 12, 2023
7 of 8 checks passed
@alchalade alchalade deleted the improve-code-quality branch December 12, 2023 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants