phar-stub.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. if (defined('HHVM_VERSION_ID')) {
  13. if (HHVM_VERSION_ID < 30900) {
  14. fwrite(STDERR, "HHVM needs to be a minimum version of HHVM 3.9.0.\n");
  15. if (getenv('PHP_CS_FIXER_IGNORE_ENV')) {
  16. fwrite(STDERR, "Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.\n");
  17. } else {
  18. exit(1);
  19. }
  20. }
  21. } elseif (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50306 || PHP_VERSION_ID >= 70200) {
  22. fwrite(STDERR, "PHP needs to be a minimum version of PHP 5.3.6 and maximum version of PHP 7.1.*.\n");
  23. if (getenv('PHP_CS_FIXER_IGNORE_ENV')) {
  24. fwrite(STDERR, "Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.\n");
  25. } else {
  26. exit(1);
  27. }
  28. }
  29. set_error_handler(function ($severity, $message, $file, $line) {
  30. if ($severity & error_reporting()) {
  31. throw new ErrorException($message, 0, $severity, $file, $line);
  32. }
  33. });
  34. Phar::mapPhar('php-cs-fixer.phar');
  35. require_once 'phar://php-cs-fixer.phar/vendor/autoload.php';
  36. use PhpCsFixer\Console\Application;
  37. $application = new Application();
  38. $application->run();
  39. __HALT_COMPILER();