Skip to content

Commit b1d9aa3

Browse files
committed
restore fixture
1 parent bba767d commit b1d9aa3

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
class SomeParentA
4+
{
5+
public function SomeParentA()
6+
{
7+
}
8+
}
9+
10+
final class SomeChildB extends SomeParentA
11+
{
12+
public function SomeChildB() {
13+
$this->SomeParentA();
14+
}
15+
}
16+
17+
?>
18+
-----
19+
<?php
20+
21+
class SomeParentA
22+
{
23+
public function __construct()
24+
{
25+
}
26+
}
27+
28+
final class SomeChildB extends SomeParentA
29+
{
30+
public function __construct() {
31+
\SomeParentA::__construct();
32+
}
33+
}
34+
35+
?>

rules-tests/Php70/Rector/ClassMethod/Php4ConstructorRector/Fixture/parent_constructor_call.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class SomeChildB extends ParentClass
1616
{
1717
public function __construct()
1818
{
19-
parent::__construct();
19+
\ParentClass::__construct();
2020
}
2121
}
2222

rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ public function refactor(Node $node): Class_|null
137137
/** @var MethodCall $expr */
138138
$expr = $classMethodStmt->expr;
139139

140-
$classMethodStmt->expr = new StaticCall(new Name(ObjectReference::PARENT), new Identifier(
140+
/** @var string $parentClassName */
141+
$parentClassName = $node->extends->toString();
142+
143+
$classMethodStmt->expr = new StaticCall(new Name\FullyQualified($parentClassName), new Identifier(
141144
MethodName::CONSTRUCT
142145
), $expr->args);
143146
}

0 commit comments

Comments
 (0)