-
-
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.
[TypeDeclaration] Do not remove multiple docblocks with comment on Ty…
…pedPropertyFromAssignsRector (#3263) * [TypeDeclaration] Do not remove multiple comments on TypedPropertyFromAssignsRector more fixture rules-tests Fix Fixed 🎉 final touch: eol Final touch: return null on multiple docs updated to mark Doc as Comment when not in last, as the used one is last Final touch: clean up [ci-review] Rector Rectify apply setDocComment after set comments attribute failing fixture preserve multiple docs no change type create another attribute to save previous docs * Try using new main doc * phpstan * [ci-review] Rector Rectify * [ci-review] Rector Rectify * Final touch: move to DocblockUpdater * Final touch: clean up * Final touch: clean up * Really Really Final touch: add comment Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
27d5714
commit 8c439cf
Showing
6 changed files
with
217 additions
and
1 deletion.
There are no files selected for viewing
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
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
44 changes: 44 additions & 0 deletions
44
...ty/TypedPropertyFromAssignsRector/Fixture/do_not_remove_multiple_docblock_comment.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\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector\Fixture; | ||
|
||
final class DoNotRemoveMultipleDocblockComment | ||
{ | ||
// A comment | ||
|
||
/** | ||
* Another comment | ||
*/ | ||
|
||
/** | ||
* @var \DateTime | ||
*/ | ||
private $property; | ||
|
||
public function __construct() | ||
{ | ||
$this->property = new \DateTime(); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector\Fixture; | ||
|
||
final class DoNotRemoveMultipleDocblockComment | ||
{ | ||
// A comment | ||
/** | ||
* Another comment | ||
*/ | ||
private \DateTime $property; | ||
|
||
public function __construct() | ||
{ | ||
$this->property = new \DateTime(); | ||
} | ||
} | ||
|
||
?> |
49 changes: 49 additions & 0 deletions
49
.../TypedPropertyFromAssignsRector/Fixture/do_not_remove_multiple_docblock_comment_2.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,49 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector\Fixture; | ||
|
||
final class DoNotRemoveMultipleDocblockComment2 | ||
{ | ||
// A comment | ||
|
||
/** | ||
* Another comment | ||
*/ | ||
|
||
/** | ||
* Another comment inside main doc | ||
* | ||
* @var \DateTime | ||
*/ | ||
private $property; | ||
|
||
public function __construct() | ||
{ | ||
$this->property = new \DateTime(); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector\Fixture; | ||
|
||
final class DoNotRemoveMultipleDocblockComment2 | ||
{ | ||
// A comment | ||
/** | ||
* Another comment | ||
*/ | ||
/** | ||
* Another comment inside main doc | ||
*/ | ||
private \DateTime $property; | ||
|
||
public function __construct() | ||
{ | ||
$this->property = new \DateTime(); | ||
} | ||
} | ||
|
||
?> |
49 changes: 49 additions & 0 deletions
49
.../Property/TypedPropertyFromAssignsRector/Fixture/preserve_multiple_docs_no_change.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,49 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector\Fixture; | ||
|
||
final class PreserveMultipleDocsNoChange | ||
{ | ||
// A comment | ||
|
||
/** | ||
* Another comment | ||
*/ | ||
|
||
/** | ||
* @var class-string | ||
*/ | ||
private $property; | ||
|
||
public function __construct() | ||
{ | ||
$this->property = 'DateTime'; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector\Fixture; | ||
|
||
final class PreserveMultipleDocsNoChange | ||
{ | ||
// A comment | ||
|
||
/** | ||
* Another comment | ||
*/ | ||
|
||
/** | ||
* @var class-string | ||
*/ | ||
private string $property; | ||
|
||
public function __construct() | ||
{ | ||
$this->property = 'DateTime'; | ||
} | ||
} | ||
|
||
?> |