1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #2923 - remove hack to fix a template issue

This commit is contained in:
Matthew Brown 2020-03-06 09:42:23 -05:00
parent 51bfc7c619
commit a2a507166d
2 changed files with 44 additions and 4 deletions

View File

@ -639,10 +639,6 @@ class StaticCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
$context->include_location = $old_context_include_location;
$context->self = $old_self;
if (isset($context->vars_in_scope['$this'])) {
$context->vars_in_scope['$this'] = Type::parseString($old_self);
}
}
}

View File

@ -1866,6 +1866,50 @@ class PropertyTypeTest extends TestCase
}
}',
],
'someConditionalCallToParentConstructor' => [
'<?php
class GrandParentClassDoesNotDefine {
public function __construct() {}
}
class ParentClassDefinesVar extends GrandParentClassDoesNotDefine {
protected string $val;
public function __construct() {
$this->val = "hello";
if (true) {
parent::__construct();
}
}
}
class ChildClass extends ParentClassDefinesVar {
public function __construct() {
parent::__construct();
}
}'
],
'noConditionalCallToParentConstructor' => [
'<?php
class GrandParentClassDoesNotDefine {
public function __construct() {}
}
class ParentClassDefinesVar extends GrandParentClassDoesNotDefine {
protected string $val;
public function __construct() {
$this->val = "hello";
parent::__construct();
}
}
class ChildClass extends ParentClassDefinesVar {
public function __construct() {
parent::__construct();
}
}'
],
];
}