1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Docblock psudo methods can be inherited via @mixin

Fixes #3556
This commit is contained in:
robchett 2023-11-08 10:40:53 +00:00
parent b775d297bb
commit 86f503ab82
2 changed files with 28 additions and 0 deletions

View File

@ -435,6 +435,12 @@ final class MissingMethodCallHandler
}
$ancestors = $static_class_storage->class_implements;
foreach ($static_class_storage->namedMixins as $namedObject) {
$type = $namedObject->value;
if ($type) {
$ancestors[$type] = true;
}
}
foreach ($ancestors as $fq_class_name => $_) {
$class_storage = $codebase->classlikes->getStorageFor($fq_class_name);

View File

@ -596,6 +596,28 @@ class MixinAnnotationTest extends TestCase
'$g' => 'list<FooModel>',
],
],
'mixinInheritMagicMethods' => [
'code' => '<?php
/**
* @method $this active()
*/
class A {
public function __call(string $name, array $arguments) {}
}
/**
* @mixin A
*/
class B {
public function __call(string $name, array $arguments) {}
}
$b = new B;
$c = $b->active();',
'assertions' => [
'$c' => 'B',
],
],
];
}