How to add nullable return type declaration? #6665
Answered
by
samsonasik
brandonkelly
asked this question in
Q&A
-
I need to configure an class SomeClass
{
- public function getData()
+ public function getData(): ?array
{
}
} How exactly can that be expressed as a |
Beta Was this translation helpful? Give feedback.
Answered by
samsonasik
Aug 27, 2021
Replies: 1 comment
-
You possibly can do with: use PHPStan\Type\UnionType;
use PHPStan\Type\ArrayType;
use PHPStan\Type\NullType;
use PHPStan\Type\MixedType;
new UnionType([new ArrayType(new MixedType(), new MixedType()), new NullType()]) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
samsonasik
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You possibly can do with: