-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Handle Iterable typed on ClassPropertyAssignToConstructorProm…
…otionRector (#753) Co-authored-by: Jáchym Toušek <enumag@gmail.com>
- Loading branch information
1 parent
f78ffe3
commit aa22210
Showing
3 changed files
with
85 additions
and
16 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...tor/Class_/ClassPropertyAssignToConstructorPromotionRector/Fixture/iterable_typed.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,35 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture; | ||
|
||
class IterableTyped | ||
{ | ||
/** | ||
* @var iterable<string> | ||
*/ | ||
private iterable $property; | ||
|
||
/** | ||
* @param iterable<string> $property | ||
*/ | ||
public function __construct(iterable $property) | ||
{ | ||
$this->property = $property; | ||
} | ||
} | ||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture; | ||
|
||
class IterableTyped | ||
{ | ||
/** | ||
* @param iterable<string> $property | ||
*/ | ||
public function __construct(private iterable $property) | ||
{ | ||
} | ||
} | ||
?> |
34 changes: 34 additions & 0 deletions
34
...Rector/Class_/ClassPropertyAssignToConstructorPromotionRector/Fixture/union_typed.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,34 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture; | ||
|
||
use stdClass; | ||
use DateTime; | ||
|
||
final class UnionTyped | ||
{ | ||
public stdClass|DateTime $property; | ||
|
||
public function __construct(stdClass|DateTime $property) | ||
{ | ||
$this->property = $property; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture; | ||
|
||
use stdClass; | ||
use DateTime; | ||
|
||
final class UnionTyped | ||
{ | ||
public function __construct(public stdClass|DateTime $property) | ||
{ | ||
} | ||
} | ||
|
||
?> |
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