merge from yiisoft/yii2

This commit is contained in:
cuileon
2018-11-14 11:57:32 +08:00
parent 47df8a8cc0
commit 489dd119a5
426 changed files with 18465 additions and 4215 deletions

View File

@ -501,7 +501,7 @@ EOD;
$buffer = [];
$pendingParenthesisCount = 0;
foreach ($tokens as $token) {
foreach ($tokens as $i => $token) {
// finding out translator call
if ($matchedTokensCount < $translatorTokensCount) {
if ($this->tokensEqual($token, $translatorTokens[$matchedTokensCount])) {
@ -556,6 +556,13 @@ EOD;
}
} elseif ($this->tokensEqual('(', $token)) {
// count beginning of function call, skipping translator beginning
// Ensure that it's not the call of the object method. See https://github.com/yiisoft/yii2/issues/16828
$previousTokenId = $tokens[$i - $matchedTokensCount - 1][0];
if (in_array($previousTokenId, [T_OBJECT_OPERATOR, T_PAAMAYIM_NEKUDOTAYIM], true)) {
$matchedTokensCount = 0;
continue;
}
if ($pendingParenthesisCount > 0) {
$buffer[] = $token;
}