Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(phpstan): adapt phpstan package for extension use #3727

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

n-peugnet
Copy link
Contributor

- 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)>
@n-peugnet n-peugnet requested a review from a team as a code owner February 7, 2023 15:11
Copy link
Member

@SychO9 SychO9 left a 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!

Comment on lines -4 to +9
- "#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
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

@n-peugnet n-peugnet Feb 7, 2023

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.

Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

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

Sounds reasonable!

@SychO9 SychO9 merged commit f9a5d48 into flarum:main Feb 8, 2023
@SychO9 SychO9 changed the title Fix flarum/phpstan package when installed with composer fix(phpstan): adapt phpstan package for extension use Feb 8, 2023
@luceos luceos mentioned this pull request Mar 2, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants