Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeDeclaration] Skip default not array type on StrictArrayParamDimF…
…etchRector (#5259) * [TypeDeclaration] Skip default not array type on StrictArrayParamDimFetchRector * fixed 🎉
- Loading branch information
1 parent
4a3e698
commit 03c7ab7
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...or/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_default_not_array_type.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,15 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector\Fixture; | ||
|
||
final class SkipDefaultNotArrayType | ||
{ | ||
public function run($param = 'foo') | ||
{ | ||
if (isset($param['bar'])) { | ||
echo $param['bar']; | ||
} | ||
|
||
echo $param; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...or/ClassMethod/StrictArrayParamDimFetchRector/Fixture/with_default_not_array_type.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,35 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector\Fixture; | ||
|
||
final class WithDefaultArrayType | ||
{ | ||
public function run($param = []) | ||
{ | ||
if (isset($param['bar'])) { | ||
echo $param['bar']; | ||
} | ||
|
||
echo $param; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector\Fixture; | ||
|
||
final class WithDefaultArrayType | ||
{ | ||
public function run(array $param = []) | ||
{ | ||
if (isset($param['bar'])) { | ||
echo $param['bar']; | ||
} | ||
|
||
echo $param; | ||
} | ||
} | ||
|
||
?> |
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