mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #4210 - fix __invoke declaration tracing
This commit is contained in:
parent
93d66117d0
commit
1b6ecfc128
@ -324,7 +324,10 @@ class CallableTypeComparator
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($codebase->methods->methodExists($invoke_id)) {
|
if ($codebase->methods->methodExists($invoke_id)) {
|
||||||
$method_storage = $codebase->methods->getStorage($invoke_id);
|
$declaring_method_id = $codebase->methods->getDeclaringMethodId($invoke_id);
|
||||||
|
|
||||||
|
if ($declaring_method_id) {
|
||||||
|
$method_storage = $codebase->methods->getStorage($declaring_method_id);
|
||||||
$method_fqcln = $invoke_id->fq_class_name;
|
$method_fqcln = $invoke_id->fq_class_name;
|
||||||
$converted_return_type = null;
|
$converted_return_type = null;
|
||||||
if ($method_storage->return_type) {
|
if ($method_storage->return_type) {
|
||||||
@ -345,6 +348,7 @@ class CallableTypeComparator
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -848,6 +848,22 @@ class CallableTest extends TestCase
|
|||||||
|
|
||||||
foo(["a", "b"]);'
|
foo(["a", "b"]);'
|
||||||
],
|
],
|
||||||
|
'abstractInvokeInTrait' => [
|
||||||
|
'<?php
|
||||||
|
function testFunc(callable $func) : void {}
|
||||||
|
|
||||||
|
trait TestTrait {
|
||||||
|
abstract public function __invoke() : void;
|
||||||
|
|
||||||
|
public function apply() : void {
|
||||||
|
testFunc($this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class TestClass {
|
||||||
|
use TestTrait;
|
||||||
|
}'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user