-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Handle Generic TemplateType on ClassPropertyAssignToConstruct…
…orPromotionRector (#751) * Add failing test fixture for ClassPropertyAssignToConstructorPromotionRector # Failing Test for ClassPropertyAssignToConstructorPromotionRector Based on https://getrector.org/demo/1ec04a84-bde1-6cb0-a397-d7c0f606a738 * Closes #749 * naming * phpstan * early check is param used before assign Co-authored-by: Jáchym Toušek <enumag@gmail.com>
- Loading branch information
1 parent
6ff80ba
commit 885ef76
Showing
2 changed files
with
72 additions
and
9 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...p80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector/Fixture/generic.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,41 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture; | ||
|
||
/** | ||
* @template T | ||
*/ | ||
final class Generic | ||
{ | ||
/** | ||
* @var T | ||
*/ | ||
public mixed $value; | ||
|
||
/** | ||
* @param T $value | ||
*/ | ||
public function __construct(mixed $value) | ||
{ | ||
$this->value = $value; | ||
} | ||
} | ||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture; | ||
|
||
/** | ||
* @template T | ||
*/ | ||
final class Generic | ||
{ | ||
/** | ||
* @param T $value | ||
*/ | ||
public function __construct(public mixed $value) | ||
{ | ||
} | ||
} | ||
?> |
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