mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
parent
71064cf258
commit
924f6b6f94
@ -712,6 +712,10 @@ class Context
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->clauses = $clauses_to_keep;
|
$this->clauses = $clauses_to_keep;
|
||||||
|
|
||||||
|
if ($this->parent_context) {
|
||||||
|
$this->parent_context->removeMutableObjectVars();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateChecks(Context $op_context): void
|
public function updateChecks(Context $op_context): void
|
||||||
|
@ -114,6 +114,38 @@ class PropertyTypeTest extends TestCase
|
|||||||
$this->analyzeFile('somefile.php', new Context());
|
$this->analyzeFile('somefile.php', new Context());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFooBar(): void
|
||||||
|
{
|
||||||
|
Config::getInstance()->remember_property_assignments_after_call = false;
|
||||||
|
|
||||||
|
$this->addFile(
|
||||||
|
'somefile.php',
|
||||||
|
'<?php
|
||||||
|
class A {
|
||||||
|
private ?int $bar = null;
|
||||||
|
|
||||||
|
public function baz(): void
|
||||||
|
{
|
||||||
|
$this->bar = null;
|
||||||
|
|
||||||
|
foreach (range(1, 5) as $part) {
|
||||||
|
if ($part === 3) {
|
||||||
|
$this->foo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->bar === null) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function foo() : void {
|
||||||
|
$this->bar = 5;
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->analyzeFile('somefile.php', new Context());
|
||||||
|
}
|
||||||
|
|
||||||
public function testForgetFinalMethodCalls(): void
|
public function testForgetFinalMethodCalls(): void
|
||||||
{
|
{
|
||||||
Config::getInstance()->remember_property_assignments_after_call = false;
|
Config::getInstance()->remember_property_assignments_after_call = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user