-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NodeTypeResolver] Handle optional array shape on native function lik…
…e with ArrayDimFetch (#5062) * [TypeDeclaration] Skip ArrayDimFetch for native array-shapes * Update native_array_shape.php.inc * Update skip_native_optional_array_shape.php.inc * Update native_array_shape.php.inc * Apply suggestions from code review Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com> * Apply suggestions from code review Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com> * Fix * [ci-review] Rector Rectify * [ci-review] Rector Rectify * Fix * fix * Revert "[ci-review] Rector Rectify" This reverts commit 2edc906. * revert * Fix * Fix * add space * clean up * move comment before --------- Co-authored-by: Markus Staab <markus.staab@redaxo.de> Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
36f0b4a
commit c3d2ccf
Showing
4 changed files
with
108 additions
and
21 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
31 changes: 31 additions & 0 deletions
31
...or/ClassMethod/AddMethodCallBasedStrictParamTypeRector/Fixture/native_array_shape.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,31 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector\Fixture; | ||
|
||
final class NativeArrayShape { | ||
private function doFoo() { | ||
$shape = pathinfo('/www/htdocs/inc/lib.inc.php'); | ||
$this->doBar($shape['basename']); | ||
} | ||
|
||
private function doBar($param) { | ||
|
||
} | ||
} | ||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector\Fixture; | ||
|
||
final class NativeArrayShape { | ||
private function doFoo() { | ||
$shape = pathinfo('/www/htdocs/inc/lib.inc.php'); | ||
$this->doBar($shape['basename']); | ||
} | ||
|
||
private function doBar(string $param) { | ||
|
||
} | ||
} | ||
?> |
15 changes: 15 additions & 0 deletions
15
.../AddMethodCallBasedStrictParamTypeRector/Fixture/skip_native_optional_array_shape.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\AddMethodCallBasedStrictParamTypeRector\Fixture; | ||
|
||
final class SkipNativeOptionalShape { | ||
private function doFoo() { | ||
$shape = pathinfo(''); | ||
$this->doBar($shape['dirname']); // dirname is only conditionally returned | ||
} | ||
|
||
private function doBar($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