Skip to content

Commit

Permalink
test: inline constructor default when early return
Browse files Browse the repository at this point in the history
  • Loading branch information
Karim Pinchon committed Jul 27, 2022
1 parent 44eda96 commit 9501fa3
Showing 1 changed file with 47 additions and 0 deletions.
@@ -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';
}
}
?>

0 comments on commit 9501fa3

Please sign in to comment.