From 5213ed83c48ea0f9b264ac54dbb5597dd2ef5dd1 Mon Sep 17 00:00:00 2001 From: matthieu88160 Date: Thu, 1 Dec 2016 14:47:32 +0100 Subject: [PATCH 1/6] Update friendsofphp/php-cs-fixer to the new 2.0 stable version --- composer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/composer.json b/composer.json index d217f96..05f5fa7 100644 --- a/composer.json +++ b/composer.json @@ -36,12 +36,9 @@ }, "require-dev": { "phpunit/phpunit": "^4.7", - "friendsofphp/php-cs-fixer": "v2.0.0-alpha", + "friendsofphp/php-cs-fixer": "v2.0@stable", "sllh/php-cs-fixer-styleci-bridge": "^2.1" }, - "conflict": { - "friendsofphp/php-cs-fixer": "<2.0.0-alpha|>2.0.0-alpha" - }, "suggest": { "friendsofphp/php-cs-fixer": "To have a nice formatting of the generated files" }, From 6e2d6c20ddde5ad05f642a60023385e4e3289fd9 Mon Sep 17 00:00:00 2001 From: matthieu88160 Date: Thu, 1 Dec 2016 16:13:35 +0100 Subject: [PATCH 2/6] Resolving configuration of CSFixer to provide compatibility with V2.0.0 --- src/JaneOpenApi.php | 32 +++++++++++++++++-------------- tests/JaneOpenApiResourceTest.php | 1 - 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/JaneOpenApi.php b/src/JaneOpenApi.php index 4a085dd..be124f7 100644 --- a/src/JaneOpenApi.php +++ b/src/JaneOpenApi.php @@ -24,7 +24,6 @@ use PhpCsFixer\Differ\NullDiffer; use PhpCsFixer\Error\ErrorsManager; use PhpCsFixer\Finder; -use PhpCsFixer\Linter\NullLinter; use PhpCsFixer\Runner\Runner; use PhpParser\PrettyPrinter\Standard as StandardPrettyPrinter; use PhpParser\PrettyPrinterAbstract; @@ -32,6 +31,8 @@ use Symfony\Component\Serializer\Encoder\JsonEncode; use Symfony\Component\Serializer\Encoder\JsonEncoder; use Symfony\Component\Serializer\Serializer; +use PhpCsFixer\Cache\NullCacheManager; +use PhpCsFixer\Linter\Linter; class JaneOpenApi { @@ -194,30 +195,33 @@ protected function fix($directory) ->setRiskyAllowed(true) ->setRules(array( '@Symfony' => true, + 'array_syntax' => array('syntax' => 'short'), 'simplified_null_return' => false, - 'concat_without_spaces' => false, - 'double_arrow_multiline_whitespaces' => false, - 'unalign_equals' => false, - 'unalign_double_arrow' => false, - 'align_double_arrow' => true, - 'align_equals' => true, - 'concat_with_spaces' => true, 'ordered_imports' => true, 'phpdoc_order' => true, - 'short_array_syntax' => true, + 'binary_operator_spaces' => array('align_equals'=>true), + 'concat_space' => false )) ; - $resolver = new ConfigurationResolver(); - $resolver->setDefaultConfig($fixerConfig); - $resolver->resolve(); + $resolverOptions = array('allow-risky' => true); + $resolver = new ConfigurationResolver($fixerConfig, $resolverOptions, $directory); } $finder = new Finder(); $finder->in($directory); - $fixerConfig->finder($finder); + $fixerConfig->setFinder($finder); - $runner = new Runner($fixerConfig, new NullDiffer(), null, new ErrorsManager(), new NullLinter(), false); + $runner = new Runner( + $resolver->getConfig()->getFinder(), + $resolver->getFixers(), + new NullDiffer(), + null, + new ErrorsManager(), + new Linter(), + false, + new NullCacheManager() + ); return $runner->fix(); } diff --git a/tests/JaneOpenApiResourceTest.php b/tests/JaneOpenApiResourceTest.php index 846375d..8cd624a 100644 --- a/tests/JaneOpenApiResourceTest.php +++ b/tests/JaneOpenApiResourceTest.php @@ -3,7 +3,6 @@ namespace Joli\Jane\OpenApi\Tests; use Joli\Jane\OpenApi\Command\GenerateCommand; -use Joli\Jane\OpenApi\JaneOpenApi; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Filesystem\Filesystem; From 1400be2328d3230964ec615b0c0a3eee9d66cee5 Mon Sep 17 00:00:00 2001 From: matthieu88160 Date: Thu, 1 Dec 2016 16:37:04 +0100 Subject: [PATCH 3/6] Refactoring to avoid null resolver in JaneOpenApi --- src/JaneOpenApi.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/JaneOpenApi.php b/src/JaneOpenApi.php index be124f7..05b5567 100644 --- a/src/JaneOpenApi.php +++ b/src/JaneOpenApi.php @@ -193,20 +193,20 @@ protected function fix($directory) if (null === $fixerConfig) { $fixerConfig = Config::create() ->setRiskyAllowed(true) - ->setRules(array( - '@Symfony' => true, - 'array_syntax' => array('syntax' => 'short'), - 'simplified_null_return' => false, - 'ordered_imports' => true, - 'phpdoc_order' => true, - 'binary_operator_spaces' => array('align_equals'=>true), - 'concat_space' => false - )) - ; - - $resolverOptions = array('allow-risky' => true); - $resolver = new ConfigurationResolver($fixerConfig, $resolverOptions, $directory); + ->setRules( + array( + '@Symfony' => true, + 'array_syntax' => array('syntax' => 'short'), + 'simplified_null_return' => false, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'binary_operator_spaces' => array('align_equals'=>true), + 'concat_space' => false + ) + ); } + $resolverOptions = array('allow-risky' => true); + $resolver = new ConfigurationResolver($fixerConfig, $resolverOptions, $directory); $finder = new Finder(); $finder->in($directory); From 0926d073880cd618612033cfaa28fdb6efd370e3 Mon Sep 17 00:00:00 2001 From: matthieu88160 Date: Mon, 5 Dec 2016 10:46:18 +0100 Subject: [PATCH 4/6] updating hhvm version to 3.9 for phpcs-fixer conflict resolving --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 63f6e4a..f2dd252 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ php: - 5.5 - 5.6 - 7.0 - - hhvm + - hhvm-3.9 env: global: From 6ef46bcf426e65ff257230c49aedf93e3170b694 Mon Sep 17 00:00:00 2001 From: matthieu88160 Date: Mon, 5 Dec 2016 10:53:12 +0100 Subject: [PATCH 5/6] updating travis distribution to trusty allowing hhvm version upper than 3.3 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index f2dd252..cb2881c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +dist: trusty + language: php sudo: false From 372cfb6bcd4bfdb64677f32b40cf63a4f99b1413 Mon Sep 17 00:00:00 2001 From: matthieu88160 Date: Mon, 5 Dec 2016 11:12:40 +0100 Subject: [PATCH 6/6] upgrading process timeout to 20min --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 05f5fa7..5ec8a3a 100644 --- a/composer.json +++ b/composer.json @@ -42,6 +42,9 @@ "suggest": { "friendsofphp/php-cs-fixer": "To have a nice formatting of the generated files" }, + "config": { + "process-timeout": 1200 + }, "scripts": { "test": "vendor/bin/phpunit", "test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"