Skip to content

Commit

Permalink
Merge pull request #42 from Crell/named-args
Browse files Browse the repository at this point in the history
Describe named arguments.
  • Loading branch information
KorvinSzanto authored Nov 10, 2022
2 parents 715c3c8 + f6199b6 commit cd79134
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -714,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.

Expand Down

0 comments on commit cd79134

Please sign in to comment.