@@ -281,33 +281,34 @@ public function readValue($token = null, $expectedType = null)
281281
282282 default :
283283 if (\is_numeric ($ token )) {
284- if (($ token2 = $ this ->tokenizer ->getNextToken ()) !== false ) {
285- if (\is_numeric ($ token2 ) && ($ token3 = $ this ->tokenizer ->getNextToken ()) !== false ) {
286- switch ($ token3 ) {
287- case 'obj ' :
288- if ($ expectedType !== null && $ expectedType !== PdfIndirectObject::class) {
289- throw new Type \PdfTypeException (
290- 'Got unexpected token type. ' ,
291- Type \PdfTypeException::INVALID_DATA_TYPE
292- );
293- }
294-
295- return $ this ->parsePdfIndirectObject ((int )$ token , (int )$ token2 );
296- case 'R ' :
297- if (
298- $ expectedType !== null &&
299- $ expectedType !== PdfIndirectObjectReference::class
300- ) {
301- throw new Type \PdfTypeException (
302- 'Got unexpected token type. ' ,
303- Type \PdfTypeException::INVALID_DATA_TYPE
304- );
305- }
306-
307- return PdfIndirectObjectReference::create ((int )$ token , (int )$ token2 );
284+ $ token2 = $ this ->tokenizer ->getNextToken ();
285+ if ($ token2 !== false ) {
286+ if (\is_numeric ($ token2 )) {
287+ $ token3 = $ this ->tokenizer ->getNextToken ();
288+ if ($ token3 === 'obj ' ) {
289+ if ($ expectedType !== null && $ expectedType !== PdfIndirectObject::class) {
290+ throw new Type \PdfTypeException (
291+ 'Got unexpected token type. ' ,
292+ Type \PdfTypeException::INVALID_DATA_TYPE
293+ );
294+ }
295+
296+ return $ this ->parsePdfIndirectObject ((int ) $ token , (int ) $ token2 );
297+ } elseif ($ token3 === 'R ' ) {
298+ if (
299+ $ expectedType !== null &&
300+ $ expectedType !== PdfIndirectObjectReference::class
301+ ) {
302+ throw new Type \PdfTypeException (
303+ 'Got unexpected token type. ' ,
304+ Type \PdfTypeException::INVALID_DATA_TYPE
305+ );
306+ }
307+
308+ return PdfIndirectObjectReference::create ((int ) $ token , (int ) $ token2 );
309+ } elseif ($ token3 !== false ) {
310+ $ this ->tokenizer ->pushStack ($ token3 );
308311 }
309-
310- $ this ->tokenizer ->pushStack ($ token3 );
311312 }
312313
313314 $ this ->tokenizer ->pushStack ($ token2 );
0 commit comments