-
-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix StrictArrayParamDimFetchRector on
is_*
calls (#4486)
* StrictArrayParamDimFetchRector failing test * Rename string_array_union.php.inc to skip_string_array_union.php.inc * more failling tests * fix * fix * Update StrictArrayParamDimFetchRector.php
- Loading branch information
Showing
5 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...eclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_bool.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,20 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector\Fixture; | ||
|
||
final class SkipIsBool | ||
{ | ||
private function getLabelsForIds($ids) | ||
{ | ||
if (is_bool($ids)) { | ||
$ids = explode(',', $ids); | ||
} | ||
if (! isset($ids[0])) { | ||
return ''; | ||
} | ||
|
||
if ('alle' === $ids[0]) { | ||
return $ids[0]; | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...claration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_float.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,20 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector\Fixture; | ||
|
||
final class SkipIsFloat | ||
{ | ||
private function getLabelsForIds($ids) | ||
{ | ||
if (is_float($ids)) { | ||
$ids = explode(',', $ids); | ||
} | ||
if (! isset($ids[0])) { | ||
return ''; | ||
} | ||
|
||
if ('alle' === $ids[0]) { | ||
return $ids[0]; | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...Declaration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_int.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,20 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector\Fixture; | ||
|
||
final class SkipIsInt | ||
{ | ||
private function getLabelsForIds($ids) | ||
{ | ||
if (is_int($ids)) { | ||
$ids = explode(',', $ids); | ||
} | ||
if (! isset($ids[0])) { | ||
return ''; | ||
} | ||
|
||
if ('alle' === $ids[0]) { | ||
return $ids[0]; | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...laration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_string.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,20 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector\Fixture; | ||
|
||
final class SkipIsString | ||
{ | ||
private function getLabelsForIds($ids) | ||
{ | ||
if (is_string($ids)) { | ||
$ids = explode(',', $ids); | ||
} | ||
if (! isset($ids[0])) { | ||
return ''; | ||
} | ||
|
||
if ('alle' === $ids[0]) { | ||
return $ids[0]; | ||
} | ||
} | ||
} |
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