Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 2, 2020

This adds two new sniffs:

  • Universal.Classes.DisallowAnonClassParentheses to disallow the use of parentheses when declaring an anonymous class without passing parameters.
  • Universal.Classes.RequireAnonClassParentheses to require the use of parentheses when declaring an anonymous class whether parameters are passed or not.

PSR12 has no opinion on whether or not anonymous class declarations without parameters should have parentheses, so parentheses for an anonymous class are not enforced, nor forbidden by the PSR12.Classes.ClassInstantiation sniff.

These two sniffs allow for a consistent codebase regarding anonymous class parentheses, whether you choose to enforce them or forbid them.

Includes fixer.
Includes unit tests.
Includes documentation.
Includes metrics.

jrfnl added 2 commits August 2, 2020 18:53
Sniff to disallow the use of parentheses when declaring an anonymous class without passing parameters.

PSR12 has no opinion on whether or not anonymous class declarations without parameters should have parentheses, so parentheses for an anonymous class are not enforced, nor forbidden by the `PSR12.Classes.ClassInstantiation` sniff.

This sniff and its sister-sniff `Universal.Classes.RequireAnonClassParentheses`, allow for a consistent codebase regarding anonymous class parentheses, whether you choose to enforce them or forbid them.

Includes fixer.
Includes unit tests.
Includes documentation.
Includes metrics.
Sniff to require the use of parentheses when declaring an anonymous class whether parameters are passed or not.

PSR12 has no opinion on whether or not anonymous class declarations without parameters should have parentheses, so parentheses for an anonymous class are not enforced, nor forbidden by the `PSR12.Classes.ClassInstantiation` sniff.

This sniff and its sister-sniff `Universal.Classes.DisallowAnonClassParentheses`, allow for a consistent codebase regarding anonymous class parentheses, whether you choose to enforce them or forbid them.

Includes fixer.
Includes unit tests.
Includes documentation.
Includes metrics.
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