You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "Namespace declarations should have exactly one blank line before the declaration and at least one blank line after" will probably also need a new sniff.
My research shows the following:
The PSR2.Namespaces.NamespaceDeclaration sniff, which is included in Extra can sort of cover the "after" part, as in: it check for exactly one blank line after, which is close to, but not exactly what we want.
The PSR12.Files.FileHeader sniff can check both "before" and "after", but will also, again, check for exactly one blank line.
The problem with that sniff is that it currently is "all or nothing", it does not have modular error codes, so we cannot ignore some other things from that sniff (requires blank line between PHP open tag and file docblock), which makes it problematic to include the sniff.
If upstream PR PSR12/FileHeader: make "SpacingAfter" and "SpacingInside" errorcodes modular squizlabs/PHP_CodeSniffer#2729 would (finally) be merged, we could reconsider adding that sniff though.
Is your feature request related to a problem?
A sniff should be added to address the following handbook rule:
Ref: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#namespace-declarations
Additional context (optional)
From an analysis done of available sniffs:
Ref: #2247
The text was updated successfully, but these errors were encountered: