Skip to content

Commit

Permalink
Fix #2923 - remove hack to fix a template issue
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Mar 6, 2020
1 parent 51bfc7c commit a2a5071
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -639,10 +639,6 @@ function (PhpParser\Node\Arg $arg) {

$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);
}
}
}

Expand Down
44 changes: 44 additions & 0 deletions tests/PropertyTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,50 @@ public function foo() {
}
}',
],
'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();
}
}'
],
];
}

Expand Down

0 comments on commit a2a5071

Please sign in to comment.