.php-cs-fixer.dist.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * PHP-CS-Fixer config for ZipStream-PHP
  5. * @author Nicolas CARPi <nico-git@deltablot.email>
  6. * @copyright 2022 Nicolas CARPi
  7. * @see https://github.com/maennchen/ZipStream-PHP
  8. * @license MIT
  9. * @package maennchen/ZipStream-PHP
  10. */
  11. use PhpCsFixer\Config;
  12. use PhpCsFixer\Finder;
  13. use PhpCsFixer\Runner;
  14. $finder = Finder::create()
  15. ->exclude('.github')
  16. ->exclude('.phpdoc')
  17. ->exclude('docs')
  18. ->exclude('tools')
  19. ->exclude('vendor')
  20. ->in(__DIR__);
  21. $config = new Config();
  22. return $config->setRules([
  23. '@PER' => true,
  24. '@PER:risky' => true,
  25. '@PHP83Migration' => true,
  26. '@PHP84Migration' => true,
  27. '@PHPUnit84Migration:risky' => true,
  28. 'array_syntax' => ['syntax' => 'short'],
  29. 'class_attributes_separation' => true,
  30. 'declare_strict_types' => true,
  31. 'dir_constant' => true,
  32. 'is_null' => true,
  33. 'no_homoglyph_names' => true,
  34. 'no_null_property_initialization' => true,
  35. 'no_php4_constructor' => true,
  36. 'no_unused_imports' => true,
  37. 'no_useless_else' => true,
  38. 'non_printable_character' => true,
  39. 'ordered_imports' => true,
  40. 'ordered_class_elements' => true,
  41. 'php_unit_construct' => true,
  42. 'pow_to_exponentiation' => true,
  43. 'psr_autoloading' => true,
  44. 'random_api_migration' => true,
  45. 'return_assignment' => true,
  46. 'self_accessor' => true,
  47. 'semicolon_after_instruction' => true,
  48. 'short_scalar_cast' => true,
  49. 'simplified_null_return' => true,
  50. 'single_class_element_per_statement' => true,
  51. 'single_line_comment_style' => true,
  52. 'single_quote' => true,
  53. 'space_after_semicolon' => true,
  54. 'standardize_not_equals' => true,
  55. 'strict_param' => true,
  56. 'ternary_operator_spaces' => true,
  57. 'trailing_comma_in_multiline' => true,
  58. 'trim_array_spaces' => true,
  59. 'unary_operator_spaces' => true,
  60. 'global_namespace_import' => [
  61. 'import_classes' => true,
  62. 'import_functions' => true,
  63. 'import_constants' => true,
  64. ],
  65. ])
  66. ->setFinder($finder)
  67. ->setRiskyAllowed(true)
  68. ->setParallelConfig(Runner\Parallel\ParallelConfigFactory::detect());