Your project should not change PHP configuration dynamically
- Read doc
- Productivity
- Major
More information: https://insight.symfony.com/what-we-analyse/php.dynamically_change_configuration
- use fpdf\MakeFont;
- if (\PHP_SAPI === 'cli') {
- // Command-line interface
- \ini_set('log_errors', '0');
- if (1 === $argc) {
- exit("Usage: php make.php fontFile [encoding] [embed] [subset]\n");
- }
- $fontFile = $argv[1];
Your project uses discouraged functions to kill scripts 2
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.use_exit_function
- if (\PHP_SAPI === 'cli') {
- // Command-line interface
- \ini_set('log_errors', '0');
- if (1 === $argc) {
- exit("Usage: php make.php fontFile [encoding] [embed] [subset]\n");
- }
- $fontFile = $argv[1];
- $enc = $argv[2] ?? 'cp1252';
- $embed = (bool) ($argv[3] ?? true);
- }
- private function error(string $message): never
- {
- $this->message($message, 'Error');
- exit(1);
- }
- /**
- * @phpstan-param array<int, MapType> $map
- * @phpstan-return FontInfoType
Your project should not use too long PHP methods
- Read doc
- Productivity
- Major
More information: https://insight.symfony.com/what-we-analyse/php.method_too_long
- 91 lines for MakeFont::getInfoFromType1() in src/MakeFont.php, line 197
- 70 lines for TTFParser::parseCmap() in src/TTFParser.php, line 412
- 68 lines for TTFParser::buildCmap() in src/TTFParser.php, line 147
- 51 lines for MakeFont::getInfoFromTrueType() in src/MakeFont.php, line 131
Your project should not contain commented code
- Read doc
- Productivity
- Minor
More information: https://insight.symfony.com/what-we-analyse/php.commented_out_code
- $s .= ' => ' . $widths[$c];
- if ($c < 255) {
- $s .= ",\n\t";
- }
- // if (($c + 1) % 22 === 0) {
- // $s .= "\n\t";
- // }
- }
- $s .= "\n]";
- return $s;