Skip to content

php-cs-fixer issue #123

Description

@scramatte

Hi,

I've got a problem with php-cs-fixer

I've made a custom .php_cs config file as following because I need to ignore files
that are located into database/* and don't follow PSR2 rules. Unfortunately I'm unable to get it working. Note that I use Lumen framework (Laravel ...)

My .php_cs config file

<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = PhpCsFixer\Finder::create()
    ->files()
    ->in('app')
    ->name('*.php')
    ->ignoreDotFiles(true)
    ->ignoreVCS(true);

return PhpCsFixer\Config::create()
    ->setRules(array(
        '@PSR0' => false,
        '@PSR1' => false,
        '@PSR2' => true
    ))
    ->setFinder($finder);

?>

My php-git-hooks.yaml

pre-commit:
    enabled: true
    execute:
        composer: true
        jsonlint: true
        phplint: true
        phpmd:
            enabled: true
            options: null
        phpcs:
            enabled: true
            standard: phpcs.xml
            ignore: null
        php-cs-fixer:
            enabled: true
            levels:
                psr0: false
                psr1: false
                psr2: true
                symfony: false
            options: null

Output when I try commit ...

Running PHPLINT...................................0K
Checking code style with PHPCS....................0K
Checking PSR2 code style with PHP-CS-FIXER........
Fail

Loaded config default from "/opt/eom/gisdata/.php_cs".
Using cache file ".php_cs.cache".
Paths from configuration file have been overridden by paths provided as command arguments.
Loaded config default from "/opt/eom/gisdata/.php_cs".
Using cache file ".php_cs.cache".
Paths from configuration file have been overridden by paths provided as command arguments.
Loaded config default from "/opt/eom/gisdata/.php_cs".
Using cache file ".php_cs.cache".
Paths from configuration file have been overridden by paths provided as command arguments.
Loaded config default from "/opt/eom/gisdata/.php_cs".
Using cache file ".php_cs.cache".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions