-
-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Handle union collection of FullyQualifieds on ClassPropertyAs…
…signToConstructorPromotionRector (#722) Co-authored-by: Jáchym Toušek <enumag@gmail.com>
- Loading branch information
1 parent
c043528
commit 998029d
Showing
3 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...ropertyAssignToConstructorPromotionRector/Fixture/multi_unrelated_fully_qualified.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,32 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture; | ||
|
||
class MultiUnrelatedFullyQualified | ||
{ | ||
public \DateTime $x; | ||
public \stdClass $y; | ||
|
||
public function __construct( | ||
\DateTime $x, | ||
\stdClass $y | ||
) { | ||
$this->x = $x; | ||
$this->y = $y; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture; | ||
|
||
class MultiUnrelatedFullyQualified | ||
{ | ||
public function __construct(public \DateTime $x, public \stdClass $y) | ||
{ | ||
} | ||
} | ||
|
||
?> |
51 changes: 51 additions & 0 deletions
51
...ss_/ClassPropertyAssignToConstructorPromotionRector/Fixture/union_fully_qualified.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,51 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture; | ||
|
||
interface X {} | ||
|
||
class Y implements X {} | ||
|
||
class Z {} | ||
|
||
final class UnionFullyQualified | ||
{ | ||
public Y $y; | ||
|
||
public Z $z; | ||
|
||
public function __construct(Y $y, Z $z) | ||
{ | ||
$this->y = $y; | ||
$this->z = $z; | ||
} | ||
|
||
public function getX(): X | ||
{ | ||
return $this->y; | ||
} | ||
} | ||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture; | ||
|
||
interface X {} | ||
|
||
class Y implements X {} | ||
|
||
class Z {} | ||
|
||
final class UnionFullyQualified | ||
{ | ||
public function __construct(public Y $y, public Z $z) | ||
{ | ||
} | ||
|
||
public function getX(): X | ||
{ | ||
return $this->y; | ||
} | ||
} | ||
?> |
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