merged branch baldurrensch/issue_158 (PR #173)
merged branch baldurrensch/issue_158 (PR #173)

This PR was merged into the master branch.

Commits
-------

951475f Changed exit to just return
85e4f1f Return non-zero status code if anything was fixed

Discussion
----------

Return non-zero status code if anything was fixed

This is so that commit hooks, or CI tools can easily fail.

fixes #158

---------------------------------------------------------------------------

by lyrixx at 2013-01-25T21:53:22Z

You should not exit by yourself, but return the return code.
See: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Application.php#L193 and https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Application.php#L119

---------------------------------------------------------------------------

by baldurrensch at 2013-01-25T22:20:52Z

@lyrixx: Thanks for the comment. FIxed.

---------------------------------------------------------------------------

by stof at 2013-01-25T23:29:45Z

This is bad IMO. The goal of the fixer is to fix your code. So why would it be a failure when it does its job ?

---------------------------------------------------------------------------

by baldurrensch at 2013-01-25T23:43:26Z

It would make it a little easier to use in tests (CI, pre-commit hook). I would have no problem with adding a comand-line option `--check` to enable the return code. Please also see the discussion for the issue.

---------------------------------------------------------------------------

by lyrixx at 2013-01-26T11:05:55Z

@stof I agree with you. But in this case, it's better to be pragmatic and don't respect the purity of code.

You can also made an analogy with grep:

``` bash
>[~/dev/foo](patch-2) grep foooooo web/index.php
>[~/dev/foo](patch-2) echo $?
1
>[~/dev/foo](patch-2) grep php web/index.php
Some content ...
>[~/dev/foo](patch-2) echo $?
0
```

If grep find something, it return 0, If not it return 1.
If php-cs-fixer find something it return 0, else it return 1. (Yes the pr do the opposite)

cognifloyd/PHP-CS-Fixer,devypt/PHP-CS-Fixer,royopa/PHP-CS-Fixer,phansys/PHP-CS-Fixer,junichi11/PHP-CS-Fixer,df2k2/PHP-CS-Fixer,fezfez/PHP-CS-Fixer,rokerkony/PHP-CS-Fixer,rokerkony/PHP-CS-Fixer,gharlan/PHP-CS-Fixer,felixgomez/PHP-CS-Fixer,FriendsOfPHP/PHP-CS-Fixer,GuillaumeDievart/PHP-CS-Fixer,Padam87/PHP-CS-Fixer,vijaycs85/PHP-CS-Fixer,samokspv/PHP-CS-Fixer,lmanzke/PHP-CS-Fixer,cureoeu/PHP-CS-Fixer,gharlan/PHP-CS-Fixer,devypt/PHP-CS-Fixer,macik/PHP-CS-Fixer,lucasmichot/PHP-CS-Fixer,kenyiu/PHP-CS-Fixer,junichi11/PHP-CS-Fixer,nekulin/PHP-CS-Fixer,SpacePossum/PHP-CS-Fixer,fezfez/PHP-CS-Fixer,AplayER/PHP-CS-Fixer,FriendsOfPHP/PHP-CS-Fixer,maZahaca/PHP-CS-Fixer,SpacePossum/PHP-CS-Fixer,igormukhingmailcom/PHP-CS-Fixer,royopa/PHP-CS-Fixer,igormukhingmailcom/PHP-CS-Fixer,kubawerlos/PHP-CS-Fixer,lucasmichot/PHP-CS-Fixer,keradus/PHP-CS-Fixer,lmanzke/PHP-CS-Fixer,vijaycs85/PHP-CS-Fixer,stof/PHP-CS-Fixer,df2k2/PHP-CS-Fixer,Soullivaneuh/PHP-CS-Fixer,AplayER/PHP-CS-Fixer,maZahaca/PHP-CS-Fixer,kubawerlos/PHP-CS-Fixer,GrahamCampbell/PHP-CS-Fixer,nekulin/PHP-CS-Fixer,Slamdunk/PHP-CS-Fixer,kenyiu/PHP-CS-Fixer,macik/PHP-CS-Fixer,Slamdunk/PHP-CS-Fixer,ruudvanderweijde/PHP-CS-Fixer,keradus/PHP-CS-Fixer,cognifloyd/PHP-CS-Fixer,Padam87/PHP-CS-Fixer,ruudvanderweijde/PHP-CS-Fixer,cureoeu/PHP-CS-Fixer,GrahamCampbell/PHP-CS-Fixer,GuillaumeDievart/PHP-CS-Fixer,Soullivaneuh/PHP-CS-Fixer,felixgomez/PHP-CS-Fixer,phansys/PHP-CS-Fixer,samokspv/PHP-CS-Fixer