Issues (1)

.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
if (!file_exists(__DIR__.'/src')) {
15
    exit(0);
16
}
17
18
$finder = PhpCsFixer\Finder::create()
19
    ->in(__DIR__.'/src')
20
    ->append([__FILE__])
21
    ->notPath('#/Fixtures/#')
22
    ->exclude([
23
        // directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code
24
        // fixture templates
25
        'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
26
        // resource templates
27
        'Symfony/Bundle/FrameworkBundle/Resources/views/Form',
28
        // explicit trigger_error tests
29
        'Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/',
30
    ])
31
    // Support for older PHPUnit version
32
    ->notPath('Symfony/Bridge/PhpUnit/SymfonyTestsListener.php')
33
    ->notPath('#Symfony/Bridge/PhpUnit/.*Mock\.php#')
34
    ->notPath('#Symfony/Bridge/PhpUnit/.*Legacy#')
35
    // file content autogenerated by `var_export`
36
    ->notPath('Symfony/Component/Translation/Tests/fixtures/resources.php')
37
    // file content autogenerated by `VarExporter::export`
38
    ->notPath('Symfony/Component/Serializer/Tests/Fixtures/serializer.class.metadata.php')
39
    // test template
40
    ->notPath('Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php')
41
    // explicit trigger_error tests
42
    ->notPath('Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php')
43
;
44
45
$config = new PhpCsFixer\Config();
46
$config
47
    ->setRiskyAllowed(true)
48
    ->setRules([
49
        '@Symfony' => true,
50
        '@PhpCsFixer' => true,
51
        '@PHP80Migration' => true,
52
        '@Symfony:risky' => true,
53
        '@DoctrineAnnotation' => true,
54
        '@PHPUnit75Migration:risky' => true,
55
        'array_syntax' => ['syntax' => 'short'],
56
        'fopen_flags' => false,
57
        'protected_to_private' => false,
58
        'native_constant_invocation' => true,
59
        'combine_nested_dirname' => true,
60
        'list_syntax' => ['syntax' => 'short'],
61
        'ternary_to_null_coalescing' => true,
62
        'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
63
        'no_superfluous_phpdoc_tags' => false,
64
        'php_unit_method_casing' => ['case' => 'snake_case'],
65
    ])
66
    ->setFinder($finder)
67
;
68
69
// special handling of fabbot.io service if it's using too old PHP CS Fixer version
70
if (false !== getenv('FABBOT_IO')) {
71
    try {
72
        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

72
        PhpCsFixer\FixerFactory::/** @scrutinizer ignore-call */ 
73
                                 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...
73
            ->registerBuiltInFixers()
74
            ->registerCustomFixers($config->getCustomFixers())
75
            ->useRuleSet(new PhpCsFixer\RuleSet($config->getRules()))
76
        ;
77
    } catch (UnexpectedValueException|InvalidArgumentException $e) {
78
        $config->setRules([]);
79
    }
80
}
81
82
return $config;
83