1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Don’t unset $this when calculating scope changes

This commit is contained in:
Matthew Brown 2017-01-27 18:54:27 -07:00
parent 4c3dacbbed
commit a35f2e0792

View File

@ -361,13 +361,13 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
} }
foreach ($context->vars_in_scope as $var => $type) { foreach ($context->vars_in_scope as $var => $type) {
if (strpos($var, '$this->') !== 0) { if (strpos($var, '$this->') !== 0 && $var !== '$this') {
unset($context->vars_in_scope[$var]); unset($context->vars_in_scope[$var]);
} }
} }
foreach ($context->vars_possibly_in_scope as $var => $type) { foreach ($context->vars_possibly_in_scope as $var => $type) {
if (strpos($var, '$this->') !== 0) { if (strpos($var, '$this->') !== 0 && $var !== '$this') {
unset($context->vars_possibly_in_scope[$var]); unset($context->vars_possibly_in_scope[$var]);
} }
} }