Skip to content

Commit 0bf9041

Browse files
committed
[Translator] Improve performance, remove (internally) duplicated call to ->slice($offset, 1)
1 parent 18eac63 commit 0bf9041

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Translator/src/Intl/IntlMessageParser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\UX\Translator\Intl;
1313

1414
use Symfony\Component\String\AbstractString;
15+
1516
use function Symfony\Component\String\s;
1617

1718
/**
@@ -883,7 +884,7 @@ private function char(): int
883884
throw new \OutOfBoundsException();
884885
}
885886

886-
$code = $this->message->slice($offset, 1)->codePointsAt(0)[0] ?? null;
887+
$code = $this->message->codePointsAt($offset)[0] ?? null;
887888
if (null === $code) {
888889
throw new \Exception("Offset {$offset} is at invalid UTF-16 code unit boundary");
889890
}

0 commit comments

Comments
 (0)