@@ -35,8 +35,6 @@ final class StrictPoLoader extends Loader
3535 private $ warnings = [];
3636 /** @var bool */
3737 private $ isDisabled ;
38- /** @var bool */
39- private $ displayLineColumn ;
4038
4139 /**
4240 * Generates a Translations object from a .po based string
@@ -194,11 +192,11 @@ private function readQuotedString(?string $context = null): string
194192 case '\\' :
195193 $ data .= $ this ->readEscape ();
196194 break ;
197- // Unexpected newline
195+ // Unexpected newline
198196 case "\r" :
199197 case "\n" :
200198 throw new Exception ("Newline character must be escaped {$ this ->getErrorPosition ()}" );
201- // Unexpected end of file
199+ // Unexpected end of file
202200 case null :
203201 throw new Exception ("Expected a closing quote {$ this ->getErrorPosition ()}" );
204202 }
@@ -229,6 +227,7 @@ private function readEscape(): string
229227 return chr ($ decimal );
230228 case 'x ' :
231229 $ value = $ this ->readCharset ($ hexDigits , 1 , PHP_INT_MAX , 'hexadecimal ' );
230+
232231 // GNU reads all valid hexadecimal chars, but only uses the last pair
233232 return hex2bin (str_pad (substr ($ value , -2 ), 2 , '0 ' , STR_PAD_LEFT ));
234233 case 'U ' :
@@ -325,8 +324,15 @@ private function readIdentifier(string $identifier, bool $throwIfNotFound = fals
325324 */
326325 private function readContext (): bool
327326 {
328- return ($ data = $ this ->readIdentifier ('msgctxt ' )) !== null
329- && ($ this ->translation = $ this ->translation ->withContext ($ data ));
327+ $ data = $ this ->readIdentifier ('msgctxt ' );
328+
329+ if ($ data === null ) {
330+ return false ;
331+ }
332+
333+ $ this ->translation = $ this ->translation ->withContext ($ data );
334+
335+ return true ;
330336 }
331337
332338 /**
@@ -342,7 +348,15 @@ private function readOriginal(): void
342348 */
343349 private function readPlural (): bool
344350 {
345- return ($ data = $ this ->readIdentifier ('msgid_plural ' )) !== null && $ this ->translation ->setPlural ($ data );
351+ $ data = $ this ->readIdentifier ('msgid_plural ' );
352+
353+ if ($ data === null ) {
354+ return false ;
355+ }
356+
357+ $ this ->translation ->setPlural ($ data );
358+
359+ return true ;
346360 }
347361
348362 /**
0 commit comments