From 74d5dc677cc9ebfdb3a3af6b19d9c2b6ab14d5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Rumi=C5=84ski?= Date: Tue, 23 Sep 2014 23:40:54 +0200 Subject: [PATCH 1/4] update PHP-CS-Fixer to 1.0 --- .gitignore | 3 +- .php_cs | 34 +++++-------------- .travis.yml | 2 +- .../Test/Functional/InheritanceTest.php | 3 +- 4 files changed, 12 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index 15977fb..3861f00 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.php_cs.cache composer.lock -vendor mustache.php +vendor diff --git a/.php_cs b/.php_cs index 1265160..45bfb77 100644 --- a/.php_cs +++ b/.php_cs @@ -1,34 +1,16 @@ registerBuiltInFixers(); +$config = Config::create() + // use default level and extra fixers: + ->fixers(array('-concat_without_spaces', 'concat_with_spaces', 'strict', 'strict_param')) + ->setUsingCache(true) + ->setUsingLinter(false); -$fixers = array(); - -foreach ($fixer->getFixers() as $fixer) { - $level = $fixer->getLevel(); - - if (!isset($fixers[$level])) { - $fixers[$level] = array(); - } - - $fixers[$level][] = $fixer->getName(); -} - -$fixers = array_merge( - $fixers[FixerInterface::PSR0_LEVEL], - $fixers[FixerInterface::PSR1_LEVEL], - $fixers[FixerInterface::PSR2_LEVEL], - $fixers[FixerInterface::ALL_LEVEL], - array('concat_with_spaces', 'strict') -); - -$config = new Config(); -$config->fixers($fixers); -$config->getFinder()->in(__DIR__)->exclude('bin'); +$config->getFinder() + ->in(__DIR__) + ->exclude('bin'); return $config; diff --git a/.travis.yml b/.travis.yml index 59c9d31..3652c44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ install: script: - phpunit - - if [[ `php -r "echo version_compare(PHP_VERSION, '5.3.6', '>=');"` ]]; then php php-cs-fixer.phar --dry-run -v fix .; fi + - if [[ `php -r "echo version_compare(PHP_VERSION, '5.3.6', '>=');"` ]]; then php php-cs-fixer.phar --diff --dry-run -vv fix; fi php: - 5.2 diff --git a/test/Mustache/Test/Functional/InheritanceTest.php b/test/Mustache/Test/Functional/InheritanceTest.php index f0d3235..5b3ba0c 100644 --- a/test/Mustache/Test/Functional/InheritanceTest.php +++ b/test/Mustache/Test/Functional/InheritanceTest.php @@ -268,8 +268,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas public function testInheritIndentationWhenOverridingAPartial() { $partials = array( - 'partial' => - 'stop: + 'partial' => 'stop: {{$nineties}}collaborate and listen{{/nineties}}', ); From e78436c9831ec0720d34f720f5c03e1f476e1a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Rumi=C5=84ski?= Date: Sat, 15 Nov 2014 14:37:41 +0100 Subject: [PATCH 2/4] .travis.yml - update php-cs-fixer download center --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3652c44..154f656 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: php install: - - curl http://cs.sensiolabs.org/get/php-cs-fixer.phar -o php-cs-fixer.phar + - curl http://get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer.phar script: - phpunit From 07c8faa73bf401cc9685fea01fb8b1d0a98b7119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Rumi=C5=84ski?= Date: Sat, 15 Nov 2014 21:21:19 +0100 Subject: [PATCH 3/4] .php_cs - exclude file --- .php_cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.php_cs b/.php_cs index 45bfb77..6fb0311 100644 --- a/.php_cs +++ b/.php_cs @@ -9,8 +9,13 @@ $config = Config::create() ->setUsingCache(true) ->setUsingLinter(false); -$config->getFinder() +$finder = $config->getFinder() ->in(__DIR__) ->exclude('bin'); +// exclude file due to error on PHP 5.3 that ignore content after __halt_compiler when using token_get_all +if (version_compare(PHP_VERSION, '5.4', '<')) { + $finder->notPath('test/Mustache/Test/Loader/InlineLoaderTest.php'); +} + return $config; From e1458c7ede2deceb9a5613769e51fc99b7199b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Rumi=C5=84ski?= Date: Sat, 15 Nov 2014 22:28:37 +0100 Subject: [PATCH 4/4] .travis.yml - do not run PHP CS Fixer on HHVM --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 154f656..fbbbc72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ install: script: - phpunit - - if [[ `php -r "echo version_compare(PHP_VERSION, '5.3.6', '>=');"` ]]; then php php-cs-fixer.phar --diff --dry-run -vv fix; fi + - if [[ `php -r "echo version_compare(PHP_VERSION, '5.3.6', '>=') && !defined('HHVM_VERSION');"` ]]; then php php-cs-fixer.phar --diff --dry-run -vv fix; fi php: - 5.2