From 7e834e23adcc86b2c604a5806d73cada5e73bd36 Mon Sep 17 00:00:00 2001 From: Matteo Beccati Date: Tue, 5 May 2026 16:45:56 +0200 Subject: [PATCH] Fix #124 Require parenthesis around clone() --- spec.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec.md b/spec.md index ede3ef0..2c6f223 100644 --- a/spec.md +++ b/spec.md @@ -853,6 +853,16 @@ die(); $result = foo() ?? exit(); ``` +The `clone` language construct MUST always be used with parenthesis, even when the optional `$withProperties` argument is +not provided. For example: + +```php +$b = clone($a); +$b = clone($a, [ + 'foo' => 'bar', +]); +``` + ### 4.8 Function Callable References A function or method may be referenced in a way that creates a closure out of it, by providing `...` in place of arguments.