Skip to content

Commit

Permalink
Merge pull request #9784 from robchett/document_unsealed_arrays
Browse files Browse the repository at this point in the history
Document array shape unsealing syntax
  • Loading branch information
orklah committed May 14, 2023
2 parents 2039667 + f491a53 commit 5370492
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/annotating_code/type_syntax/array_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,17 @@ $options['verbose'] = isset($options['verbose']);
handleOptions($options);
```

`...` is a shorthand for `...<array-key, mixed>` you can use other array generic types to provide more information about the open shape.

```php
// This is an open array
/** @param array{someKey: string, ...} */
// Which is the same as
/** @param array{someKey: string, ...<array-key, mixed>} */
// But it can be further locked down with a shape ...<TKey, TValue>
/** @return array{someKey: string, ...<int, bool>} */
```

## Callable arrays

An array holding a callable, like PHP's native `call_user_func()` and friends supports it:
Expand Down

0 comments on commit 5370492

Please sign in to comment.