No Description

.php_cs 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * This file represents the configuration for Code Sniffing PSR-2-related
  4. * automatic checks of coding guidelines
  5. * Install @fabpot's great php-cs-fixer tool via
  6. *
  7. * $ composer global require fabpot/php-cs-fixer
  8. *
  9. * And then simply run
  10. *
  11. * $ php-cs-fixer fix --config-file .php_cs
  12. *
  13. * inside the root directory.
  14. *
  15. * http://www.php-fig.org/psr/psr-2/
  16. * http://cs.sensiolabs.org
  17. */
  18. if (PHP_SAPI !== 'cli') {
  19. die('This script supports command line usage only. Please check your command.');
  20. }
  21. // Define in which folders to search and which folders to exclude
  22. // Exclude some directories that are excluded by Git anyways to speed up the sniffing
  23. $finder = Symfony\CS\Finder\DefaultFinder::create()
  24. ->exclude('vendor')
  25. ->in(__DIR__);
  26. // Return a Code Sniffing configuration using
  27. // all sniffers needed for PSR-2
  28. // and additionally:
  29. // - Remove leading slashes in use clauses.
  30. // - PHP single-line arrays should not have trailing comma.
  31. // - Single-line whitespace before closing semicolon are prohibited.
  32. // - Remove unused use statements in the PHP source code
  33. // - Ensure Concatenation to have at least one whitespace around
  34. // - Remove trailing whitespace at the end of blank lines.
  35. return Symfony\CS\Config\Config::create()
  36. ->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
  37. ->fixers([
  38. 'remove_leading_slash_use',
  39. 'single_array_no_trailing_comma',
  40. 'spaces_before_semicolon',
  41. 'unused_use',
  42. 'concat_with_spaces',
  43. 'whitespacy_lines',
  44. 'ordered_use',
  45. 'single_quote',
  46. 'duplicate_semicolon',
  47. 'extra_empty_lines',
  48. 'phpdoc_no_package',
  49. 'phpdoc_scalar',
  50. 'no_empty_lines_after_phpdocs'
  51. ])
  52. ->finder($finder);