parseChain array result support

{$var->func()->func()->props->func().array_key}
This commit is contained in:
Maksim 2018-03-14 22:41:37 +03:00 committed by GitHub
parent 7b0dab9247
commit 5dd197ffac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -950,6 +950,10 @@ class Template extends Render
if ($tokens->is(T_OBJECT_OPERATOR) && $tokens->isNext(T_STRING)) {
$code .= '->' . $tokens->next()->getAndNext();
}
if ($tokens->current() === "." || $tokens->current() === "[") {
$code = substr($code, 0, -strlen($tokens->prev[1]));
$code .= $this->parseVariable($tokens, $tokens->prev[1]);
}
} while ($tokens->is('(', T_OBJECT_OPERATOR));
return $code;