Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 19df3db

Browse files
committed
fix EmojiTransliterator return type compatibility with PHP 8.5
1 parent f43ca7e commit 19df3db

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

.github/expected-missing-return-types.diff

+17
Original file line numberDiff line numberDiff line change
@@ -8923,6 +8923,23 @@ diff --git a/src/Symfony/Component/Intl/Data/Bundle/Writer/BundleWriterInterface
89238923
- public function write(string $path, string $locale, mixed $data);
89248924
+ public function write(string $path, string $locale, mixed $data): void;
89258925
}
8926+
diff --git a/src/Symfony/Component/Intl/Transliterator/EmojiTransliterator.php b/src/Symfony/Component/Intl/Transliterator/EmojiTransliterator.php
8927+
--- a/src/Symfony/Component/Intl/Transliterator/EmojiTransliterator.php
8928+
+++ b/src/Symfony/Component/Intl/Transliterator/EmojiTransliterator.php
8929+
@@ -74,5 +74,5 @@ if (!class_exists(\Transliterator::class)) {
8930+
*/
8931+
#[\ReturnTypeWillChange]
8932+
- public function getErrorCode(): int|false
8933+
+ public function getErrorCode(): int
8934+
{
8935+
return isset($this->transliterator) ? $this->transliterator->getErrorCode() : 0;
8936+
@@ -83,5 +83,5 @@ if (!class_exists(\Transliterator::class)) {
8937+
*/
8938+
#[\ReturnTypeWillChange]
8939+
- public function getErrorMessage(): string|false
8940+
+ public function getErrorMessage(): string
8941+
{
8942+
return isset($this->transliterator) ? $this->transliterator->getErrorMessage() : '';
89268943
diff --git a/src/Symfony/Component/Intl/Util/IntlTestHelper.php b/src/Symfony/Component/Intl/Util/IntlTestHelper.php
89278944
--- a/src/Symfony/Component/Intl/Util/IntlTestHelper.php
89288945
+++ b/src/Symfony/Component/Intl/Util/IntlTestHelper.php

src/Symfony/Component/Intl/Tests/Transliterator/EmojiTransliteratorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,6 @@ public function testGetErrorMessageWithUninitializedTransliterator()
189189
{
190190
$transliterator = EmojiTransliterator::create('emoji-en');
191191

192-
$this->assertFalse($transliterator->getErrorMessage());
192+
$this->assertSame('', $transliterator->getErrorMessage());
193193
}
194194
}

src/Symfony/Component/Intl/Transliterator/EmojiTransliterator.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,22 @@ public function createInverse(): self
7070
return self::create($this->id, self::REVERSE);
7171
}
7272

73+
/**
74+
* @return int
75+
*/
76+
#[\ReturnTypeWillChange]
7377
public function getErrorCode(): int|false
7478
{
7579
return isset($this->transliterator) ? $this->transliterator->getErrorCode() : 0;
7680
}
7781

82+
/**
83+
* @return string
84+
*/
85+
#[\ReturnTypeWillChange]
7886
public function getErrorMessage(): string|false
7987
{
80-
return isset($this->transliterator) ? $this->transliterator->getErrorMessage() : false;
88+
return isset($this->transliterator) ? $this->transliterator->getErrorMessage() : '';
8189
}
8290

8391
public static function listIDs(): array

0 commit comments

Comments
 (0)