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

New Universal.Classes.Disallow/RequireAnonClassParentheses sniffs #76

Merged
merged 2 commits into from
Aug 2, 2020

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.

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.

1 participant