Your project should not use function in loops conditions

More information: https://insight.symfony.com/what-we-analyse/php.for_loop_uses_test_function

in src/PdfDocument.php, line 2257
  1. // cross-reference
  2. $offset = $this->writer->getOffset();
  3. $this->put('xref');
  4. $this->putf('0 %d', $this->writer->getObjectNumber() + 1);
  5. $this->put('0000000000 65535 f ');
  6. for ($i = 1; $i <= $this->writer->getObjectNumber(); ++$i) {
    This loop uses a function. To avoid the overhead of executing the function n times, you should precalculate it before the loop.
    Time to fix: about 15 minutes
    Read doc Permalink Copy Prompt
    Last edited by Laurent Muller
  7. $this->putf('%010d 00000 n ', $this->writer->getOffsets()[$i]);
  8. }
  9. // trailer
  10. $this->put('trailer');
  11. $this->put('<<');