Issues (9)

.php-cs-fixer.dist.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of PHP CS Fixer.
7
 *
8
 * (c) Fabien Potencier <[email protected]>
9
 *     Dariusz Rumiński <[email protected]>
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14
15
$header = <<<'EOF'
16
This file is part of PHP CS Fixer.
17
18
(c) Fabien Potencier <[email protected]>
19
    Dariusz Rumiński <[email protected]>
20
21
This source file is subject to the MIT license that is bundled
22
with this source code in the file LICENSE.
23
EOF;
24
25
$finder = PhpCsFixer\Finder::create()
26
    ->ignoreVCSIgnored(true)
27
    ->exclude('tests/Fixtures')
28
    ->in(__DIR__)
29
    ->append([
30
        __DIR__ . '/dev-tools/doc.php',
31
        // __DIR__.'/php-cs-fixer', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message
32
        __FILE__,
33
    ])
34
;
35
36
$config = new PhpCsFixer\Config();
37
$config
38
    ->setRiskyAllowed(true)
39
    ->setRules([
40
        '@PSR2' => true,
41
        'array_indentation' => true,
42
        'array_syntax' => [
43
            'syntax' => 'short',
44
        ],
45
        'concat_space' => [
46
            'spacing' => 'one',
47
        ],
48
        'method_chaining_indentation' => true,
49
        'phpdoc_indent' => true,
50
        'no_unused_imports' => true,
51
        'no_blank_lines_after_class_opening' => true,
52
        'no_blank_lines_after_phpdoc' => true,
53
        'no_whitespace_before_comma_in_array' => true,
54
        'no_whitespace_in_blank_line' => true,
55
        'php_unit_namespaced' => true,
56
        'psr_autoloading' => true,
57
        'short_scalar_cast' => true,
58
        'trailing_comma_in_multiline' => true,
59
    ])
60
    ->setFinder($finder)
61
;
62
63
// special handling of fabbot.io service if it's using too old PHP CS Fixer version
64
if (false !== getenv('FABBOT_IO')) {
65
    try {
66
        PhpCsFixer\FixerFactory::create()
0 ignored issues
show
The method create() does not exist on PhpCsFixer\FixerFactory. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

66
        PhpCsFixer\FixerFactory::/** @scrutinizer ignore-call */ 
67
                                 create()

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
67
            ->registerBuiltInFixers()
68
            ->registerCustomFixers($config->getCustomFixers())
69
            ->useRuleSet(new PhpCsFixer\RuleSet($config->getRules()))
70
        ;
71
    } catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) {
72
        $config->setRules([]);
73
    } catch (UnexpectedValueException $e) {
74
        $config->setRules([]);
75
    } catch (InvalidArgumentException $e) {
76
        $config->setRules([]);
77
    }
78
}
79
80
return $config;
81