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

Universal/DisallowAlternativeSyntax: various tweaks #158

Merged
merged 4 commits into from
Nov 14, 2022

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Nov 14, 2022

Universal/DisallowAlternativeSyntax: improve test code

While empty "leafs" of control structures is allowed, it is less common, so make the code used for the tests more realistic.

Includes improvements to the inline documentation in the test code file to make it clearer what is being tested.

Universal/DisallowAlternativeSyntax: add additional tests with empty control structure bodies

When a control structure condition is directly followed by a PHP close tag, a semicolon is silently inserted by PHP and the control structure will turn into a control structure without body.

This commit adds additional tests to safeguard that the sniff handles this correctly.

Universal/DisallowAlternativeSyntax: minor docs improvements

Universal/DisallowAlternativeSyntax: improve metrics

  • Minor tweak to the metric name.
  • Also record metric for single line/no body control structures.

While empty "leafs" of control structures is allowed, it is less common, so make the code used for the tests more realistic.

Includes improvements to the inline documentation in the test code file to make it clearer what is being tested.
…control structure bodies

When a control structure condition is directly followed by a PHP close tag, a semicolon is silently inserted by PHP and the control structure will turn into a control structure without body.

This commit adds additional tests to safeguard that the sniff handles this correctly.
* Minor tweak to the metric name.
* Also record metric for single line/no body control structures.
@jrfnl jrfnl added this to the 1.0.0-alpha4 milestone Nov 14, 2022
@jrfnl jrfnl merged commit 0448f4f into develop Nov 14, 2022
@jrfnl jrfnl deleted the universal/disallowalternativesyntax-various-tweaks branch November 14, 2022 00: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.

1 participant