Skip to content

Commit 1cb07fa

Browse files
committed
Merge branch 'QA'
Signed-off-by: William Desportes <[email protected]>
2 parents 6b05c19 + 833fb1e commit 1cb07fa

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Components/ExpressionArray.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,13 @@ public static function parse(Parser $parser, TokensList $list, array $options =
106106
--$list->idx;
107107

108108
if (is_array($ret)) {
109-
$expr = $ret[count($ret) - 1]->expr;
110-
if (preg_match('/\s*--\s.*$/', $expr, $matches)) {
111-
$found = $matches[0];
112-
$ret[count($ret) - 1]->expr = substr($expr, 0, strlen($expr) - strlen($found));
109+
$retIndex = count($ret) - 1;
110+
if (isset($ret[$retIndex])) {
111+
$expr = $ret[$retIndex]->expr;
112+
if (preg_match('/\s*--\s.*$/', $expr, $matches)) {
113+
$found = $matches[0];
114+
$ret[$retIndex]->expr = substr($expr, 0, strlen($expr) - strlen($found));
115+
}
113116
}
114117
}
115118

0 commit comments

Comments
 (0)