-
-
Notifications
You must be signed in to change notification settings - Fork 840
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
fix(phpstan): adapt phpstan package for extension use #3727
Conversation
- fix "Stub file does not exist" error message as reported in <flarum/docs#441 (comment)> - fix "Ignored error pattern was not matched in reported errors" error messages as reported in <flarum/docs#441 (comment)>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
- "#Relation '[A-z_-]+' is not found in [A-z\_]+ model.#" | ||
- '#^Parameter \#1 \$query of method [A-z_<>\\]+\:\:union\(\) expects [A-z_<> .,|\\]+ given\.$#' | ||
- '#^Parameter \#1 \$query of method [A-z_<>\\]+\:\:joinSub\(\) expects [A-z_<> .,|\\]+ given\.$#' | ||
- message: "#Relation '[A-z_-]+' is not found in [A-z\_]+ model.#" | ||
reportUnmatched: false | ||
- message: '#^Parameter \#1 \$query of method [A-z_<>\\]+\:\:union\(\) expects [A-z_<> .,|\\]+ given\.$#' | ||
reportUnmatched: false | ||
- message: '#^Parameter \#1 \$query of method [A-z_<>\\]+\:\:joinSub\(\) expects [A-z_<> .,|\\]+ given\.$#' | ||
reportUnmatched: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than ignoring each error individually, let's use the global report unmatched parameter:
https://phpstan.org/user-guide/ignoring-errors#reporting-unused-ignores
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why I chose to ignore each of them instead of using the global parameter, is because I am not sure if it only affects the ignoreErrors
of the current file of if it sets it also for user defined ones. I for one, would like to keep it enabled globally, so that my own unmatched ignoreErrors
are still reported.
I will quickly check this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, by setting the parameter globally in this file, it also affects the ignoreErrors
defined in my own phpstan config file. So I would prefer to keep it as so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable!
messages as reported in Document PHPStan usage in extensions docs#441 (comment)