We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Extension of #8200.
https://psalm.dev/r/fe2c4dfb31 new static() from Test::create() is incorrectly inferred as Test&T where T is Maybe.
new static()
Test::create()
Test&T
T
Maybe
The text was updated successfully, but these errors were encountered:
I found these snippets:
<?php /** * @template-covariant A * @psalm-immutable * @psalm-consistent-constructor * @psalm-consistent-templates */ final class Maybe { /** * @param A $value */ public function __construct(public $value) {} /** * @template B * @param B $value * @return Maybe<B> * * @psalm-pure */ public static function just($value): self { return new self($value); } } abstract class Test { final private function __construct() {} /** * @template T of Maybe * @param class-string<T> $maybeClass */ final public static function create(string $maybeClass = Maybe::class): static { $maybe = $maybeClass::just(new static()); foobar($maybe->value); return $maybe->value; } } function foobar(Maybe $m): void {}
Psalm output (using commit 6d45003): No issues!
Sorry, something went wrong.
static
No branches or pull requests
Extension of #8200.
https://psalm.dev/r/fe2c4dfb31
new static()
fromTest::create()
is incorrectly inferred asTest&T
whereT
isMaybe
.The text was updated successfully, but these errors were encountered: