From 5083b63f3d00e04fae4e6c0a4cd8b24d07ef4077 Mon Sep 17 00:00:00 2001 From: Sebastian Blum Date: Sat, 20 Jan 2018 15:27:27 +0100 Subject: [PATCH 1/9] New PHP-CS-Fixer config --- .php_cs.dist | 61 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 57cae650e..ee6319240 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -1,32 +1,45 @@ setRules(array_merge($config->getRules(), [ - 'header_comment' => ['header' => $header], - ])) - ->setUsingCache(false); - -return $config; +COMMENT; + +$finder = PhpCsFixer\Finder::create() + ->in(__DIR__) + ->ignoreDotFiles(true) + ->ignoreVCS(true) + ->exclude(array('build', 'vendor')) + ->files() + ->name('*.php') +; + +return PhpCsFixer\Config::create() + ->setFinder($finder) + ->setRiskyAllowed(true) + ->setRules([ + '@Symfony' => true, + '@Symfony:risky' => true, + 'array_syntax' => ['syntax' => 'short'], + 'combine_consecutive_unsets' => true, + 'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'], + 'linebreak_after_opening_tag' => true, + 'mb_str_functions' => true, + 'no_php4_constructor' => true, + 'no_unreachable_default_argument_value' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'phpdoc_summary' => false, + 'semicolon_after_instruction' => true, + 'strict_comparison' => true, + 'strict_param' => true, + ]) + ->setFinder($finder) + ->setCacheFile(__DIR__.'/var/.php_cs.cache') +; From 223c804e607b39015925348f3563f76c8f960400 Mon Sep 17 00:00:00 2001 From: Sebastian Blum Date: Sat, 20 Jan 2018 15:34:18 +0100 Subject: [PATCH 2/9] Only set using cache --- .php_cs.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.php_cs.dist b/.php_cs.dist index ee6319240..7181da28a 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -41,5 +41,5 @@ return PhpCsFixer\Config::create() 'strict_param' => true, ]) ->setFinder($finder) - ->setCacheFile(__DIR__.'/var/.php_cs.cache') + ->setUsingCache(true) ; From 5fe18272e367073ddb202956a814407c1d9a57f2 Mon Sep 17 00:00:00 2001 From: Sebastian Blum Date: Sat, 20 Jan 2018 18:45:13 +0100 Subject: [PATCH 3/9] added settings mentioned in pull request #992 --- .php_cs.dist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.php_cs.dist b/.php_cs.dist index 7181da28a..e9c61dff3 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -27,6 +27,7 @@ return PhpCsFixer\Config::create() 'array_syntax' => ['syntax' => 'short'], 'combine_consecutive_unsets' => true, 'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'], + 'heredoc_to_nowdoc' => true, 'linebreak_after_opening_tag' => true, 'mb_str_functions' => true, 'no_php4_constructor' => true, @@ -36,6 +37,7 @@ return PhpCsFixer\Config::create() 'ordered_imports' => true, 'phpdoc_order' => true, 'phpdoc_summary' => false, + 'psr4' => true, 'semicolon_after_instruction' => true, 'strict_comparison' => true, 'strict_param' => true, From adc7db73aa1d40ec1af4016398b0048b186a02b6 Mon Sep 17 00:00:00 2001 From: Sebastian Blum Date: Fri, 2 Feb 2018 10:05:14 +0100 Subject: [PATCH 4/9] execute PHP-CS-Fixer in travis --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d2a354604..d1e3f743e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,17 @@ env: global: - SYMFONY_DEPRECATIONS_HELPER="weak_vendors" - ENABLE_CODE_COVERAGE="false" + - RUN_UNIT_TESTS="true" + - CHECK_PHP_SYNTAX="false" matrix: fast_finish: true include: - php: 7.1 + - php: 7.1 + env: + - RUN_UNIT_TESTS="false" + - CHECK_PHP_SYNTAX="yes" - php: 7.1 env: - SYMFONY_VERSION=4.0.* @@ -60,7 +66,9 @@ install: - if [[ "$ENABLE_CODE_COVERAGE" == "true" && "$TRAVIS_EVENT_TYPE" == "cron" ]]; then travis_retry composer require --dev satooshi/php-coveralls; fi script: - - if [[ "$ENABLE_CODE_COVERAGE" == "true" && "$TRAVIS_EVENT_TYPE" == "cron" ]]; then vendor/bin/simple-phpunit --coverage-text --coverage-clover build/logs/clover.xml; else vendor/bin/simple-phpunit -v; fi; + - if [[ "$ENABLE_CODE_COVERAGE" == "true" && "$TRAVIS_EVENT_TYPE" == "cron" ]]; then vendor/bin/simple-phpunit --coverage-text --coverage-clover build/logs/clover.xml; fi; + - if [[ "$RUN_UNIT_TESTS" == "true" && "$ENABLE_CODE_COVERAGE" != "true"]]; then vendor/bin/simple-phpunit -v; fi; + - if [[ "$CHECK_PHP_SYNTAX" == "true" ]]; then vendor/bin/php-cs-fixer --dry-run --diff -v fix; fi; after_success: - if [[ "$ENABLE_CODE_COVERAGE" == "true" && "$TRAVIS_EVENT_TYPE" == "cron" ]]; then php vendor/bin/coveralls -v --config .coveralls.yml; fi; From cd0b80271ad341cdaebcb92054443dde272839dc Mon Sep 17 00:00:00 2001 From: Sebastian Blum Date: Fri, 2 Feb 2018 10:08:04 +0100 Subject: [PATCH 5/9] execute PHP-CS-Fixer in travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d1e3f743e..0369b8e0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,7 +67,7 @@ install: script: - if [[ "$ENABLE_CODE_COVERAGE" == "true" && "$TRAVIS_EVENT_TYPE" == "cron" ]]; then vendor/bin/simple-phpunit --coverage-text --coverage-clover build/logs/clover.xml; fi; - - if [[ "$RUN_UNIT_TESTS" == "true" && "$ENABLE_CODE_COVERAGE" != "true"]]; then vendor/bin/simple-phpunit -v; fi; + - if [[ "$RUN_UNIT_TESTS" == "true" && "$ENABLE_CODE_COVERAGE" == "false"]]; then vendor/bin/simple-phpunit -v; fi; - if [[ "$CHECK_PHP_SYNTAX" == "true" ]]; then vendor/bin/php-cs-fixer --dry-run --diff -v fix; fi; after_success: From 87dba82bb8d03a89a4fe1baccd666370b01f80c0 Mon Sep 17 00:00:00 2001 From: Sebastian Blum Date: Fri, 2 Feb 2018 10:11:21 +0100 Subject: [PATCH 6/9] execute PHP-CS-Fixer in travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0369b8e0f..cdda6ad99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ matrix: - php: 7.1 env: - RUN_UNIT_TESTS="false" - - CHECK_PHP_SYNTAX="yes" + - CHECK_PHP_SYNTAX="true" - php: 7.1 env: - SYMFONY_VERSION=4.0.* From 9fa8daf3e2485668b6324e5386ee4853e758f39d Mon Sep 17 00:00:00 2001 From: Sebastian Blum Date: Fri, 2 Feb 2018 11:25:16 +0100 Subject: [PATCH 7/9] missing space --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cdda6ad99..55f4ddc22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,7 +67,7 @@ install: script: - if [[ "$ENABLE_CODE_COVERAGE" == "true" && "$TRAVIS_EVENT_TYPE" == "cron" ]]; then vendor/bin/simple-phpunit --coverage-text --coverage-clover build/logs/clover.xml; fi; - - if [[ "$RUN_UNIT_TESTS" == "true" && "$ENABLE_CODE_COVERAGE" == "false"]]; then vendor/bin/simple-phpunit -v; fi; + - if [[ "$RUN_UNIT_TESTS" == "true" && "$ENABLE_CODE_COVERAGE" == "false" ]]; then vendor/bin/simple-phpunit -v; fi; - if [[ "$CHECK_PHP_SYNTAX" == "true" ]]; then vendor/bin/php-cs-fixer --dry-run --diff -v fix; fi; after_success: From cae25483a2d6212c31c187a22164621d7492493b Mon Sep 17 00:00:00 2001 From: Sebastian Blum Date: Mon, 5 Feb 2018 09:56:48 +0100 Subject: [PATCH 8/9] Update .travis.yml --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55f4ddc22..00395d4aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,7 @@ env: matrix: fast_finish: true include: - - php: 7.1 - - php: 7.1 - env: - - RUN_UNIT_TESTS="false" - - CHECK_PHP_SYNTAX="true" + - php: 7.1 - php: 7.1 env: - SYMFONY_VERSION=4.0.* From b51665bc93aa56054a5c63506bef01e151857c5a Mon Sep 17 00:00:00 2001 From: Sebastian Blum Date: Mon, 5 Feb 2018 09:57:59 +0100 Subject: [PATCH 9/9] Require php-cs-fixer rules in travis-ci --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 00395d4aa..345169a14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,11 @@ env: matrix: fast_finish: true include: - - php: 7.1 + - php: 7.1 + - php: 7.1 + env: + - RUN_UNIT_TESTS="false" + - CHECK_PHP_SYNTAX="true" - php: 7.1 env: - SYMFONY_VERSION=4.0.*