Skip to content

Add additional Universal sniffs to ruleset#54

Merged
dereuromark merged 2 commits intomasterfrom
feature/universal-sniffs
Apr 10, 2026
Merged

Add additional Universal sniffs to ruleset#54
dereuromark merged 2 commits intomasterfrom
feature/universal-sniffs

Conversation

@dereuromark
Copy link
Copy Markdown
Contributor

Summary

Adopts five PHPCSExtra Universal sniffs that are not yet covered by our ruleset (nor by any existing Slevomat/Generic/PSR rule we currently reference):

  • Universal.CodeAnalysis.NoEchoSprintf — recommends `printf()` over `echo sprintf()`
  • Universal.CodeAnalysis.ConstructorDestructorReturn — disallows return types / discourages return values in constructors/destructors
  • Universal.CodeAnalysis.ForeachUniqueAssignment — detects foreach loops using identical variables for key and value
  • Universal.CodeAnalysis.StaticInFinalClass — flags unnecessary `static` in final classes
  • `Universal.Operators.TypeSeparatorSpacing` — spacing around `|` / `&` in union/intersection types

Related to #53.

`composer cs-check`, `composer test`, and `composer stan` all pass locally.

Adopt PHPCSExtra Universal sniffs that are not yet covered:

- Universal.CodeAnalysis.NoEchoSprintf
- Universal.CodeAnalysis.ConstructorDestructorReturn
- Universal.CodeAnalysis.ForeachUniqueAssignment
- Universal.CodeAnalysis.StaticInFinalClass
- Universal.Operators.TypeSeparatorSpacing
@dereuromark dereuromark merged commit 11dca77 into master Apr 10, 2026
4 checks passed
@dereuromark dereuromark deleted the feature/universal-sniffs branch April 10, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant