Skip to content

Commit

Permalink
Hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Nov 27, 2023
1 parent a84be64 commit 62ed2b0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
11 changes: 11 additions & 0 deletions src/Psalm/Codebase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1593,11 +1593,22 @@ public function getCompletionItemsForClassishThing(
error_log($e->getMessage());
}
}
if ($gap === '->') {
$method_storages += $class_storage->pseudo_methods;
}
if ($gap === '::') {
$method_storages += $class_storage->pseudo_static_methods;
}

$had = [];
foreach ($method_storages as $method_storage) {
if (!in_array($method_storage->visibility, $allow_visibilities)) {
continue;
}
if (array_key_exists($method_storage->cased_name, $had)) {

Check failure on line 1608 in src/Psalm/Codebase.php

View workflow job for this annotation

GitHub Actions / build

PossiblyNullArgument

src/Psalm/Codebase.php:1608:46: PossiblyNullArgument: Argument 1 of array_key_exists cannot be null, possibly null value provided (see https://psalm.dev/078)
continue;
}
$had[$method_storage->cased_name] = true;
if ($method_storage->is_static || $gap === '->') {
$completion_item = new CompletionItem(
$method_storage->cased_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,6 @@ public function start(PhpParser\Node\Stmt\ClassLike $node): ?bool
if (!isset($storage->overridden_method_ids[$lc_method_name])) {
$storage->overridden_method_ids[$lc_method_name] = [];
}
if (!isset($storage->declaring_method_ids[$lc_method_name])) {
$storage->declaring_method_ids[$lc_method_name] = $method_identifier;
}
$storage->declaring_pseudo_method_ids[$lc_method_name] = $method_identifier;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ private static function privateStaticMethod() {}
'magicObjProp2',

'magicObjMethod',
'magicStaticMethod',

'publicObjProp',
'protectedObjProp',
Expand Down Expand Up @@ -202,8 +201,6 @@ private static function privateStaticMethod() {}

'magicObjMethod',

'magicStaticMethod',

'publicObjProp',
'protectedObjProp',
'privateObjProp',
Expand Down Expand Up @@ -442,8 +439,8 @@ class A extends C {
'magicObjProp1',
'magicObjProp2',

'magicStaticMethod',
'magicObjMethod',
'magicStaticMethod',

'publicObjProp',
'protectedObjProp',
Expand Down Expand Up @@ -548,7 +545,6 @@ class A {
'magicObjProp1',
'magicObjProp2',
'magicObjMethod',
'magicStaticMethod',

'publicObjProp',

Expand Down

0 comments on commit 62ed2b0

Please sign in to comment.