Skip to content

Commit f07ff79

Browse files
Fix perf and mem issue when using token_get_all
1 parent ec75d28 commit f07ff79

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Translation/PhpExtractor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function setPrefix($prefix)
8181
*/
8282
protected function normalizeToken($token)
8383
{
84-
if (is_array($token)) {
84+
if (isset($token[1]) && 'b"' !== $token) {
8585
return $token[1];
8686
}
8787

@@ -95,7 +95,7 @@ private function seekToNextRelevantToken(\Iterator $tokenIterator)
9595
{
9696
for (; $tokenIterator->valid(); $tokenIterator->next()) {
9797
$t = $tokenIterator->current();
98-
if (!is_array($t) || ($t[0] !== T_WHITESPACE)) {
98+
if (T_WHITESPACE !== $t[0]) {
9999
break;
100100
}
101101
}
@@ -112,7 +112,7 @@ private function getMessage(\Iterator $tokenIterator)
112112

113113
for (; $tokenIterator->valid(); $tokenIterator->next()) {
114114
$t = $tokenIterator->current();
115-
if (!is_array($t)) {
115+
if (!isset($t[1])) {
116116
break;
117117
}
118118

0 commit comments

Comments
 (0)