diff --git a/.php_cs b/.php_cs index 801685b96..84be2fc1e 100644 --- a/.php_cs +++ b/.php_cs @@ -6,7 +6,7 @@ use Symfony\CS\FixerInterface; $config = Config::create() // use symfony level and extra fixers: ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) - ->fixers(array('-concat_without_spaces', 'concat_with_spaces', 'strict')) + ->fixers(array('align_double_arrow', '-concat_without_spaces', 'concat_with_spaces', 'ordered_use', 'strict')) ->setUsingLinter(false); $finder = $config->getFinder() diff --git a/.styleci.yml b/.styleci.yml new file mode 100644 index 000000000..beb7e35e5 --- /dev/null +++ b/.styleci.yml @@ -0,0 +1,10 @@ +preset: symfony + +enabled: + - align_double_arrow + - concat_with_spaces + - ordered_use + - strict + +disabled: + - concat_without_spaces diff --git a/.travis.yml b/.travis.yml index 7ff226421..030e85cbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,6 @@ install: script: - vendor/bin/phpunit - - vendor/bin/phpcs -n --standard=phpcs.xml ./ - - vendor/bin/php-cs-fixer --diff --dry-run -vv fix matrix: allow_failures: diff --git a/composer.json b/composer.json index e66a1b6b9..4f661c860 100644 --- a/composer.json +++ b/composer.json @@ -21,9 +21,9 @@ }, "require-dev": { "phpunit/phpunit": "~3.7|~4.0", - "symfony/finder": "~2.1", + "symfony/finder": "~2.1|~3.0", "squizlabs/php_codesniffer": "~2.0", - "fabpot/php-cs-fixer": "~1.3" + "fabpot/php-cs-fixer": "~1.5" }, "suggest": { "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", diff --git a/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php b/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php index 6c58d506a..48d54323b 100644 --- a/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php +++ b/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php @@ -13,10 +13,10 @@ use PhpParser\Node; use PhpParser\Node\Expr\Array_ as ArrayNode; -use PhpParser\Node\Expr\Empty_ as EmptyNode; -use PhpParser\Node\Expr\Isset_ as IssetNode; use PhpParser\Node\Expr\Assign as AssignNode; +use PhpParser\Node\Expr\Empty_ as EmptyNode; use PhpParser\Node\Expr\FuncCall as FunctionCall; +use PhpParser\Node\Expr\Isset_ as IssetNode; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; use Psy\Exception\FatalErrorException; diff --git a/src/Psy/CodeCleaner/InstanceOfPass.php b/src/Psy/CodeCleaner/InstanceOfPass.php index 6b00bbf6f..e07ed560d 100644 --- a/src/Psy/CodeCleaner/InstanceOfPass.php +++ b/src/Psy/CodeCleaner/InstanceOfPass.php @@ -12,10 +12,10 @@ namespace Psy\CodeCleaner; use PhpParser\Node; +use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\Instanceof_ as InstanceofStmt; use PhpParser\Node\Scalar; use PhpParser\Node\Scalar\Encapsed; -use PhpParser\Node\Expr\ConstFetch; use Psy\Exception\FatalErrorException; /** diff --git a/src/Psy/CodeCleaner/StaticConstructorPass.php b/src/Psy/CodeCleaner/StaticConstructorPass.php index a164ea69b..9b3ee39a8 100644 --- a/src/Psy/CodeCleaner/StaticConstructorPass.php +++ b/src/Psy/CodeCleaner/StaticConstructorPass.php @@ -12,9 +12,9 @@ namespace Psy\CodeCleaner; use PhpParser\Node; -use PhpParser\Node\Stmt\Namespace_ as NamespaceStmt; use PhpParser\Node\Stmt\Class_ as ClassStmt; use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\Stmt\Namespace_ as NamespaceStmt; use Psy\Exception\FatalErrorException; /** diff --git a/src/Psy/Command/HistoryCommand.php b/src/Psy/Command/HistoryCommand.php index b6bfefaea..47b3a38f8 100644 --- a/src/Psy/Command/HistoryCommand.php +++ b/src/Psy/Command/HistoryCommand.php @@ -13,10 +13,10 @@ use Psy\Output\ShellOutput; use Psy\Readline\Readline; +use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Formatter\OutputFormatter; /** * Psy Shell history command. diff --git a/src/Psy/Command/ListCommand.php b/src/Psy/Command/ListCommand.php index 64a81412b..eb6d00481 100644 --- a/src/Psy/Command/ListCommand.php +++ b/src/Psy/Command/ListCommand.php @@ -24,8 +24,8 @@ use Psy\Exception\RuntimeException; use Psy\Presenter\PresenterManager; use Psy\Presenter\PresenterManagerAware; -use Symfony\Component\Console\Helper\TableHelper; use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Helper\TableHelper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; diff --git a/src/Psy/Command/ListCommand/Enumerator.php b/src/Psy/Command/ListCommand/Enumerator.php index 82cbb8256..2830c7e5a 100644 --- a/src/Psy/Command/ListCommand/Enumerator.php +++ b/src/Psy/Command/ListCommand/Enumerator.php @@ -12,8 +12,8 @@ namespace Psy\Command\ListCommand; use Psy\Formatter\SignatureFormatter; -use Psy\Util\Mirror; use Psy\Presenter\PresenterManager; +use Psy\Util\Mirror; use Symfony\Component\Console\Input\InputInterface; /** diff --git a/src/Psy/Command/ListCommand/VariableEnumerator.php b/src/Psy/Command/ListCommand/VariableEnumerator.php index d13b662b4..4aefb4127 100644 --- a/src/Psy/Command/ListCommand/VariableEnumerator.php +++ b/src/Psy/Command/ListCommand/VariableEnumerator.php @@ -11,8 +11,8 @@ namespace Psy\Command\ListCommand; -use Psy\Presenter\PresenterManager; use Psy\Context; +use Psy\Presenter\PresenterManager; use Symfony\Component\Console\Input\InputInterface; /** diff --git a/src/Psy/Command/TraceCommand.php b/src/Psy/Command/TraceCommand.php index 350d4bd2b..e12b35fed 100644 --- a/src/Psy/Command/TraceCommand.php +++ b/src/Psy/Command/TraceCommand.php @@ -12,10 +12,10 @@ namespace Psy\Command; use Psy\Output\ShellOutput; +use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Formatter\OutputFormatter; /** * Show the current stack trace. diff --git a/src/Psy/ExecutionLoop/Loop.php b/src/Psy/ExecutionLoop/Loop.php index 49b23fc2f..a8efdbec7 100644 --- a/src/Psy/ExecutionLoop/Loop.php +++ b/src/Psy/ExecutionLoop/Loop.php @@ -12,9 +12,9 @@ namespace Psy\ExecutionLoop; use Psy\Configuration; -use Psy\Shell; use Psy\Exception\BreakException; use Psy\Exception\ThrowUpException; +use Psy\Shell; /** * The Psy Shell execution loop. diff --git a/src/Psy/Formatter/SignatureFormatter.php b/src/Psy/Formatter/SignatureFormatter.php index e5d8d037a..333bf0eab 100644 --- a/src/Psy/Formatter/SignatureFormatter.php +++ b/src/Psy/Formatter/SignatureFormatter.php @@ -11,8 +11,8 @@ namespace Psy\Formatter; -use Psy\Util\Json; use Psy\Reflection\ReflectionConstant; +use Psy\Util\Json; use Symfony\Component\Console\Formatter\OutputFormatter; /** diff --git a/src/Psy/Shell.php b/src/Psy/Shell.php index fbf75d613..c447b4a3a 100644 --- a/src/Psy/Shell.php +++ b/src/Psy/Shell.php @@ -11,23 +11,23 @@ namespace Psy; -use Psy\Exception\ThrowUpException; use Psy\Exception\BreakException; use Psy\Exception\ErrorException; use Psy\Exception\Exception as PsyException; +use Psy\Exception\ThrowUpException; use Psy\Output\ShellOutput; use Psy\Presenter\PresenterManagerAware; use Psy\TabCompletion\Matcher; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command as BaseCommand; use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\ArgvInput; /** * The Psy Shell application. diff --git a/test/Psy/Test/ConfigurationTest.php b/test/Psy/Test/ConfigurationTest.php index 43f995525..aee0f0508 100644 --- a/test/Psy/Test/ConfigurationTest.php +++ b/test/Psy/Test/ConfigurationTest.php @@ -11,10 +11,10 @@ namespace Psy\Test; -use Psy\Configuration; use Psy\CodeCleaner; -use Psy\Output\PassthruPager; +use Psy\Configuration; use Psy\ExecutionLoop\Loop; +use Psy\Output\PassthruPager; use Symfony\Component\Console\Output\ConsoleOutput; class ConfigurationTest extends \PHPUnit_Framework_TestCase diff --git a/test/Psy/Test/Exception/BreakExceptionTest.php b/test/Psy/Test/Exception/BreakExceptionTest.php index fcd1958ee..a55e33fce 100644 --- a/test/Psy/Test/Exception/BreakExceptionTest.php +++ b/test/Psy/Test/Exception/BreakExceptionTest.php @@ -11,8 +11,8 @@ namespace Psy\Test\Exception; -use Psy\Exception\Exception; use Psy\Exception\BreakException; +use Psy\Exception\Exception; class BreakExceptionTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Psy/Test/Exception/ErrorExceptionTest.php b/test/Psy/Test/Exception/ErrorExceptionTest.php index 5b0a020d3..577a94814 100644 --- a/test/Psy/Test/Exception/ErrorExceptionTest.php +++ b/test/Psy/Test/Exception/ErrorExceptionTest.php @@ -11,8 +11,8 @@ namespace Psy\Test\Exception; -use Psy\Exception\Exception; use Psy\Exception\ErrorException; +use Psy\Exception\Exception; class ErrorExceptionTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Psy/Test/Formatter/SignatureFormatterTest.php b/test/Psy/Test/Formatter/SignatureFormatterTest.php index 406a2c7dc..766127715 100644 --- a/test/Psy/Test/Formatter/SignatureFormatterTest.php +++ b/test/Psy/Test/Formatter/SignatureFormatterTest.php @@ -11,8 +11,8 @@ namespace Psy\Test\Formatter; -use Psy\Reflection\ReflectionConstant; use Psy\Formatter\SignatureFormatter; +use Psy\Reflection\ReflectionConstant; class SignatureFormatterTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Psy/Test/ShellTest.php b/test/Psy/Test/ShellTest.php index 284ef0a6f..d91adf337 100644 --- a/test/Psy/Test/ShellTest.php +++ b/test/Psy/Test/ShellTest.php @@ -11,10 +11,10 @@ namespace Psy\Test; +use Psy\Configuration; use Psy\Exception\ErrorException; use Psy\Exception\ParseErrorException; use Psy\Shell; -use Psy\Configuration; use Symfony\Component\Console\Output\StreamOutput; class ShellTest extends \PHPUnit_Framework_TestCase diff --git a/test/Psy/Test/Util/MirrorTest.php b/test/Psy/Test/Util/MirrorTest.php index a620c4a6e..3da19c8dc 100644 --- a/test/Psy/Test/Util/MirrorTest.php +++ b/test/Psy/Test/Util/MirrorTest.php @@ -11,8 +11,8 @@ namespace Psy\Test\Util; -use Psy\Util\Mirror; use Psy\Reflection\ReflectionConstant; +use Psy\Util\Mirror; class MirrorTest extends \PHPUnit_Framework_TestCase {