Skip to content

[TASK] Drop allowing Rule to be passed to RuleSet::getRules() #1253

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

Merged
merged 1 commit into from
May 6, 2025

Conversation

JakeQZ
Copy link
Collaborator

@JakeQZ JakeQZ commented May 5, 2025

... and getRulesAssoc().

Relates to #1247.

@JakeQZ JakeQZ requested review from sabberworm and oliverklee May 5, 2025 21:56
@JakeQZ JakeQZ self-assigned this May 5, 2025
@JakeQZ JakeQZ added cleanup removal A method, property, or some functionality has been removed. labels May 5, 2025
@coveralls
Copy link

coveralls commented May 5, 2025

Coverage Status

coverage: 56.91% (+0.008%) from 56.902%
when pulling 383a4d2 on task/getrules-parameter
into 807a11b on main.

@JakeQZ
Copy link
Collaborator Author

JakeQZ commented May 5, 2025

Curiously, the PHPStan warning "Parameters should have "string" types as the only types passed to this method" is only generated for removeRule(), despite all three methods having Rule|string|null as the parameter type. Maybe remove in the method name has some special significance (as part of CRUD pattern) which makes it stricter.

@JakeQZ JakeQZ force-pushed the task/getrules-parameter branch from d16a434 to 383a4d2 Compare May 5, 2025 22:11
@JakeQZ
Copy link
Collaborator Author

JakeQZ commented May 5, 2025

Curiously, the PHPStan warning "Parameters should have "string" types as the only types passed to this method" is only generated for removeRule(), despite all three methods having Rule|string|null as the parameter type. Maybe remove in the method name has some special significance (as part of CRUD pattern) which makes it stricter.

I figured out what's going on. Even after changing removeRule() to only accept Rule, PHPStan still gave the warning against the method. This turns out to be because some tests were still calling the method with string arguments. I think PHPStan could do better with its reporting, and include the source of the problem. Only when I ran the unit tests separately did it become clear, as there were then errors due to incorrect parameter types.

@oliverklee oliverklee merged commit 9706931 into main May 6, 2025
21 checks passed
@oliverklee oliverklee deleted the task/getrules-parameter branch May 6, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup removal A method, property, or some functionality has been removed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants