mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix #4540 - use correct method when simulating property setting
This commit is contained in:
parent
e1d65ff797
commit
8392fb429c
@ -80,7 +80,7 @@ class ExistingAtomicStaticCallAnalyzer
|
||||
$file_analyzer = $statements_analyzer->getFileAnalyzer();
|
||||
|
||||
if ($context->collect_mutations) {
|
||||
$file_analyzer->getMethodMutations($method_id, $context);
|
||||
$file_analyzer->getMethodMutations($appearing_method_id, $context);
|
||||
} else {
|
||||
// collecting initializations
|
||||
$local_vars_in_scope = [];
|
||||
@ -98,14 +98,14 @@ class ExistingAtomicStaticCallAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($context->initialized_methods[(string) $method_id])) {
|
||||
if (!isset($context->initialized_methods[(string) $appearing_method_id])) {
|
||||
if ($context->initialized_methods === null) {
|
||||
$context->initialized_methods = [];
|
||||
}
|
||||
|
||||
$context->initialized_methods[(string) $method_id] = true;
|
||||
$context->initialized_methods[(string) $appearing_method_id] = true;
|
||||
|
||||
$file_analyzer->getMethodMutations($method_id, $context);
|
||||
$file_analyzer->getMethodMutations($appearing_method_id, $context);
|
||||
|
||||
foreach ($local_vars_in_scope as $var => $type) {
|
||||
$context->vars_in_scope[$var] = $type;
|
||||
|
@ -2121,6 +2121,27 @@ class PropertyTypeTest extends TestCase
|
||||
}
|
||||
}'
|
||||
],
|
||||
'skipConstructor' => [
|
||||
'<?php
|
||||
class A {
|
||||
protected string $s;
|
||||
|
||||
public function __construct() {
|
||||
$this->s = "hello";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
class C extends B {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
echo $this->s;
|
||||
}
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user