diff --git a/.gitattributes b/.gitattributes index 6b8e4eea1e9..944be372e46 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,31 +1,26 @@ # @TODO 3.0 replace following `tests/... export-ignore` with single `tests/ export-ignore` -tests/**/*Test.php export-ignore -tests/AbstractDoctrineAnnotationFixerTestCase.php export-ignore -tests/Differ/AbstractDifferTestCase.php export-ignore -tests/Fixtures/ export-ignore -tests/Linter/AbstractLinterTestCase.php export-ignore -tests/Report/AbstractReporterTestCase.php export-ignore -tests/Test/AbstractFixerWithAliasedOptionsTestCase.php export-ignore -tests/Test/AbstractTransformerTestCase.php export-ignore +/tests/**/*Test.php export-ignore +/tests/AbstractDoctrineAnnotationFixerTestCase.php export-ignore +/tests/Differ/AbstractDifferTestCase.php export-ignore +/tests/Fixtures/ export-ignore +/tests/Linter/AbstractLinterTestCase.php export-ignore +/tests/Report/AbstractReporterTestCase.php export-ignore +/tests/Test/AbstractFixerWithAliasedOptionsTestCase.php export-ignore +/tests/Test/AbstractTransformerTestCase.php export-ignore -.appveyor.yml export-ignore -.circleci/ export-ignore -.composer-require-checker.json export-ignore -.editorconfig export-ignore -.gitattributes export-ignore -.github/ export-ignore -.gitignore export-ignore -.travis.yml export-ignore -benchmark.sh export-ignore -box.json export-ignore -check_trailing_spaces.sh export-ignore -phpmd.xml export-ignore -phpunit.xml.dist export-ignore +/.* export-ignore +/benchmark.sh export-ignore +/box.json.dist export-ignore +/check_trailing_spaces.sh export-ignore +/dev-tools/ export-ignore +/phpmd.xml export-ignore +/phpstan.neon export-ignore +/phpunit.xml.dist export-ignore * text=auto eol=lf -*.php text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 diff=php *.json text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 -*.yml text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 *.md text whitespace=blank-at-eol,blank-at-eof +*.php text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 diff=php *.rst text whitespace=blank-at-eol,blank-at-eof -tests/Fixtures/**/* -text +*.yml text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 +/tests/Fixtures/**/* -text diff --git a/box.json.dist b/box.json.dist index f9867a6fe06..e4102debea2 100644 --- a/box.json.dist +++ b/box.json.dist @@ -7,7 +7,7 @@ "KevinGH\\Box\\Compactor\\Php" ], "files": [ - "dev-tools/ci-integration.sh", + "ci-integration.sh", "LICENSE" ], "finder": [ diff --git a/dev-tools/ci-integration.sh b/ci-integration.sh similarity index 100% rename from dev-tools/ci-integration.sh rename to ci-integration.sh diff --git a/php-cs-fixer b/php-cs-fixer index b8cd9fef879..1fec90ca11d 100755 --- a/php-cs-fixer +++ b/php-cs-fixer @@ -37,6 +37,19 @@ if (defined('HHVM_VERSION_ID')) { } } +foreach (['json', 'tokenizer'] as $extension) { + if (!extension_loaded($extension)) { + fwrite(STDERR, sprintf("PHP extension ext-%s is missing from your system. Install or enable it.\n", $extension)); + + if (getenv('PHP_CS_FIXER_IGNORE_ENV')) { + fwrite(STDERR, "Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.\n"); + } else { + exit(1); + } + } +} +unset($extension); + set_error_handler(function ($severity, $message, $file, $line) { if ($severity & error_reporting()) { throw new ErrorException($message, 0, $severity, $file, $line); diff --git a/src/Console/Command/HelpCommand.php b/src/Console/Command/HelpCommand.php index 9633f2dad3b..06e605b1f23 100644 --- a/src/Console/Command/HelpCommand.php +++ b/src/Console/Command/HelpCommand.php @@ -285,7 +285,7 @@ public static function getHelpCopy() ), '%%%CI_INTEGRATION%%%' => implode("\n", array_map( static function ($line) { return ' $ '.$line; }, - \array_slice(file(__DIR__.'/../../../dev-tools/ci-integration.sh', FILE_IGNORE_NEW_LINES), 3) + \array_slice(file(__DIR__.'/../../../ci-integration.sh', FILE_IGNORE_NEW_LINES), 3) )), '%%%FIXERS_DETAILS%%%' => self::getFixersHelp(), ]); diff --git a/tests/Smoke/CiIntegrationTest.php b/tests/Smoke/CiIntegrationTest.php index 7413a2ffe9f..63f54ccde9e 100644 --- a/tests/Smoke/CiIntegrationTest.php +++ b/tests/Smoke/CiIntegrationTest.php @@ -103,7 +103,7 @@ public function testIntegration( $caseCommands )); - $integrationScript = explode("\n", str_replace('vendor/bin/', './../../../', file_get_contents(__DIR__.'/../../dev-tools/ci-integration.sh'))); + $integrationScript = explode("\n", str_replace('vendor/bin/', './../../../', file_get_contents(__DIR__.'/../../ci-integration.sh'))); $steps = [ "COMMIT_RANGE=\"master..{$branchName}\"", "{$integrationScript[3]}\n{$integrationScript[4]}",