1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

fix #4013: prevent exception when two mixins declare methods with same name (#4018)

fixes #4013
This commit is contained in:
Daniel Melchior 2020-08-18 14:38:30 +02:00 committed by GitHub
parent 9822043ca4
commit 17ed440f2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 0 deletions

View File

@ -376,6 +376,7 @@ class AtomicMethodCallAnalyzer extends CallAnalyzer
$mixin_class_storage = $codebase->classlike_storage_provider->get($mixin->value);
$fq_class_name = $mixin_class_storage->name;
$mixin_class_storage->mixin_declaring_fqcln = $class_storage->mixin_declaring_fqcln;
$class_storage = $mixin_class_storage;
$naive_method_exists = true;
$method_id = $new_method_id;

View File

@ -533,6 +533,38 @@ class MixinAnnotationTest extends TestCase
return (new FooGrandChild)->other();
}'
],
'multipleMixinsWithSameMethod' => [
'<?php
class Mix1
{
public function foo(): string
{
return "";
}
}
class Mix2
{
public function foo(): string
{
return "";
}
}
/**
* @mixin Mix1
* @mixin Mix2
*/
class Bar
{
}
$bar = new Bar();
$bar->foo();'
],
];
}