Skip to content

[Intl] Fixed return type of EmojiTransliterator::create() and some others methods #47297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ trait EmojiTransliteratorTrait
private array $map;
private \Transliterator $transliterator;

public static function create(string $id, int $direction = self::FORWARD): ?\Transliterator
public static function create(string $id, int $direction = self::FORWARD): self
{
$id = strtolower($id);

Expand Down Expand Up @@ -89,7 +89,7 @@ public static function create(string $id, int $direction = self::FORWARD): ?\Tra
return $instance;
}

public function createInverse(): ?self
public function createInverse(): self
{
return self::create($this->id, self::REVERSE);
}
Expand All @@ -104,11 +104,13 @@ public function getErrorMessage(): string|false
return $this->transliterator?->getErrorMessage() ?? false;
}

public static function listIDs(): array|false
public static function listIDs(): array
{
static $ids;
static $ids = [];

$ids = [];
if ($ids) {
return $ids;
}

foreach (scandir(\dirname(__DIR__).'/Resources/data/transliterator/emoji/') as $file) {
if (str_ends_with($file, '.php')) {
Expand Down