-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0e4083
commit 1d598ea
Showing
3 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...Method/AddReturnArrayDocblockBasedOnArrayMapRector/Fixture/include_arrow_function.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,30 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddReturnArrayDocblockBasedOnArrayMapRector\Fixture; | ||
|
||
final class IncludeArrowFunction | ||
{ | ||
public function run(array $items) | ||
{ | ||
return array_map(fn ($item): int => 1000, $items); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddReturnArrayDocblockBasedOnArrayMapRector\Fixture; | ||
|
||
final class IncludeArrowFunction | ||
{ | ||
/** | ||
* @return int[] | ||
*/ | ||
public function run(array $items) | ||
{ | ||
return array_map(fn ($item): int => 1000, $items); | ||
} | ||
} | ||
|
||
?> |
46 changes: 46 additions & 0 deletions
46
...or/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector/Fixture/multiple_types.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,46 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddReturnArrayDocblockBasedOnArrayMapRector\Fixture; | ||
|
||
final class MultipleTypes | ||
{ | ||
public function run(array $items) | ||
{ | ||
if (mt_rand(0, 1)) { | ||
return array_map(function ($item): int { | ||
return $item; | ||
}, $items); | ||
} | ||
|
||
return array_map(function ($item): string { | ||
return '1000'; | ||
}, $items); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddReturnArrayDocblockBasedOnArrayMapRector\Fixture; | ||
|
||
final class MultipleTypes | ||
{ | ||
/** | ||
* @return int[]|string[] | ||
*/ | ||
public function run(array $items) | ||
{ | ||
if (mt_rand(0, 1)) { | ||
return array_map(function ($item): int { | ||
return $item; | ||
}, $items); | ||
} | ||
|
||
return array_map(function ($item): string { | ||
return '1000'; | ||
}, $items); | ||
} | ||
} | ||
|
||
?> |
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