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

Tools/BrainMonkeyRaceCondition: various improvements #336

Merged

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Nov 4, 2023

Tools/BrainMonkeyRaceCondition: simplify/use PHPCSUtils in more places

Tools/BrainMonkeyRaceCondition: decouple from WPCS sniff

.... as extending the WPCS sniff is now no longer needed, as the utility functions we used from that sniff before, have all been replaced with utilities from PHPCSUtils.

Tools/BrainMonkeyRaceCondition: add tests with PHP 8.0+ named parameters

The commit in PR #322 in which the function call retrieving the parameter was changed from the WPCS method to the PHPCSUtils method already added support for this.

This commit just adds some tests to safeguard it.

Tools/BrainMonkeyRaceCondition: minor tweak

As we're only looking for a method in a class, this condition will never happen under normal circumstances, not even in case of live coding as the function declaration would not be recognized as a method in that case, so the sniff would bow out before reaching this condition.

All the same, there's always to possibility that this could happen if PHP adds some new syntax and the PHPCS tokenizer does not support it yet or if there is another Tokenizer issue, so I'm keeping the condition, but marking it as fine to ignore for code coverage.

.... as extending the WPCS sniff is now no longer needed, as the utility functions we used from that sniff before, have all been replaced with utilities from PHPCSUtils.
The commit in PR 322 in which the function call retrieving the parameter was changed from the WPCS method to the PHPCSUtils method already added support for this.

This commit just adds some tests to safeguard it.
As we're only looking for a _method_ in a _class_, this condition will never happen under normal circumstances, not even in case of live coding as the function declaration would not be recognized as a _method_ in that case, so the sniff would bow out before reaching this condition.

All the same, there's always to possibility that this could happen if PHP adds some new syntax and the PHPCS tokenizer does not support it yet or if there is another Tokenizer issue, so I'm keeping the condition, but marking it as fine to ignore for code coverage.
@coveralls
Copy link

Coverage Status

coverage: 98.491% (+0.09%) from 98.406%
when pulling 4731693 on JRF/yoastcs-brainmonkeyracecondition-various-improvements
into 5fbd039 on develop.

@jrfnl jrfnl merged commit fe36bf6 into develop Nov 4, 2023
26 checks passed
@jrfnl jrfnl deleted the JRF/yoastcs-brainmonkeyracecondition-various-improvements branch November 4, 2023 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants