Skip to content

New Universal.WhiteSpace.FnKeywordSpacing sniff#460

Open
rodrigoprimo wants to merge 1 commit into
PHPCSStandards:developfrom
rodrigoprimo:fn-keyword-spacing
Open

New Universal.WhiteSpace.FnKeywordSpacing sniff#460
rodrigoprimo wants to merge 1 commit into
PHPCSStandards:developfrom
rodrigoprimo:fn-keyword-spacing

Conversation

@rodrigoprimo

Copy link
Copy Markdown
Collaborator

This sniff checks the spacing after the fn keyword of arrow functions.

The amount of spacing is configurable via the spacingAfterKeyword property (defaults to no space).

The default follows PER Coding Style 2.0, which states that the fn keyword must not be succeeded by a space.

Fixes #441.

Suggested changelog entry

  • New Universal.WhiteSpace.FnKeywordSpacing sniff to check the spacing after the fn keyword of arrow functions.

…n keyword

Add the `Universal.WhiteSpace.FnKeywordSpacing` sniff which enforces that the `fn` keyword of an arrow function is not succeeded by a space, as required by PER Coding Style 2.0 (section 7.1). The amount of spacing is configurable via the `spacingAfterKeyword` property (default 0).

Fixes 441.

Ref: https://github.com/php-fig/per-coding-style/blob/2.0.0/spec.md#71-short-closures
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.

[FR] Arrow functions: sniff to enforce spacing after the fn keyword

1 participant