-
-
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.
[DowngradePhp80] Do not change correct Union array docblock to mixed[…
…] on DowngradeUnionTypeDeclarationRector (#2555) * [DowngradePhp80] Do not change correct Union array docblock on DowngradeUnionTypeDeclarationRector * Fixed 🎉 * ensure @return tag exists * fix * final touch: check both on param and return * clean up * updated failign test case * move sub type check to PhpDocTypeChanger * Fixed 🎉 * cs * final touch: variable cleanup * final touch: variable cleanup
- Loading branch information
1 parent
574e000
commit 005ca33
Showing
3 changed files
with
109 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
51 changes: 51 additions & 0 deletions
51
...TypeDeclarationRector/Fixture/do_not_change_correct_union_array_docblock_on_param.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\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector\Fixture; | ||
|
||
use PhpParser\Node; | ||
use PhpParser\Node\Stmt; | ||
|
||
final class DoNotChangeCorrectUnionArrayDocblockOnParam | ||
{ | ||
/** | ||
* @param int|string[] | ||
*/ | ||
public function run(int|array $data) | ||
{ | ||
} | ||
|
||
/** | ||
* @param Node|null|Stmt[] | ||
*/ | ||
public function run2(Node|null|array $data) | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector\Fixture; | ||
|
||
use PhpParser\Node; | ||
use PhpParser\Node\Stmt; | ||
|
||
final class DoNotChangeCorrectUnionArrayDocblockOnParam | ||
{ | ||
/** | ||
* @param int|string[] | ||
*/ | ||
public function run($data) | ||
{ | ||
} | ||
|
||
/** | ||
* @param Node|null|Stmt[] | ||
*/ | ||
public function run2($data) | ||
{ | ||
} | ||
} | ||
|
||
?> |
51 changes: 51 additions & 0 deletions
51
...ypeDeclarationRector/Fixture/do_not_change_correct_union_array_docblock_on_return.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\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector\Fixture; | ||
|
||
use PhpParser\Node; | ||
use PhpParser\Node\Stmt; | ||
|
||
final class DoNotChangeCorrectUnionArrayDocblockOnReturn | ||
{ | ||
/** | ||
* @return int|string[] | ||
*/ | ||
public function run(): int|array | ||
{ | ||
} | ||
|
||
/** | ||
* @return Node|null|Stmt[] | ||
*/ | ||
public function run2(): Node|null|array | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector\Fixture; | ||
|
||
use PhpParser\Node; | ||
use PhpParser\Node\Stmt; | ||
|
||
final class DoNotChangeCorrectUnionArrayDocblockOnReturn | ||
{ | ||
/** | ||
* @return int|string[] | ||
*/ | ||
public function run() | ||
{ | ||
} | ||
|
||
/** | ||
* @return Node|null|Stmt[] | ||
*/ | ||
public function run2() | ||
{ | ||
} | ||
} | ||
|
||
?> |