@@ -35,8 +35,6 @@ final class StrictPoLoader extends Loader
35
35
private $ warnings = [];
36
36
/** @var bool */
37
37
private $ isDisabled ;
38
- /** @var bool */
39
- private $ displayLineColumn ;
40
38
41
39
/**
42
40
* Generates a Translations object from a .po based string
@@ -194,11 +192,11 @@ private function readQuotedString(?string $context = null): string
194
192
case '\\' :
195
193
$ data .= $ this ->readEscape ();
196
194
break ;
197
- // Unexpected newline
195
+ // Unexpected newline
198
196
case "\r" :
199
197
case "\n" :
200
198
throw new Exception ("Newline character must be escaped {$ this ->getErrorPosition ()}" );
201
- // Unexpected end of file
199
+ // Unexpected end of file
202
200
case null :
203
201
throw new Exception ("Expected a closing quote {$ this ->getErrorPosition ()}" );
204
202
}
@@ -229,6 +227,7 @@ private function readEscape(): string
229
227
return chr ($ decimal );
230
228
case 'x ' :
231
229
$ value = $ this ->readCharset ($ hexDigits , 1 , PHP_INT_MAX , 'hexadecimal ' );
230
+
232
231
// GNU reads all valid hexadecimal chars, but only uses the last pair
233
232
return hex2bin (str_pad (substr ($ value , -2 ), 2 , '0 ' , STR_PAD_LEFT ));
234
233
case 'U ' :
@@ -325,8 +324,15 @@ private function readIdentifier(string $identifier, bool $throwIfNotFound = fals
325
324
*/
326
325
private function readContext (): bool
327
326
{
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 ;
330
336
}
331
337
332
338
/**
@@ -342,7 +348,15 @@ private function readOriginal(): void
342
348
*/
343
349
private function readPlural (): bool
344
350
{
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 ;
346
360
}
347
361
348
362
/**
0 commit comments