8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Here the correct behaviour is to treat closure param types as a lower bound on the templated type, and to treat anything outside as an upper bound.
/** * @template T * @param class-string<T> $className * @param Closure(T):void $outmaker * @return T */ function createProxy( string $className, Closure $outmaker ) : object { $t = new $className(); $outmaker($t); return $t; } class A { public function bar() : void {} } createProxy(A::class, function(object $o):void {})->bar();
Expected: no issue Actual: inference of createProxy call fails: https://psalm.dev/r/dfc10a8bde
createProxy
cc @Ocramius
The text was updated successfully, but these errors were encountered:
I found these snippets:
<?php /** * @template T * @param class-string<T> $className * @param Closure(T):void $outmaker * @return T */ function createProxy( string $className, Closure $outmaker ) : object { $t = new $className(); $outmaker($t); return $t; } class A { public function bar() : void {} } createProxy(A::class, function(object $o):void {})->bar();
Psalm output (using commit 11edb22): INFO: MixedMethodCall - 22:53 - Cannot determine the type of the object on the left hand side of this expression
Sorry, something went wrong.
067104e
No branches or pull requests
Here the correct behaviour is to treat closure param types as a lower bound on the templated type, and to treat anything outside as an upper bound.
Expected: no issue
Actual: inference of
createProxy
call fails: https://psalm.dev/r/dfc10a8bdecc @Ocramius
The text was updated successfully, but these errors were encountered: