Skip to content

Commit

Permalink
Usage.md: change example code to avoid PHP notice
Browse files Browse the repository at this point in the history
The following notice is thrown:

> Only variables should be passed by reference

because of the following code part:

> $font = reset($pdf->getFonts());
  • Loading branch information
k00ni committed Sep 29, 2023
1 parent 051ec84 commit 51c47f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ Characters without width are added to `$missing` array in second parameter.
```php
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('document.pdf');
$fonts = $pdf->getFonts();
// get first font (we assume here there is at least one)
$font = reset($pdf->getFonts());
$font = reset($fonts);
// get width
$width = $font->calculateTextWidth('Some text', $missing);
```
Expand Down

0 comments on commit 51c47f2

Please sign in to comment.