From 63881f1ee87106250598db63bf40a0fab2d2f848 Mon Sep 17 00:00:00 2001 From: Larry Garfield Date: Mon, 12 Sep 2022 14:19:01 -0500 Subject: [PATCH 1/2] Describe named arguments. --- spec.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec.md b/spec.md index a26ea89..8ef0b6f 100644 --- a/spec.md +++ b/spec.md @@ -513,12 +513,12 @@ function fooBarBaz($arg1, &$arg2, $arg3 = []) } ``` -### 4.5 Method and Function Arguments +### 4.5 Method and Function Parameters In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -Method and function arguments with default values MUST go at the end of the argument +Method and function parameters with default values MUST go at the end of the argument list. ```php @@ -631,6 +631,10 @@ public function process(string $algorithm, &...$parts) } ``` +When invoking a function or method, the same rules apply for the arguments to the function as for the parameters. +Additionally, if using named arguments, there MUST NOT be a space between the argument name +and colon, and there MUST be a single space between the colon and the argument value. + ### 4.6 Modifier Keywords Properties and methods of a class have numerous keyword modifiers that alter how the From f6199b69ab49e09f2cb4de375acb18d310a5c66e Mon Sep 17 00:00:00 2001 From: Larry Garfield Date: Mon, 12 Sep 2022 14:39:19 -0500 Subject: [PATCH 2/2] Put the description in a more logical place. --- spec.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spec.md b/spec.md index 8ef0b6f..800c3fd 100644 --- a/spec.md +++ b/spec.md @@ -631,10 +631,6 @@ public function process(string $algorithm, &...$parts) } ``` -When invoking a function or method, the same rules apply for the arguments to the function as for the parameters. -Additionally, if using named arguments, there MUST NOT be a space between the argument name -and colon, and there MUST be a single space between the colon and the argument value. - ### 4.6 Modifier Keywords Properties and methods of a class have numerous keyword modifiers that alter how the @@ -718,6 +714,13 @@ $app->get('/hello/{name}', function ($name) use ($app) { }); ``` +If using named arguments, there MUST NOT be a space between the argument name +and colon, and there MUST be a single space between the colon and the argument value. + +```php +somefunction($a, b: $b, c: 'c'); +``` + Method chaining MAY be put on separate lines, where each subsequent line is indented once. When doing so, the first method MUST be on the next line.