Skip to content

Commit

Permalink
fix: prevent psalm error
Browse files Browse the repository at this point in the history
```
ERROR: InvalidPassByReference - lib/Service/PdfParserService.php:76:22 - Parameter 1 of reset expects a variable (see https://psalm.dev/102)
				$details = reset($pdf->getObjectsByType('Pages'))->getHeader()->getDetails();
```

Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Apr 5, 2024
1 parent a60ba4a commit eda1082
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Service/PdfParserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ private function parsePdfOnlyWithPhp(string $filename): array {
foreach ($pages as $page) {
$details = $page->getDetails();
if (!isset($details['MediaBox'])) {
$details = reset($pdf->getObjectsByType('Pages'))->getHeader()->getDetails();
$pages = $pdf->getObjectsByType('Pages');
$details = reset($pages)->getHeader()->getDetails();
}
$output['d'][] = [
'w' => $details['MediaBox'][2],
Expand Down

0 comments on commit eda1082

Please sign in to comment.