-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix issues with _get_list_table() #261
Conversation
This is a great PR. Waiting for John ... and @swissspidy |
Perhaps @kkmuffme would also like to have a look regarding the Psalm support. Any feedback would be greatly appreciated. |
I don't have time to look deeply into this at the moment. I trust Ian's judgement. |
We have just taken off without landing gears. |
So basically this PR is only needed bc phpstan 1 does not support class-string in template and would be reverted later? Not sure if that change is a good idea to begin with then. |
Anyone able to answer? |
This PR was necessary because we were encountering incorrect return types. Unfortunately, I was unable to resolve the issues with |
This PR fixes the return types of
_get_list_table()
and resolves the "not always the same as T. It breaks the contract for some argument types, typically subtypes" issue (see at phpstan.org/try). The PHPStan version is updated to 1.11 to supportnew<T>
.Compared to the current implementation, we lose the check for whether
$class_name
is aclass-string
. Once we drop support for PHPStan 1.x, we can update'@phpstan-template T' => 'of string'
to'@phpstan-template T' => 'of class-string'
to restore the check that$class_name
is aclass-string
. I don't think thatnew<T>
is supported by Psalm.Once merged, #256 can be closed.
Fixes #257
Related to #256
Another option to resolve this is to revert migrating the dynamic return type extension from szepeviktor/phpstan-wordpress.
cc: @johnbillion