Skip to content

Commit

Permalink
Update phpdocs-basics.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 10, 2020
1 parent 449812c commit b2a32a9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions website/src/writing-php-code/phpdocs-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,24 @@ public function returnStatic(): self
}
```

Variadic functions
-------------------------

This allows specifying functions or methods which have a variable amount of parameters (available since [PHP 5.6](https://www.php.net/manual/en/migration56.new-features.php)).

Your code can look like this:

```php
/**
* @param string $arg
* @param string ...$additional
*/
function foo($arg, ...$additional)
{

}
```

A narrower `@return $this` instead of `@return static` can also be used, and PHPStan will check if you're really returning the same object instance and not just the child class.

Generics
Expand Down

0 comments on commit b2a32a9

Please sign in to comment.