-
-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php81] Remove @readonly doc on transformation to native readonly on …
…ReadOnlyPropertyRector (#5789) * [Php81] Remove @readonly doc on transformation to native readonly on ReadOnlyPropertyRector * add test for prop promotion * more test * fix phpstan
- Loading branch information
1 parent
9b4ad93
commit 717e3e0
Showing
6 changed files
with
202 additions
and
1 deletion.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...lyPropertyRector/Fixture/keep_readonly_doc_on_property_promotion_with_description.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,31 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
final class KeepReadonlyDocOnPropertyPromotionWithDescription | ||
{ | ||
private function __construct( | ||
/** | ||
* @readonly some desc | ||
*/ | ||
private string $id | ||
){} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
final class KeepReadonlyDocOnPropertyPromotionWithDescription | ||
{ | ||
private function __construct( | ||
/** | ||
* @readonly some desc | ||
*/ | ||
private readonly string $id | ||
){} | ||
} | ||
|
||
?> |
47 changes: 47 additions & 0 deletions
47
...rty/ReadOnlyPropertyRector/Fixture/keep_readonly_doc_on_property_with_description.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\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
final class KeepReadonlyDocOnPropertyWithDescription | ||
{ | ||
/** | ||
* @readonly some description | ||
*/ | ||
private string $name; | ||
|
||
public function __construct(string $name) | ||
{ | ||
$this->name = $name; | ||
} | ||
|
||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
final class KeepReadonlyDocOnPropertyWithDescription | ||
{ | ||
/** | ||
* @readonly some description | ||
*/ | ||
private readonly string $name; | ||
|
||
public function __construct(string $name) | ||
{ | ||
$this->name = $name; | ||
} | ||
|
||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
} | ||
|
||
?> |
44 changes: 44 additions & 0 deletions
44
...81/Rector/Property/ReadOnlyPropertyRector/Fixture/remove_readonly_doc_on_property.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,44 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
final class RemoveReadonlyDocOnProperty | ||
{ | ||
/** | ||
* @readonly | ||
*/ | ||
private string $name; | ||
|
||
public function __construct(string $name) | ||
{ | ||
$this->name = $name; | ||
} | ||
|
||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
final class RemoveReadonlyDocOnProperty | ||
{ | ||
private readonly string $name; | ||
|
||
public function __construct(string $name) | ||
{ | ||
$this->name = $name; | ||
} | ||
|
||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
} | ||
|
||
?> |
26 changes: 26 additions & 0 deletions
26
...Property/ReadOnlyPropertyRector/Fixture/remove_readonly_doc_on_property_promotion.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,26 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
final class WithReadonlyDocOnPropertyPromotion | ||
{ | ||
private function __construct( | ||
/** @readonly */ | ||
private string $id | ||
){} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
final class WithReadonlyDocOnPropertyPromotion | ||
{ | ||
private function __construct( | ||
private readonly string $id | ||
){} | ||
} | ||
|
||
?> |
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
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