Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[cs-fixer] Centralize configuration in a single file #5983

Closed
wants to merge 3 commits into from

3 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
37 .php_cs
@@ -1,17 +1,13 @@
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
- ->exclude('demos')
- ->exclude('resources')
- ->notPath('tests/ZendTest/Code/Reflection/FunctionReflectionTest.php')
- ->notPath('tests/ZendTest/Code/Reflection/MethodReflectionTest.php')
- ->notPath('tests/ZendTest/Code/Reflection/TestAsset/closures.php')
- ->notPath('tests/ZendTest/Code/Reflection/TestAsset/functions.php')
- ->notPath('tests/ZendTest/Code/Reflection/TestAsset/TestSampleClass10.php')
- ->notPath('tests/ZendTest/Code/Reflection/TestAsset/TestSampleClass11.php')
- ->notPath('tests/ZendTest/Code/TestAsset')
- ->notPath('tests/ZendTest/Validator/_files')
- ->notPath('tests/ZendTest/Loader/_files')
- ->notPath('tests/ZendTest/Loader/TestAsset')
+ ->notPath('ZendTest/Code/Generator/TestAsset')
+ ->notPath('ZendTest/Code/Reflection/FunctionReflectionTest.php')
+ ->notPath('ZendTest/Code/Reflection/MethodReflectionTest.php')
+ ->notPath('ZendTest/Code/Reflection/TestAsset')
+ ->notPath('ZendTest/Code/TestAsset')
+ ->notPath('ZendTest/Validator/_files')
+ ->notPath('ZendTest/Loader/_files')
+ ->notPath('ZendTest/Loader/TestAsset')
->filter(function (SplFileInfo $file) {
if (strstr($file->getPath(), 'compatibility')) {
return false;
@@ -21,6 +17,21 @@ $finder = Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__ . '/tests')
->in(__DIR__ . '/bin');
$config = Symfony\CS\Config\Config::create();
-$config->fixers(Symfony\CS\FixerInterface::PSR2_LEVEL);
+$config->fixers(
+ array(
+ 'indentation',
+ 'linefeed',
+ 'trailing_spaces',
+ 'short_tag',
+ 'visibility',
+ 'php_closing_tag',
+ 'braces',
+ 'function_declaration',
+ 'psr0',
+ 'elseif',
+ 'eof_ending',
+ 'unused_use',
+ )
+);
$config->finder($finder);
return $config;
View
2  .travis.yml
@@ -16,7 +16,7 @@ before_script:
- cp tests/TestConfiguration.php.travis tests/TestConfiguration.php
script:
- - bin/check-cs.sh
+ - vendor/bin/php-cs-fixer fix -v --dry-run .
# Run tests for the various components in parallel
- ls -d tests/ZendTest/* | parallel --gnu --keep-order 'echo "Running {} tests"; ./vendor/bin/phpunit -c tests/phpunit.xml.dist --coverage-php build/coverage/coverage-{/.}.cov {};' || exit 1
View
21 bin/check-cs.sh
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-FIXER_PATH="`dirname $0`/../vendor/fabpot/php-cs-fixer/php-cs-fixer"
-
-libraryCS=$(php $FIXER_PATH fix -v --dry-run --level=psr2 ./library --fixers=unused_use)
-testsCS=$(php $FIXER_PATH fix -v --dry-run --level=psr2 ./tests)
-
-if [[ "$libraryCS" || "$testsCS" ]];
-then
- echo -en '\E[31m'"$libraryCS
-$testsCS\033[1m\033[0m";
- printf "\n";
- echo -en '\E[31;47m'"\033[1mCoding standards check failed!\033[0m" # Red
- printf "\n";
- exit 2;
-fi
-
-echo -en '\E[32m'"\033[1mCoding standards check passed!\033[0m" # Green
-printf "\n";
-
-echo $libraryCS$testsCS;
View
17 tests/.php_cs
@@ -1,17 +0,0 @@
-<?php
-$finder = Symfony\CS\Finder\DefaultFinder::create()
- ->files()
- ->notPath('ZendTest/Code/Reflection/FunctionReflectionTest.php')
- ->notPath('ZendTest/Code/Reflection/MethodReflectionTest.php')
- ->notPath('ZendTest/Code/Reflection/TestAsset/closures.php')
- ->notPath('ZendTest/Code/Reflection/TestAsset/functions.php')
- ->notPath('ZendTest/Code/Reflection/TestAsset/TestSampleClass10.php')
- ->notPath('ZendTest/Code/Reflection/TestAsset/TestSampleClass11.php')
- ->notPath('ZendTest/Code/TestAsset')
- ->notPath('ZendTest/Validator/_files')
- ->notPath('ZendTest/Loader/_files')
- ->notPath('ZendTest/Loader/TestAsset')
- ->in(__DIR__);
-
-return Symfony\CS\Config\Config::create()
- ->finder($finder);
View
1  tests/ZendTest/Barcode/Object/TestCommon.php
@@ -9,7 +9,6 @@
namespace ZendTest\Barcode\Object;
-use ZendTest\Barcode\Object\TestAsset;
use Zend\Barcode;
use Zend\Config;
View
1  tests/ZendTest/Code/Generator/FileGeneratorTest.php
@@ -9,7 +9,6 @@
namespace ZendTest\Code\Generator;
-use Exception;
use Zend\Code\Generator\ClassGenerator;
use Zend\Code\Generator\FileGenerator;
use Zend\Code\Reflection\FileReflection;
View
1  tests/ZendTest/Filter/BaseNameTest.php
@@ -9,7 +9,6 @@
namespace ZendTest\Filter;
use Zend\Filter\BaseName as BaseNameFilter;
-use Zend\Stdlib\ErrorHandler;
/**
* @group Zend_Filter
View
1  tests/ZendTest/Filter/DigitsTest.php
@@ -10,7 +10,6 @@
namespace ZendTest\Filter;
use Zend\Filter\Digits as DigitsFilter;
-use Zend\Stdlib\ErrorHandler;
/**
* @group Zend_Filter
View
1  tests/ZendTest/Filter/IntTest.php
@@ -10,7 +10,6 @@
namespace ZendTest\Filter;
use Zend\Filter\Int as IntFilter;
-use Zend\Stdlib\ErrorHandler;
/**
* @group Zend_Filter
View
1  tests/ZendTest/Filter/RealPathTest.php
@@ -10,7 +10,6 @@
namespace ZendTest\Filter;
use Zend\Filter\RealPath as RealPathFilter;
-use Zend\Stdlib\ErrorHandler;
/**
* @group Zend_Filter
View
1  tests/ZendTest/Filter/StringToLowerTest.php
@@ -10,7 +10,6 @@
namespace ZendTest\Filter;
use Zend\Filter\StringToLower as StringToLowerFilter;
-use Zend\Stdlib\ErrorHandler;
/**
* @group Zend_Filter
View
1  tests/ZendTest/Filter/StringToUpperTest.php
@@ -10,7 +10,6 @@
namespace ZendTest\Filter;
use Zend\Filter\StringToUpper as StringToUpperFilter;
-use Zend\Stdlib\ErrorHandler;
/**
* @group Zend_Filter
View
1  tests/ZendTest/Filter/StripTagsTest.php
@@ -10,7 +10,6 @@
namespace ZendTest\Filter;
use Zend\Filter\StripTags as StripTagsFilter;
-use Zend\Stdlib\ErrorHandler;
/**
* @group Zend_Filter
View
1  tests/ZendTest/Mvc/Controller/Plugin/TestAsset/InputFilterProviderFieldset.php
@@ -9,7 +9,6 @@
namespace ZendTest\Mvc\Controller\Plugin\TestAsset;
-use Zend\Form\Element;
use Zend\Form\Fieldset;
use Zend\InputFilter\InputFilterProviderInterface;
View
1  tests/ZendTest/Mvc/Router/SimpleRouteStackTest.php
@@ -14,7 +14,6 @@
use Zend\Stdlib\Request;
use Zend\Mvc\Router\RoutePluginManager;
use Zend\Mvc\Router\SimpleRouteStack;
-use ZendTest\Mvc\Router\FactoryTester;
class SimpleRouteStackTest extends TestCase
{
View
1  tests/ZendTest/Permissions/Acl/Assertion/AssertionAggregateTest.php
@@ -9,7 +9,6 @@
namespace ZendTest\Permissions\Acl\Assertion;
use Zend\Permissions\Acl\Assertion\AssertionAggregate;
-use ZendTest\Permissions\Acl\TestAsset\MockAssertion;
use Zend\Di\Exception\UndefinedReferenceException;
class AssertionAggregateTest extends \PHPUnit_Framework_TestCase
View
1  tests/ZendTest/Permissions/Rbac/RbacTest.php
@@ -10,7 +10,6 @@
namespace ZendTest\Permissions\Rbac;
use Zend\Permissions\Rbac;
-use ZendTest\Permissions\Rbac\TestAsset;
/**
* @group Zend_Rbac
View
1  tests/ZendTest/Tag/Cloud/CloudTest.php
@@ -14,7 +14,6 @@
use Zend\Tag\Cloud;
use Zend\Tag\Cloud\DecoratorPluginManager;
use Zend\Tag\Exception\InvalidArgumentException;
-use ZendTest\Tag\Cloud\TestAsset;
/**
* @group Zend_Tag
View
1  tests/ZendTest/Validator/ExplodeTest.php
@@ -10,7 +10,6 @@
namespace ZendTest\Validator;
use Zend\Validator\Explode;
-use Zend\Validator\EmailAddress;
use Zend\Validator\Regex;
/**
Something went wrong with that request. Please try again.