-
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeDeclaration] Add init assign method call support on ReturnTypeFr…
…omStrictNewArrayRector (#4929)
- Loading branch information
1 parent
2a697f7
commit e47f631
Showing
3 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
...or/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/init_assign_method_call.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,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector\Fixture; | ||
|
||
use Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector\Source\OrderRepository; | ||
|
||
final class InitAssignMethodCall | ||
{ | ||
public function fetchAllForBuyer(OrderRepository $orderRepository) | ||
{ | ||
$orders = $orderRepository->fetchAllForBuyer(); | ||
|
||
foreach ($orders as $order) { | ||
|
||
} | ||
|
||
return $orders; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector\Fixture; | ||
|
||
use Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector\Source\OrderRepository; | ||
|
||
final class InitAssignMethodCall | ||
{ | ||
/** | ||
* @return mixed[] | ||
*/ | ||
public function fetchAllForBuyer(OrderRepository $orderRepository): array | ||
{ | ||
$orders = $orderRepository->fetchAllForBuyer(); | ||
|
||
foreach ($orders as $order) { | ||
|
||
} | ||
|
||
return $orders; | ||
} | ||
} | ||
|
||
?> |
12 changes: 12 additions & 0 deletions
12
...laration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Source/OrderRepository.php
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,12 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector\Source; | ||
|
||
final class OrderRepository | ||
{ | ||
public function fetchAllForBuyer(): array | ||
{ | ||
return []; | ||
} | ||
} |
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