You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yup, works on return type and typehint, but not on @param and @var. Even though it is not really documented in the psr (guess it's dead or something ?), it is still a valid php type, so it should IMO be supported.
I have an interface that can work on multiple (nullable) objects, and each implementation concerns a particular object. So I'm not typehinting anything (will change to ?object once we get to 7.2...), so I need to add a /** @param ?Foo $foo (or @var).
This should be "fixed" in #876 - it uses @var Type|null $foo by default, the .phpactor/templates/Property.php.twig could be overridden to use ? instad.
Activity
[-]Support for nullable types[/-][+][WR} Support for nullable types[/+]dantleech commentedon Feb 19, 2018
Yes, it is indeed. Should be relatively easy to implement.
dantleech commentedon Mar 1, 2018
Do you mean
@var ?string? I don't think that's standard: https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#appendix-a-typesDoes PHPStorm support it? I would have expected
@var string|nullAlso, don't think PHPStan supports that.
Taluu commentedon Mar 1, 2018
Didn't try with a
@varor@param, but the nnullable typehint. And as it is a core feature of PHP 7.1, it would make sense to support it, nay ?The psr doesn't seem to have been updated for that.
dantleech commentedon Mar 1, 2018
Hmm.. I only asked because its works for me: phpactor/worse-reflection@4558561
Can you provide an example?
Taluu commentedon Mar 14, 2018
Yup, works on return type and typehint, but not on
@paramand@var. Even though it is not really documented in the psr (guess it's dead or something ?), it is still a valid php type, so it should IMO be supported.[-][WR} Support for nullable types[/-][+][WR] Support for nullable types[/+]dantleech commentedon Apr 6, 2018
What's the use case for using this notation in a docblock? Supporting
<7.1code?[-][WR] Support for nullable types[/-][+][WR] Support for nullable types in docblocks[/+]Taluu commentedon Apr 6, 2018
I have an interface that can work on multiple (nullable) objects, and each implementation concerns a particular object. So I'm not typehinting anything (will change to
?objectonce we get to 7.2...), so I need to add a/** @param ?Foo $foo(or@var).weirdan commentedon Jan 16, 2019
PHPStan, Psalm and Phan support that notation.
dantleech commentedon Jan 19, 2020
This should be "fixed" in #876 - it uses
@var Type|null $fooby default, the.phpactor/templates/Property.php.twigcould be overridden to use?instad.