Skip to content

Should the single space around => be stated as a general rule instead of per construct? #154

Description

@rodrigoprimo

PER explicitly requires a single space around the => symbol in two sections:

Section 7.1 (Short Closures):

The => symbol MUST be preceded and succeeded by a space.

Section 4.9 (Property Hooks):

There MUST be a single space on either side of the => symbol.

The same operator is used in other constructs, but as far as I could check the spec does not state the spacing around it explicitly for them. Arrays (section 11), match (section 5.2) and foreach (section 5.5) only show a single space in their examples. There might be other places where => is used, but I haven't checked them all.

Is there a reason the rule is stated only for short closures and property hooks that I'm missing, or would it make sense to state it as a general rule so that it applies consistently to every use of =>? If there is a reason not to create a general rule, should it be added to the array, match and foreach sections?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions