Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jrdavidson's avatar

PHP CS Fixer

I'm setting up phpcs rules for a new work application. I use VSCode as my IDE and have the PHPCS extension installed. I'm trying to figure out why when I run php-cs-fixer:fix-this-file command and when I'm inside of the new application I get the following error. I run the same command for both projects and both .php_cs files are located in the root of the projects.

I'm using the following php cs fixer for the work project. https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200

The only differences is below.

PHP CS Fixer: php general error.

Work project: .php_cs

$project_path = getcwd();
$finder = Finder::create()
    ->in([
        $project_path.'/app',
        $project_path.'/config',
        $project_path.'/database',
        $project_path.'/resources',
        $project_path.'/routes',
        $project_path.'/tests',
    ])
    ->name('*.php')
    ->notName('*.blade.php')
    ->ignoreDotFiles(true)
    ->ignoreVCS(true);

Hobby project: .php_cs

$finder = Finder::create()
    ->notPath('bootstrap')
    ->notPath('storage')
    ->notPath('vendor')
    ->in(getcwd())
    ->name('*.php')
    ->notName('*.blade.php')
    ->notName('index.php')
    ->notName('server.php')
    ->ignoreDotFiles(true)
    ->ignoreVCS(true);
0 likes
0 replies

Please or to participate in this conversation.