Skip to content
Permalink
Browse files

Improve object-with-methods assertions

  • Loading branch information...
muglug committed Aug 18, 2019
1 parent b8bdaea commit 80949b2b29542a4ab611697c4452ee96619cdcea
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/Psalm/Internal/Type/AssertionReconciler.php
@@ -816,9 +816,14 @@ private static function reconcileHasMethod(
foreach ($existing_var_atomic_types as $type) {
if ($type instanceof TNamedObject
&& $codebase->classOrInterfaceExists($type->value)
&& $codebase->methodExists($type->value . '::' . $method_id)
) {
$object_types[] = $type;
if (!$codebase->methodExists($type->value . '::' . $method_id)) {
$obj = new Atomic\TObjectWithProperties([], [$method_id => true]);
$type->extra_types[$obj->getKey()] = $obj;
$did_remove_type = true;
}
} elseif ($type instanceof TObject || $type instanceof TMixed) {
$object_types[] = new Atomic\TObjectWithProperties([], [$method_id => true]);
$did_remove_type = true;
@@ -836,7 +841,7 @@ private static function reconcileHasMethod(
$existing_var_type,
$old_var_type_string,
$key,
'object',
'object with method ' . $method_id,
!$did_remove_type,
$code_location,
$suppressed_issues

0 comments on commit 80949b2

Please sign in to comment.
You can’t perform that action at this time.