Way to inline type generics? #10301
-
Is there a way to type a value without extracting it into a variable and using @var? Consider this https://phpstan.org/r/be7358b7-fd97-485f-8069-9452f2731b15 I'm passing a static value
I'd like to somehow declare In other languages I'd do I don't want to use variable for that because that adds some maintenance overhead and lowers readability in more complex cases like this https://phpstan.org/r/0ab343ea-fa02-4f58-9470-fc29d9440268 where there are either many different static values or the static expression is complex. Something similar to this would be great sayHello(
/** @phpstan-var Set<Foo> */
new Set([Foo::A])
); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There isn't a better way, but:
|
Beta Was this translation helpful? Give feedback.
There isn't a better way, but: