Ignoring some special cases of functions getting visibility added when
not in a class.  With some additional tests, some taken from #332.
Enhancement: Always add path from console input
bug #342 Enhancement: Always add path from console input (localheinz)

This PR was merged into the 0.4.x-dev branch.

Discussion
----------

Enhancement: Always add path from console input

The change proposed in #262 makes the feature #251 work only with the change proposed in this PR:

## Steps to reproduce

Create a `.php_cs` file with the following contents:

```php
return Symfony\CS\Config\Config::create()
    ->fixers([
        'indentation',
        'linefeed',
        // . . .
    ])
;
```

Create some php file `foo.php` and run

```
$ bin/php-cs-fixer fix --config-file=.php_cs --dry-run --verbose foo.php
```

## Result

```
Loaded config from ".php_cs"

[LogicException]
You must call one of in() or append() methods before iterating over a Finder.

Exception trace:
() at /Users/localheinz/foo/vendor/symfony/finder/Symfony/Component/Finder/Finder.php:688
Symfony\Component\Finder\Finder->getIterator() at /Users/localheinz/foo/vendor/fabpot/php-cs-fixer/Symfony/CS/Fixer.php:92
Symfony\CS\Fixer->fix() at /Users/localheinz/foo/vendor/fabpot/php-cs-fixer/Symfony/CS/Console/Command/FixCommand.php:284
Symfony\CS\Console\Command\FixCommand->execute() at /Users/localheinz/foo/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
Symfony\Component\Console\Command\Command->run() at /Users/localheinz/foo/vendor/symfony/console/Symfony/Component/Console/Application.php:892
Symfony\Component\Console\Application->doRunCommand() at /Users/localheinz/foo/vendor/symfony/console/Symfony/Component/Console/Application.php:191
Symfony\Component\Console\Application->doRun() at /Users/localheinz/foo/vendor/symfony/console/Symfony/Component/Console/Application.php:121
Symfony\Component\Console\Application->run() at /Users/localheinz/foo/vendor/fabpot/php-cs-fixer/php-cs-fixer:27

fix [--config="..."] [--config-file[="..."]] [--dry-run] [--level="..."] [--fixers="..."] [--diff] [--format="..."] path
```

Updating the configuration in `.php_cs` and

```php
$finder = Symfony\CS\Finder\DefaultFinder::create()
    ->exclude('somedir')
    ->in(__DIR__)
;

return return Symfony\CS\Config\Config::create()
    ->finder($finder)
    ->fixers([
        'indentation',
        'linefeed',
        // . . .
    ])
;
```

doesn't help because only the file(s) represented by or in the specified path should be fixed.

## Fix

Just add the path as specified from the console already, and this works!

Commits
-------

a7e5c59 Enhancement: Always add path from console input
bug #336 Ignoring some special cases of functions getting visibility added (jaydiablo)

This PR was merged into the 0.4.x-dev branch.

Discussion
----------

Ignoring some special cases of functions getting visibility added

This is similar to #332, but this one includes a fix.  When running php-cs-fixer against more procedural style code (no oop) this visibility fixer would add "public" visibility keyword to the front of the function declarations, causing fatal syntax errors.  I added the test cases from #332, and added some more that I discovered it was processing (that it shouldn't be).

To pass these tests, I've modified the fixer to look for the OOP trigger words in what would be considered PHP code, rather than just the entire source content (ignores comments, doc blocks, strings and inline html).  I didn't see any easy way to do this with the regex used, but by using PHP's tokenizer I was able to strip these tokens from the content before the regex is run.

I had to add <?php tags to all of the tests for this class because otherwise the text is seen as T_INLINE_HTML to the tokenizer.

Commits
-------

9d79607 Ignoring some special cases of functions getting visibility added when not in a class.  With some additional tests, some taken from #332.
Enhancement: Make path argument optional
bug #345 Enhancement: Make path argument optional (localheinz)

This PR was merged into the 0.4.x-dev branch.

Discussion
----------

Enhancement: Make path argument optional

Some people - namely the [ZF2](http://github.com/zendframework/zf2) community - have been experiencing failing builds on Travis as a result of https://github.com/fabpot/PHP-CS-Fixer/pull/342 and the following setup:

### Steps to reproduce

* requiring `fabpot/php-cs-fixer: "dev-master"`
* running (note the `.` as `path` argument)

    ```
     $ vendor/bin/php-cs-fixer fix -v --dry-run .
    ```

    while having a `.php_cs` that specifies directories

   ```php
   $finder = Symfony\CS\Finder\DefaultFinder::create()
        ->in(__DIR__ . '/library')
        ->in(__DIR__ . '/tests')
        ->in(__DIR__ . '/bin')
    ;
    ```

    and while having files within `__DIR__` (or other directories therein not listed above) that will cause the script to exit with something else than `0` as status.

Basically, the problem is that the `path` argument is *required*, and in a setup as described above and with the changes introduced in #342, the `.` path gets added to the `Finder` while before #342, it wasn't.

### Solution

Either revert #342 or make the `path` argument optional.

This PR makes the `path` argument optional.

Commits
-------

121454e Enhancement: Make path argument optional
Fix $config(Dir|File)
bug #347 Fix $config(Dir|File) (webarto)

This PR was merged into the 0.4.x-dev branch.

Discussion
----------

Fix $config(Dir|File)

Current way of looking for `.php_cs` is a bit broken, here are few examples:

```
# OK
/opt/PHP-CS-Fixer>php php-cs-fixer fix --dry-run vendor
"/opt/PHP-CS-Fixer/vendor/.php_cs"
# FAIL
/opt/PHP-CS-Fixer>php php-cs-fixer fix --dry-run vendor/autoload.php
"/opt/PHP-CS-Fixer/vendor/autoload.php/.php_cs"
# FAIL
/opt/PHP-CS-Fixer>php php-cs-fixer fix --dry-run - < vendor/autoload.php
"/opt/PHP-CS-Fixer/-/.php_cs"
```

With fix (I can't say it's elegant):

```
# OK
/opt/PHP-CS-Fixer>php php-cs-fixer fix --dry-run vendor
"/opt/PHP-CS-Fixer/vendor/.php_cs"
# OK
/opt/PHP-CS-Fixer>php php-cs-fixer fix --dry-run vendor/autoload.php
"/opt/PHP-CS-Fixer/vendor/.php_cs"
# OK, assume current directory for STDIN
/opt/PHP-CS-Fixer>php php-cs-fixer fix --dry-run - < vendor/autoload.php
"/opt/PHP-CS-Fixer/.php_cs"
```

Commits
-------

86a0f41 Fix $config(Dir|File)