From 778e307c5bd7b41ede32241e549b3c2f71418c0e Mon Sep 17 00:00:00 2001 From: Konrad Abicht Date: Fri, 29 Sep 2023 09:38:43 +0200 Subject: [PATCH] Usage.md: change example code to avoid PHP notice (#644) The following notice is thrown: > Only variables should be passed by reference because of the following code part: > $font = reset($pdf->getFonts()); --- doc/Usage.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/Usage.md b/doc/Usage.md index 37c65aff..864c2924 100644 --- a/doc/Usage.md +++ b/doc/Usage.md @@ -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); ```