From 91d20fb5ff56a4b6abc1ef9a435675b3e37c3c24 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 27 Aug 2026 17:29:24 +0300 Subject: [PATCH 1/2] Generalize double arrow spacing rule --- spec.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec.md b/spec.md index 1e51153..28e4e2b 100644 --- a/spec.md +++ b/spec.md @@ -924,7 +924,6 @@ For a `set` hook, if the argument name and type do not need to be redefined, the If a hook consists of a single expression, then PHP allows it to be shortened using `=>`. In that case: -* There MUST be a single space on either side of the `=>` symbol. * The body MUST begin on the same line as the hook name and `=>`. * Wrapping is allowed if the expression used allows for wrapping, using the rules defined elsewhere in this document. @@ -1305,6 +1304,8 @@ Style rules for operators are grouped by arity (the number of operands they take When space is permitted around an operator, multiple spaces MAY be used for readability purposes. +The `=>` symbol MUST be preceded and followed by at least one space. + All operators not described here are left undefined. ### 6.1. Unary operators @@ -1528,8 +1529,6 @@ and principles as long closures above, with the following additions. The `fn` keyword MUST NOT be succeeded by a space. -The `=>` symbol MUST be preceded and succeeded by a space. - The semicolon at the end of the expression MUST NOT be preceded by a space. The expression portion MAY be split to a subsequent line. If so, the `=>` MUST be included From 765e2ea9e1b909124d79905fb6eec74ff39f4516 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 27 Aug 2026 17:37:54 +0300 Subject: [PATCH 2/2] Clarify alignment around double arrows --- spec.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.md b/spec.md index 28e4e2b..93fd979 100644 --- a/spec.md +++ b/spec.md @@ -1301,8 +1301,8 @@ try { Style rules for operators are grouped by arity (the number of operands they take). -When space is permitted around an operator, multiple spaces MAY be -used for readability purposes. +When space is permitted around an operator or the `=>` symbol, multiple spaces +MAY be used for readability purposes. The `=>` symbol MUST be preceded and followed by at least one space.