Your project should not change PHP configuration dynamically

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

in src/make.php, line 19
  1. use fpdf\MakeFont;
  2. if (\PHP_SAPI === 'cli') {
  3. // Command-line interface
  4. \ini_set('log_errors', '0');

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Read doc Open Issue Permalink
    Last edited by Laurent Muller
  5. if (1 === $argc) {
  6. exit("Usage: php make.php fontFile [encoding] [embed] [subset]\n");
  7. }
  8. $fontFile = $argv[1];

Your project uses discouraged functions to kill scripts 2

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

in src/make.php, line 21
  1. if (\PHP_SAPI === 'cli') {
  2. // Command-line interface
  3. \ini_set('log_errors', '0');
  4. if (1 === $argc) {
  5. exit("Usage: php make.php fontFile [encoding] [embed] [subset]\n");

    This line stops the execution flow, without explanation. If this is for debug, you should remove it. If this is to deal with an error, use exceptions instead.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Laurent Muller
  6. }
  7. $fontFile = $argv[1];
  8. $enc = $argv[2] ?? 'cp1252';
  9. $embed = (bool) ($argv[3] ?? true);
in src/MakeFont.php, line 124
  1. }
  2. private function error(string $message): never
  3. {
  4. $this->message($message, 'Error');
  5. exit(1);

    This line stops the execution flow, without explanation. If this is for debug, you should remove it. If this is to deal with an error, use exceptions instead.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Laurent Muller
  6. }
  7. /**
  8. * @phpstan-param array<int, MapType> $map
  9. * @phpstan-return FontInfoType

Your project should not use too long PHP methods

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

8% of all methods have more than 50 lines. This violation is raised when more than 5% methods are too long.

Time to fix: about 4.5 hours
Read doc Open Issue Permalink
Collective

Your project should not contain commented code

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

in src/MakeFont.php, line 505
  1. $s .= ' => ' . $widths[$c];
  2. if ($c < 255) {
  3. $s .= ",\n\t";
  4. }
  5. // if (($c + 1) % 22 === 0) {
  6. // $s .= "\n\t";

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Read doc Open Issue Permalink
    Last edited by Laurent Muller
  7. // }
  8. }
  9. $s .= "\n]";
  10. return $s;