-
-
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.
[Core] Handle parent return/assign from FuncCall with No Scope (#2525)
- Loading branch information
1 parent
3e6c9cf
commit 372e030
Showing
23 changed files
with
295 additions
and
201 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
...FuncCall/DowngradeArrayIsListRector/Fixture/no_scope_parent_assign_from_func_call.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\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector\Fixture; | ||
|
||
final class Loop | ||
{ | ||
/** | ||
* @var LoopInterface | ||
*/ | ||
private static $instance; | ||
|
||
public static function get() | ||
{ | ||
if (self::$instance instanceof LoopInterface) { | ||
return self::$instance; | ||
} | ||
|
||
register_shutdown_function(function () { | ||
$test = array_is_list([]); | ||
}); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector\Fixture; | ||
|
||
final class Loop | ||
{ | ||
/** | ||
* @var LoopInterface | ||
*/ | ||
private static $instance; | ||
|
||
public static function get() | ||
{ | ||
if (self::$instance instanceof LoopInterface) { | ||
return self::$instance; | ||
} | ||
|
||
register_shutdown_function(function () { | ||
$arrayIsList = function (array $array) : bool { | ||
if (function_exists('array_is_list')) { | ||
return array_is_list($array); | ||
} | ||
if ($array === []) { | ||
return true; | ||
} | ||
$current_key = 0; | ||
foreach ($array as $key => $noop) { | ||
if ($key !== $current_key) { | ||
return false; | ||
} | ||
++$current_key; | ||
} | ||
return true; | ||
}; | ||
$test = $arrayIsList([]); | ||
}); | ||
} | ||
} | ||
|
||
?> |
Oops, something went wrong.