1818/**
1919 * Adapted from https://github.com/formatjs/formatjs/blob/590f1f81b26934c6dc7a55fff938df5436c6f158/packages/icu-messageformat-parser/parser.ts.
2020 *
21- * @experimental
21+ * @internal
2222 */
23- class IntlMessageParser
23+ final class IntlMessageParser
2424{
2525 private readonly AbstractString $ message ;
2626 // Minor optimization, this avoid a lot of calls to `$this->message->length()`
@@ -890,7 +890,7 @@ private function char(): int
890890
891891 $ code = $ this ->message ->codePointsAt ($ offset )[0 ] ?? null ;
892892 if (null === $ code ) {
893- throw new \Exception ("Offset {$ offset } is at invalid UTF-16 code unit boundary " );
893+ throw new \Exception ("Offset {$ offset } is at invalid UTF-16 code unit boundary. " );
894894 }
895895
896896 return $ code ;
@@ -978,7 +978,7 @@ private function bumpUntil(string $pattern): bool
978978 private function bumpTo (int $ targetOffset )
979979 {
980980 if ($ this ->position ->offset > $ targetOffset ) {
981- throw new \Exception (\sprintf ('targetOffset %s must be greater than or equal to the current offset %d ' , $ targetOffset , $ this ->position ->offset ));
981+ throw new \Exception (\sprintf ('targetOffset "%s" must be greater than or equal to the current offset %d ' , $ targetOffset , $ this ->position ->offset ));
982982 }
983983
984984 $ targetOffset = min ($ targetOffset , $ this ->messageLength );
@@ -988,7 +988,7 @@ private function bumpTo(int $targetOffset)
988988 break ;
989989 }
990990 if ($ offset > $ targetOffset ) {
991- throw new \Exception ("targetOffset {$ targetOffset } is at invalid UTF-16 code unit boundary " );
991+ throw new \Exception ("targetOffset {$ targetOffset } is at invalid UTF-16 code unit boundary. " );
992992 }
993993
994994 $ this ->bump ();
0 commit comments