Skip to content

Commit

Permalink
Check size of callstack
Browse files Browse the repository at this point in the history
  • Loading branch information
florisbosch committed Jul 30, 2024
1 parent 45fca3e commit 176f55f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rules/Carbon/NodeFactory/CarbonCallFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ public function createFromDateTimeString(FullyQualified $carbonFullyQualified, S
$currentCall->args = [new Arg(new String_($rest))];

// Rebuild original call from callstack
foreach(array_reverse($callStack) as $call) {
$call->var = $currentCall;
$currentCall = $call;
if (count($callStack) > 0)) {
foreach(array_reverse($callStack) as $call) {
$call->var = $currentCall;
$currentCall = $call;
}
}

$carbonCall = $currentCall;
Expand Down

0 comments on commit 176f55f

Please sign in to comment.