口腔客户管理系统
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

phpstan-conditional.php 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. $config = [];
  3. if (PHP_VERSION_ID < 80000) {
  4. // GdImage not available before PHP8
  5. $config['parameters']['ignoreErrors'][] = [
  6. 'message' => '~^Method .* has invalid return type GdImage\.$~',
  7. 'path' => __DIR__ . '/src/PhpSpreadsheet/Shared/Drawing.php',
  8. 'count' => 1,
  9. ];
  10. $config['parameters']['ignoreErrors'][] = [
  11. 'message' => '~^Property .* has unknown class GdImage as its type\.$~',
  12. 'path' => __DIR__ . '/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php',
  13. 'count' => 1,
  14. ];
  15. $config['parameters']['ignoreErrors'][] = [
  16. 'message' => '~^Method .* has invalid return type GdImage\.$~',
  17. 'path' => __DIR__ . '/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php',
  18. 'count' => 1,
  19. ];
  20. $config['parameters']['ignoreErrors'][] = [
  21. 'message' => '~^Parameter .* of method .* has invalid type GdImage\.$~',
  22. 'path' => __DIR__ . '/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php',
  23. 'count' => 1,
  24. ];
  25. $config['parameters']['ignoreErrors'][] = [
  26. 'message' => '~^Class GdImage not found\.$~',
  27. 'path' => __DIR__ . '/src/PhpSpreadsheet/Writer/Xls/Worksheet.php',
  28. 'count' => 1,
  29. ];
  30. $config['parameters']['ignoreErrors'][] = [
  31. 'message' => '~^Parameter .* of method .* has invalid type GdImage\.$~',
  32. 'path' => __DIR__ . '/src/PhpSpreadsheet/Writer/Xls/Worksheet.php',
  33. 'count' => 1,
  34. ];
  35. // Erroneous analysis by Phpstan before PHP8 - 3rd parameter is nullable
  36. $config['parameters']['ignoreErrors'][] = [
  37. 'message' => '#^Parameter \\#3 \\$namespace of method XMLWriter\\:\\:startElementNs\\(\\) expects string, null given\\.$#',
  38. 'path' => __DIR__ . '/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php',
  39. 'count' => 8,
  40. ];
  41. // Erroneous analysis by Phpstan before PHP8 - mb_strlen does not return false
  42. $config['parameters']['ignoreErrors'][] = [
  43. 'message' => '#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:countCharacters\\(\\) should return int but returns int(<0, max>)?\\|false\\.$#',
  44. 'path' => __DIR__ . '/src/PhpSpreadsheet/Shared/StringHelper.php',
  45. 'count' => 1,
  46. ];
  47. } else {
  48. // Flagged in Php8+ - unsure how to correct code
  49. $config['parameters']['ignoreErrors'][] = [
  50. 'message' => '#^Binary operation "/" between float and array[|]float[|]int[|]string results in an error.#',
  51. 'path' => __DIR__ . '/src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php',
  52. 'count' => 2,
  53. ];
  54. }
  55. return $config;