Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php74][Php81] Allow mixed key on ArraySpreadInsteadOfArrayMergeRecto…
…r on php 8.1 version feature enabled (#5190) Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
5ac3cb3
commit a0d3244
Showing
44 changed files
with
182 additions
and
111 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
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
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
65 changes: 65 additions & 0 deletions
65
...s/Php74/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector/FixturePhp81/any_key.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,65 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php74\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector\FixturePhp81; | ||
|
||
class AnyKey | ||
{ | ||
/** | ||
* @return array<int> | ||
*/ | ||
public function getA(): array | ||
{ | ||
return [1, 2, 3]; | ||
} | ||
|
||
/** | ||
* @return array<int> | ||
*/ | ||
public function getB(): array | ||
{ | ||
return [4, 5, 6]; | ||
} | ||
|
||
public function run() | ||
{ | ||
$a = $this->getA(); | ||
$b = $this->getB(); | ||
|
||
return array_merge($a, $b); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php74\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector\FixturePhp81; | ||
|
||
class AnyKey | ||
{ | ||
/** | ||
* @return array<int> | ||
*/ | ||
public function getA(): array | ||
{ | ||
return [1, 2, 3]; | ||
} | ||
|
||
/** | ||
* @return array<int> | ||
*/ | ||
public function getB(): array | ||
{ | ||
return [4, 5, 6]; | ||
} | ||
|
||
public function run() | ||
{ | ||
$a = $this->getA(); | ||
$b = $this->getB(); | ||
|
||
return [...$a, ...$b]; | ||
} | ||
} | ||
|
||
?> |
11 changes: 11 additions & 0 deletions
11
...cCall/ArraySpreadInsteadOfArrayMergeRector/FixturePhp81/skip_first_class_callable.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,11 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php74\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector\FixturePhp81; | ||
|
||
class SkipFirstClassCallable | ||
{ | ||
public function run() | ||
{ | ||
array_merge(...); | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
...ArraySpreadInsteadOfArrayMergeRector/FixturePhp81/skip_string_keys_from_functions.php.inc
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
...Call/ArraySpreadInsteadOfArrayMergeRector/FixturePhp81/string_keys_from_functions.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,45 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php74\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector\FixturePhp81; | ||
|
||
function x(): array | ||
{ | ||
return ['b'=>1]; | ||
} | ||
function y(): array | ||
{ | ||
return ['a'=>1]; | ||
} | ||
|
||
class StringKeysFromFunctions | ||
{ | ||
public function run() | ||
{ | ||
return array_merge(y(), x()); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php74\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector\FixturePhp81; | ||
|
||
function x(): array | ||
{ | ||
return ['b'=>1]; | ||
} | ||
function y(): array | ||
{ | ||
return ['a'=>1]; | ||
} | ||
|
||
class StringKeysFromFunctions | ||
{ | ||
public function run() | ||
{ | ||
return [...y(), ...x()]; | ||
} | ||
} | ||
|
||
?> |
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
Oops, something went wrong.