File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
src/Symfony/Component/Intl Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -177,4 +177,18 @@ public function testReverse()
177177 $ this ->expectException (\IntlException::class);
178178 EmojiTransliterator::create ('emoji-en ' , EmojiTransliterator::REVERSE );
179179 }
180+
181+ public function testGetErrorCodeWithUninitializedTransliterator ()
182+ {
183+ $ transliterator = EmojiTransliterator::create ('emoji-en ' );
184+
185+ $ this ->assertSame (0 , $ transliterator ->getErrorCode ());
186+ }
187+
188+ public function testGetErrorMessageWithUninitializedTransliterator ()
189+ {
190+ $ transliterator = EmojiTransliterator::create ('emoji-en ' );
191+
192+ $ this ->assertFalse ($ transliterator ->getErrorMessage ());
193+ }
180194}
Original file line number Diff line number Diff line change @@ -72,12 +72,12 @@ public function createInverse(): self
7272
7373 public function getErrorCode (): int |false
7474 {
75- return $ this ->transliterator ?-> getErrorCode() ?? 0 ;
75+ return isset ( $ this ->transliterator ) ? $ this -> transliterator -> getErrorCode () : 0 ;
7676 }
7777
7878 public function getErrorMessage (): string |false
7979 {
80- return $ this ->transliterator ?-> getErrorMessage() ?? false ;
80+ return isset ( $ this ->transliterator ) ? $ this -> transliterator -> getErrorMessage () : false ;
8181 }
8282
8383 public static function listIDs (): array
You can’t perform that action at this time.
0 commit comments