-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
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
Add support for ::class type inference #5479
Comments
I found these snippets: https://psalm.dev/r/57434e1f10<?php
/**
* @template T of object
* @psalm-param T $obj
*/
function a(object $obj) {
$class = get_class($obj);
$class2 = $obj::class;
/** @psalm-trace $class */
/** @psalm-trace $class2 */
}
|
Ideally support would be conditioned on PHP 8, and previous versions would show an error: https://3v4l.org/ZCj6L |
It's PHP8+ syntax. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Calling
$class = get_class($obj);
for$obj
of typeT
correctly resolves$class
toclass-string<T>
.But
$class = $obj::class
resolves$class
tomixed
https://psalm.dev/r/57434e1f10
The text was updated successfully, but these errors were encountered: