Skip to content

Commit

Permalink
[Translator] Mark classes from "Intl/*.php" as final and internal
Browse files Browse the repository at this point in the history
  • Loading branch information
Kocal committed Sep 26, 2024
1 parent f5e84c5 commit 4f3c9e4
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Translator/src/Intl/ErrorKind.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Adapted from https://github.com/formatjs/formatjs/blob/590f1f81b26934c6dc7a55fff938df5436c6f158/packages/icu-messageformat-parser/error.ts#L9-L77.
*
* @experimental
* @internal
*/
final class ErrorKind
{
Expand Down
10 changes: 5 additions & 5 deletions src/Translator/src/Intl/IntlMessageParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
/**
* Adapted from https://github.com/formatjs/formatjs/blob/590f1f81b26934c6dc7a55fff938df5436c6f158/packages/icu-messageformat-parser/parser.ts.
*
* @experimental
* @internal
*/
class IntlMessageParser
final class IntlMessageParser
{
private readonly AbstractString $message;
// Minor optimization, this avoid a lot of calls to `$this->message->length()`
Expand Down Expand Up @@ -890,7 +890,7 @@ private function char(): int

$code = $this->message->codePointsAt($offset)[0] ?? null;
if (null === $code) {
throw new \Exception("Offset {$offset} is at invalid UTF-16 code unit boundary");
throw new \Exception("Offset {$offset} is at invalid UTF-16 code unit boundary.");
}

return $code;
Expand Down Expand Up @@ -978,7 +978,7 @@ private function bumpUntil(string $pattern): bool
private function bumpTo(int $targetOffset)
{
if ($this->position->offset > $targetOffset) {
throw new \Exception(\sprintf('targetOffset %s must be greater than or equal to the current offset %d', $targetOffset, $this->position->offset));
throw new \Exception(\sprintf('targetOffset "%s" must be greater than or equal to the current offset %d', $targetOffset, $this->position->offset));
}

$targetOffset = min($targetOffset, $this->messageLength);
Expand All @@ -988,7 +988,7 @@ private function bumpTo(int $targetOffset)
break;
}
if ($offset > $targetOffset) {
throw new \Exception("targetOffset {$targetOffset} is at invalid UTF-16 code unit boundary");
throw new \Exception("targetOffset {$targetOffset} is at invalid UTF-16 code unit boundary.");
}

$this->bump();
Expand Down
2 changes: 1 addition & 1 deletion src/Translator/src/Intl/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Adapted from https://github.com/formatjs/formatjs/blob/590f1f81b26934c6dc7a55fff938df5436c6f158/packages/icu-messageformat-parser/types.ts#L58-L61.
*
* @experimental
* @internal
*/
final class Location
{
Expand Down
2 changes: 1 addition & 1 deletion src/Translator/src/Intl/Position.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Adapted from https://github.com/formatjs/formatjs/blob/590f1f81b26934c6dc7a55fff938df5436c6f158/packages/icu-messageformat-parser/types.ts#L53-L57.
*
* @experimental
* @internal
*/
final class Position
{
Expand Down
2 changes: 1 addition & 1 deletion src/Translator/src/Intl/SkeletonType.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Adapted from https://github.com/formatjs/formatjs/blob/590f1f81b26934c6dc7a55fff938df5436c6f158/packages/icu-messageformat-parser/types.ts#L48-L51.
*
* @experimental
* @internal
*/
final class SkeletonType
{
Expand Down
2 changes: 1 addition & 1 deletion src/Translator/src/Intl/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Adapted from https://github.com/formatjs/formatjs/blob/590f1f81b26934c6dc7a55fff938df5436c6f158/packages/icu-messageformat-parser/types.ts#L8-L46.
*
* @experimental
* @internal
*/
final class Type
{
Expand Down
2 changes: 1 addition & 1 deletion src/Translator/src/Intl/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\String\AbstractString;

/**
* @experimental
* @internal
*/
final class Utils
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* @author Hugo Alliaume <hugo@alliau.me>
*
* @experimental
* @internal
*/
interface ExtractorInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @author Hugo Alliaume <hugo@alliau.me>
*
* @experimental
* @internal
*/
final class IntlMessageParametersExtractor implements ExtractorInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* @author Hugo Alliaume <hugo@alliau.me>
*
* @experimental
* @internal
*/
final class MessageParametersExtractor implements ExtractorInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* @author Hugo Alliaume <hugo@alliau.me>
*
* @experimental
* @internal
*/
final class TypeScriptMessageParametersPrinter
{
Expand Down

0 comments on commit 4f3c9e4

Please sign in to comment.