-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add variadics to type syntax #40
Comments
I agree, this should be documented in the PHPDoc PSR. Support for variadics have been added to phpDocumentor 2.4 |
Winner! Can we close this one? |
Unfortunately not yet, it hasn't been described properly in the PSR yet. |
What if you expect tuples or triples of values? |
Hopefully this won't deviate from PHP 5.6 syntax when it gets added to the spec? I am documenting it already using the syntax above, and I have seen others doing it as well - as mentioned, it is already supported in PhpStorm. |
The variadics notation has been added or will be added according to the way php had provided these |
@mvriel Still no mention of variadics in PSR-5. What is the suggested syntax for documenting variadics? There is an open discussion in the PHPStorm IDE bug tracker about whether to use brackets notation or not in front of variadics. |
Imho no brackets, exactly as the language treats it. Using #!/usr/bin/env php
<?php
final class Foo {
public function __toString() {
return 'foo';
}
}
/**
* @param Foo ...$foos
*/
function list_foos(Foo ...$foos) {
foreach ($foos as $foo) {
echo "{$foo}\n";
}
}
list_foos(new Foo(), new Foo(), new Foo(), new Foo()); |
Looks like variadics will be supported in PHP 5.6 - the PHP-DOC spec might as well support this from day one.
Many libraries already implement variadics using
func_get_args()
so there was a need to document these already before native support for variadics - this is already supported by PhpStorm:The text was updated successfully, but these errors were encountered: