Php-cs-fixer: Laravel 5.1 --level=psr2 is renaming the namespace

Created on 19 Oct 2015  路  5Comments  路  Source: FriendsOfPHP/PHP-CS-Fixer

Hello,
I'm using php-cs-fixer in Sublime and after saving a controller file the first letter from namespace is lowercase. From namespace App\Http\Controllers to namespace app\Http\Controllers;

I found a solution to add a new line "app\": "app/" inside composer.json:

"autoload": {
    "classmap": [
        "database"
    ],        
    "psr-4": {
        "App\\": "app/",
        "app\\": "app/"
    }
},

It is a best practice to use this solution?

Regards,
Radu

kinquestion

Most helpful comment

I found a solution using a config file for Laravel.
https://gist.github.com/jatubio/dfbebf73ea79f9f72e02

Thank you.

All 5 comments

NOT a bug.

You MUST disable the psr0 fixer since you are not using psr0.

"app\": "app/"

That is definitely wrong.

How can I disable the psr0 fixer?
Right now I have:

"php_cs_fixer_additional_args": {
    "--level": "psr2",
},

Many thanks

I found a solution using a config file for Laravel.
https://gist.github.com/jatubio/dfbebf73ea79f9f72e02

Thank you.

Was this page helpful?
0 / 5 - 0 ratings