From e83a265e0b2dc9b2bd0fad0a111246c2daeb275c Mon Sep 17 00:00:00 2001 From: ging-dev Date: Mon, 25 Sep 2023 13:27:46 +0700 Subject: [PATCH] fix: #10080 --- src/Psalm/Internal/Diff/ClassStatementsDiffer.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Diff/ClassStatementsDiffer.php b/src/Psalm/Internal/Diff/ClassStatementsDiffer.php index 5bc637b4624..718d4aa8b41 100644 --- a/src/Psalm/Internal/Diff/ClassStatementsDiffer.php +++ b/src/Psalm/Internal/Diff/ClassStatementsDiffer.php @@ -230,7 +230,15 @@ static function ( /** @var PhpParser\Node */ $affected_elem = $diff_elem->type === DiffElem::TYPE_REMOVE ? $diff_elem->old : $diff_elem->new; if ($affected_elem instanceof PhpParser\Node\Stmt\ClassMethod) { - $add_or_delete[] = $name_lc . '::' . strtolower((string) $affected_elem->name); + $name = strtolower((string) $affected_elem->name); + $add_or_delete[] = $name_lc . '::' . $name; + if ($name === '__construct') { + foreach ($affected_elem->params as $param) { + if ($param->flags) { + $add_or_delete[] = $name_lc . '::$' . $param->var->name; + } + } + } } elseif ($affected_elem instanceof PhpParser\Node\Stmt\Property) { foreach ($affected_elem->props as $prop) { $add_or_delete[] = $name_lc . '::$' . $prop->name;