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

Ignore annotated magic static methods with usage object gap

Magic methods annotated by methods `__call` and `__callStatic`.
Magic static methods implemented in `__callStatic`
are not required implementation in `__call'.
This commit is contained in:
Ivan Sidorov 2023-11-15 11:09:54 +00:00
parent 715f6f51e1
commit d533bb8c2e
2 changed files with 9 additions and 9 deletions

View File

@ -69,7 +69,6 @@ use ReflectionType;
use UnexpectedValueException;
use function array_combine;
use function array_merge;
use function array_pop;
use function array_reverse;
use function array_values;
@ -1884,12 +1883,15 @@ final class Codebase
try {
$class_storage = $this->classlike_storage_provider->get($atomic_type->value);
$methods = array_merge(
$class_storage->methods,
$class_storage->pseudo_methods,
$class_storage->pseudo_static_methods,
);
foreach ($methods as $method_storage) {
$method_storages = [...$class_storage->methods];
if ($gap === '->') {
$method_storages += $class_storage->pseudo_methods;
}
if ($gap === '::') {
$method_storages += $class_storage->pseudo_static_methods;
}
foreach ($method_storages as $method_storage) {
if ($method_storage->is_static || $gap === '->') {
$completion_item = new CompletionItem(
$method_storage->cased_name,

View File

@ -126,7 +126,6 @@ final class MethodGetCompletionItemsForClassishThingTest extends TestCase
'magicObjProp2',
'magicObjMethod',
'magicStaticMethod',
'publicObjProp',
'protectedObjProp',
@ -201,7 +200,6 @@ final class MethodGetCompletionItemsForClassishThingTest extends TestCase
'magicObjProp2',
'magicObjMethod',
'magicStaticMethod',
'publicObjProp',
'protectedObjProp',