Skip to content

Commit cd79134

Browse files
authored
Merge pull request #42 from Crell/named-args
Describe named arguments.
2 parents 715c3c8 + f6199b6 commit cd79134

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

spec.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,12 @@ function fooBarBaz($arg1, &$arg2, $arg3 = [])
513513
}
514514
```
515515

516-
### 4.5 Method and Function Arguments
516+
### 4.5 Method and Function Parameters
517517

518518
In the argument list, there MUST NOT be a space before each comma, and there
519519
MUST be one space after each comma.
520520

521-
Method and function arguments with default values MUST go at the end of the argument
521+
Method and function parameters with default values MUST go at the end of the argument
522522
list.
523523

524524
```php
@@ -714,6 +714,13 @@ $app->get('/hello/{name}', function ($name) use ($app) {
714714
});
715715
```
716716

717+
If using named arguments, there MUST NOT be a space between the argument name
718+
and colon, and there MUST be a single space between the colon and the argument value.
719+
720+
```php
721+
somefunction($a, b: $b, c: 'c');
722+
```
723+
717724
Method chaining MAY be put on separate lines, where each subsequent line is indented once. When doing so, the first
718725
method MUST be on the next line.
719726

0 commit comments

Comments
 (0)