-
Notifications
You must be signed in to change notification settings - Fork 659
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
False positive wrong type and inherit doc #5126
Comments
Hey @VincentLanglet, can you reproduce the issue on https://psalm.dev ? |
Is this method defined in any ancestors or interfaces implemented by |
I got sometimes the similar error with |
@VincentLanglet can you check if you use |
My config is
|
Doest it reproduce without stubs and without plugins? |
Really hard to say. I ran psalm with this config, got the error. It occurs sometimes only and I cannot reproduce it. |
@weirdan @orklah I have a reproducer (I hope you'll get the error too). With the repository https://github.com/VincentLanglet/Twig-CS-Fixer, Running
|
@VincentLanglet thanks, reproduced this locally. |
Reduced to https://gist.github.com/weirdan/69b9f4fe3d0d384295074a42427f7f7a: $ git clone [email protected]:69b9f4fe3d0d384295074a42427f7f7a.git gg
Cloning into 'gg'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (6/6), done.
Receiving objects: 100% (7/7), done.
remote: Total 7 (delta 0), reused 0 (delta 0), pack-reused 0
$ cd gg
$ composer install
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 30 installs, 0 updates, 0 removals
- Locking amphp/amp (v2.6.0)
[...snip...]
$ vendor/bin/psalm --no-cache
Scanning files...
Analyzing files...
E
ERROR: MethodSignatureMismatch - B.php:15:29 - Argument 1 of B::f has wrong type 'array<array-key, mixed>', expecting 'array<int, T>' as defined by A::f (see https://psalm.dev/042)
public function f(array $t): void
------------------------------
1 errors found
------------------------------
Checks took 0.48 seconds and used 39.760MB of memory
Psalm was unable to infer types in the codebase |
Changing |
diff --git a/src/Psalm/Internal/Analyzer/MethodComparator.php b/src/Psalm/Internal/Analyzer/MethodComparator.php
index 977f23448..f1ab10fe6 100644
--- a/src/Psalm/Internal/Analyzer/MethodComparator.php
+++ b/src/Psalm/Internal/Analyzer/MethodComparator.php
@@ -329,7 +329,7 @@ class MethodComparator
) {
$implementer_param_type = $implementer_param->signature_type;
- $guide_param_signature_type = $guide_param->type;
+ $guide_param_signature_type = $guide_param->signature_type;
$or_null_guide_param_signature_type = $guide_param->signature_type
? clone $guide_param->signature_type
Haven't properly tested yet, but the above appears to fix the issue at hand. |
Ok, I think I've got what's going on here. There's a |
This should prevent Psalm from sometimes marking user-defined classes as built-in. Fixes vimeo#5126
This should prevent Psalm from sometimes marking user-defined classes as built-in. Fixes vimeo#5126 Fixes vimeo#5626
Hi @muglug @weirdan
Since fews days I got a weird issue with psalm
I'm using the last version of sonata, so you can see
https://github.com/sonata-project/SonataAdminBundle/blob/3.x/src/Admin/AbstractAdmin.php#L2489
https://github.com/sonata-project/SonataAdminBundle/blob/3.x/src/Admin/AdminInterface.php#L252
And I don't override the setFilterTheme method on my
AbstractBaseAdmin
.array
is overriding the phpdoc of the InterfaceThe text was updated successfully, but these errors were encountered: