php-cs-fixer 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of the PHP CS utility.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  8. *
  9. * This source file is subject to the MIT license that is bundled
  10. * with this source code in the file LICENSE.
  11. */
  12. /**
  13. * @author Fabien Potencier <fabien@symfony.com>
  14. * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
  15. */
  16. if (defined('HHVM_VERSION_ID')) {
  17. fwrite(STDERR, "HHVM is not supported.\n");
  18. if (getenv('PHP_CS_FIXER_IGNORE_ENV')) {
  19. fwrite(STDERR, "Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.\n");
  20. } else {
  21. exit(1);
  22. }
  23. } elseif (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50600 || PHP_VERSION_ID >= 70200) {
  24. fwrite(STDERR, "PHP needs to be a minimum version of PHP 5.6.0 and maximum version of PHP 7.1.*.\n");
  25. if (getenv('PHP_CS_FIXER_IGNORE_ENV')) {
  26. fwrite(STDERR, "Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.\n");
  27. } else {
  28. exit(1);
  29. }
  30. }
  31. set_error_handler(function ($severity, $message, $file, $line) {
  32. if ($severity & error_reporting()) {
  33. throw new ErrorException($message, 0, $severity, $file, $line);
  34. }
  35. });
  36. // installed via composer?
  37. if (file_exists($a = __DIR__.'/../../autoload.php')) {
  38. require_once $a;
  39. } else {
  40. require_once __DIR__.'/vendor/autoload.php';
  41. }
  42. use PhpCsFixer\Console\Application;
  43. $application = new Application();
  44. $application->run();