-
-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge InArrayAndArrayKeysToArrayKeyExistsRector to ArrayKeysAndInArra…
…yToArrayKeyExistsRector with almost identical behavior (#2047)
- Loading branch information
1 parent
9b8e161
commit 0227d24
Showing
10 changed files
with
140 additions
and
284 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
33 changes: 33 additions & 0 deletions
33
...ector/FuncCall/ArrayKeysAndInArrayToArrayKeyExistsRector/Fixture/another_in_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,33 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector\Fixture; | ||
|
||
final class AnotherInArray | ||
{ | ||
public function resultIntoAVariable(): void | ||
{ | ||
$array = ['foo', 'bar']; | ||
$key = 'key'; | ||
|
||
$result = in_array($key, array_keys($array), true); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector\Fixture; | ||
|
||
final class AnotherInArray | ||
{ | ||
public function resultIntoAVariable(): void | ||
{ | ||
$array = ['foo', 'bar']; | ||
$key = 'key'; | ||
|
||
$result = array_key_exists($key, $array); | ||
} | ||
} | ||
|
||
?> |
33 changes: 33 additions & 0 deletions
33
...FuncCall/ArrayKeysAndInArrayToArrayKeyExistsRector/Fixture/just_called_array_keys.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,33 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector\Fixture; | ||
|
||
final class JustCalledArrayKeys | ||
{ | ||
public function hasKey(): bool | ||
{ | ||
return !in_array('key', array_keys([ | ||
'key' => ',', | ||
1 => ';', | ||
])); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector\Fixture; | ||
|
||
final class JustCalledArrayKeys | ||
{ | ||
public function hasKey(): bool | ||
{ | ||
return !array_key_exists('key', [ | ||
'key' => ',', | ||
1 => ';', | ||
]); | ||
} | ||
} | ||
|
||
?> |
14 changes: 14 additions & 0 deletions
14
...yKeysAndInArrayToArrayKeyExistsRector/Fixture/skip_array_keys_with_extra_argument.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,14 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector\Fixture; | ||
|
||
final class SkipArrayKeysWithExtraArgument | ||
{ | ||
public function hasMoreThanOneArgument(): bool | ||
{ | ||
return in_array('key', array_keys([ | ||
'key' => ',', | ||
1 => ';', | ||
], 'key')); | ||
} | ||
} |
65 changes: 0 additions & 65 deletions
65
...Quality/Rector/FuncCall/InArrayAndArrayKeysToArrayKeyExistsRector/Fixture/fixture.php.inc
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
...ArrayAndArrayKeysToArrayKeyExistsRector/InArrayAndArrayKeysToArrayKeyExistsRectorTest.php
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...lity/Rector/FuncCall/InArrayAndArrayKeysToArrayKeyExistsRector/config/configured_rule.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.