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

Whitespace/ControlStructureSpacing: sync with upstream + minor tweaks #2333

Merged
merged 6 commits into from
Aug 14, 2023

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 14, 2023

This sniff hasn't had an extensive review as it realistically shouldn't exist - see #2332. It has been made compatible with modern PHP without a deep dive into whether what it is doing is correct in other ways.


Whitespace/ControlStructureSpacing: sync with upstream [1]

Add metrics for blank line at start/end of control structure as per squizlabs/PHP_CodeSniffer@4fc2515 (PHPCS 2.5.1).

Whitespace/ControlStructureSpacing: sync with upstream [2]

Check the spacing after the finally keyword as per squizlabs/PHP_CodeSniffer@eefb31c (PHPCS 3.2.3).

Handled in a slightly different way as upstream as the sniffs have diverged, but this should work for the most part (aside from pre-existing issues in the sniff anyway).

Whitespace/ControlStructureSpacing: sync with upstream [3]

Check the spacing for match control structures as per squizlabs/PHP_CodeSniffer@549899b (PHPCS 3.6.0).

Whitespace/ControlStructureSpacing: sync with upstream [4]

Ignore blank line/spacing rules when the next thing (inside/outside) is an enum as per squizlabs/PHP_CodeSniffer@7f11ffc and squizlabs/PHP_CodeSniffer@b71b470 (PHPCS 3.7.0).

WhiteSpace/ControlStructureSpacing: implement PHPCSUtils

Minor code simplifications by using PHPCSUtils.

WhiteSpace/ControlStructureSpacing: fix/update class docblock

Last update date is based on the last upstream commit to this sniff.

Add metrics for blank line at start/end of control structure as per squizlabs/PHP_CodeSniffer@4fc2515 (PHPCS 2.5.1).
Check the spacing after the `finally` keyword as per squizlabs/PHP_CodeSniffer@eefb31c (PHPCS 3.2.3).

Handled in a slightly different way as upstream as the sniffs have diverged, but this should work for the most part (aside from pre-existing issues in the sniff anyway).
Check the spacing for `match` control structures as per squizlabs/PHP_CodeSniffer@549899b (PHPCS 3.6.0).
Ignore blank line/spacing rules when the next thing (inside/outside) is an enum as per squizlabs/PHP_CodeSniffer@7f11ffc and squizlabs/PHP_CodeSniffer@b71b470 (PHPCS 3.7.0).
Minor code simplifications by using PHPCSUtils.
Last update date is based on the last upstream commit to this sniff.
@dingo-d dingo-d merged commit 2d7f396 into develop Aug 14, 2023
35 checks passed
@dingo-d dingo-d deleted the feature/controlstructurespacing-sync-with-upstream branch August 14, 2023 07:46
@jrfnl jrfnl mentioned this pull request Aug 14, 2023
19 tasks
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.

None yet

3 participants