mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix method mutation transference
This commit is contained in:
parent
a2750a92aa
commit
de1ce36a5c
@ -404,7 +404,7 @@ class FileChecker extends SourceChecker implements StatementsSource
|
||||
throw new \UnexpectedValueException('Method ' . $method_id . ' could not be checked');
|
||||
}
|
||||
|
||||
foreach ($call_context->vars_in_scope as $var => $type) {
|
||||
foreach ($call_context->vars_possibly_in_scope as $var => $_) {
|
||||
$this_context->vars_possibly_in_scope[$var] = true;
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,10 @@ class MethodMutationTest extends PHPUnit_Framework_TestCase
|
||||
public function barBar() : Response {
|
||||
$this->setUser();
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$this->title = "hello";
|
||||
}
|
||||
|
||||
return new Response($this->user_viewdata);
|
||||
}
|
||||
}'
|
||||
@ -116,5 +120,6 @@ class MethodMutationTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertEquals('UserViewData', (string)$method_context->vars_in_scope['$this->user_viewdata']);
|
||||
$this->assertEquals('string', (string)$method_context->vars_in_scope['$this->user_viewdata->name']);
|
||||
$this->assertEquals(true, (string)$method_context->vars_possibly_in_scope['$this->title']);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user