php-advanced-json-rpc icon indicating copy to clipboard operation
php-advanced-json-rpc copied to clipboard

Support nullable types (`@param ?string $rpcParamName`)

Open TysonAndre opened this issue 8 years ago • 4 comments
trafficstars

It's annoying and surprising to have to type @param string|null instead of @param ?string.

Checking if the first character of a type is ? and stripping that (and adding null) may be the quickest workaround, not sure if upgrading dependencies would help.

https://github.com/phpDocumentor/TypeResolver/ issue 31 seems related, phpdocumentor2 (project) does parse these.

TysonAndre avatar Oct 21 '17 21:10 TysonAndre

I've never seen that syntax before. Could you point me to docs about it?

felixfbecker avatar Oct 21 '17 21:10 felixfbecker

Filed https://github.com/phpDocumentor/fig-standards/issues/153

This is something that would make sense to me, but sadly not part of official standards yet.

  • Didn't see anything in the mailing list for fig.
  • PSR-5 doesn't include it, PSR-5 draft also hasn't been updated recently.

TysonAndre avatar Oct 21 '17 22:10 TysonAndre

@felixfbecker it is PHP7.1 nullable type declaration for parameters and return values syntax: PHP manual

VolCh avatar Jan 05 '18 11:01 VolCh

@VolCh this package only looks at @param tags

felixfbecker avatar Jan 05 '18 20:01 felixfbecker