-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Add empty array support to InlineArrayReturnAssignRector (
- Loading branch information
1 parent
dc6bd96
commit 01fc91e
Showing
12 changed files
with
286 additions
and
163 deletions.
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
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
32 changes: 32 additions & 0 deletions
32
.../CodeQuality/Rector/ClassMethod/InlineArrayReturnAssignRector/Fixture/empty_array.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,32 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector\Fixture; | ||
|
||
final class EmptyArray | ||
{ | ||
public function run() | ||
{ | ||
$person = []; | ||
|
||
$person[] = 'Timmy'; | ||
$person[] = 'Back'; | ||
|
||
return $person; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector\Fixture; | ||
|
||
final class EmptyArray | ||
{ | ||
public function run() | ||
{ | ||
return ['Timmy', 'Back']; | ||
} | ||
} | ||
|
||
?> |
38 changes: 38 additions & 0 deletions
38
...odeQuality/Rector/ClassMethod/InlineArrayReturnAssignRector/Fixture/keep_comments.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,38 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector\Fixture; | ||
|
||
final class KeepComments | ||
{ | ||
public function getPerson() | ||
{ | ||
$person = []; | ||
// name | ||
$person['name'] = 'Timmy'; | ||
// surname | ||
$person['surname'] = 'Back'; | ||
|
||
return $person; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector\Fixture; | ||
|
||
final class KeepComments | ||
{ | ||
public function getPerson() | ||
{ | ||
return [ | ||
// name | ||
'name' => 'Timmy', | ||
// surname | ||
'surname' => 'Back', | ||
]; | ||
} | ||
} | ||
|
||
?> |
Oops, something went wrong.