Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: inline constructor default when early return
- Loading branch information
Karim Pinchon
committed
Jul 27, 2022
1 parent
44eda96
commit 9501fa3
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
...ass_/InlineConstructorDefaultToPropertyRector/Fixture/do_not_change_has_before_if.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector\Fixture; | ||
|
||
final class DonotChangeHasBeforeIf | ||
{ | ||
private $name; | ||
private $age; | ||
private $gender; | ||
|
||
public function __construct(bool $initName = true) | ||
{ | ||
$this->age = 20; | ||
|
||
if (!$initName) { | ||
$this->gender = 'M'; | ||
|
||
return; | ||
} | ||
|
||
$this->name = 'John'; | ||
} | ||
} | ||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector\Fixture; | ||
|
||
final class DonotChangeHasBeforeIf | ||
{ | ||
private $name; | ||
private $age = 20; | ||
private $gender; | ||
|
||
public function __construct(bool $initName = true) | ||
{ | ||
if (!$initName) { | ||
$this->gender = 'M'; | ||
|
||
return; | ||
} | ||
|
||
$this->name = 'John'; | ||
} | ||
} | ||
?> |