imports:
    - { resource: 'vendor/symplify/easy-coding-standard/config/psr2.yml' }
    - { resource: 'vendor/symplify/easy-coding-standard/config/php71.yml' }
    - { resource: 'vendor/symplify/easy-coding-standard/config/symplify.yml' }
    - { resource: 'vendor/symplify/easy-coding-standard/config/common.yml' }
    - { resource: 'vendor/symplify/easy-coding-standard/config/clean-code.yml' }

services:
    SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff: ~

    Symplify\CodingStandard\Fixer\Php\ClassStringToClassConstantFixer:
        allow_classes:
            - 'SomeClass' # from PHPUnit

    Symplify\CodingStandard\Sniffs\CleanCode\CognitiveComplexitySniff:
        maxCognitiveComplexity: 8

    Symplify\CodingStandard\Fixer\Order\MethodOrderByTypeFixer:
        method_order_by_type:
            Rector\Contract\Rector\PhpRectorInterface:
                - 'getDefinition'
                - 'getNodeTypes'
                - 'refactor'

    Symplify\CodingStandard\Sniffs\DependencyInjection\NoClassInstantiationSniff:
        extraAllowedClasses:
            - 'PHPStan\Type\*'
            - 'PhpParser\Node\*'
            - 'PhpParser\Comment'
            - 'Symplify\PackageBuilder\*'
            - 'PhpParser\Comment\Doc'
            - 'PhpParser\NodeTraverser'
            - 'Rector\DeprecationExtractor\Deprecation\*'
            - 'Rector\Reporting\FileDiff'
            - 'Rector\RectorDefinition\*'
            - 'PHPStan\Analyser\Scope'
            - 'PhpParser\NodeVisitor\NameResolver'
            - 'Rector\Application\Error'
            - 'Rector\DependencyInjection\Loader\*'
            - 'Symfony\Component\Console\Input\StringInput'

    Symplify\CodingStandard\Fixer\Naming\PropertyNameMatchingTypeFixer:
        extra_skipped_classes:
            - 'PhpParser\PrettyPrinter\Standard'
            - 'PhpParser\Node'

    Symplify\CodingStandard\Sniffs\Naming\ClassNameSuffixByParentSniff:
        extraParentTypesToSuffixes:
            - 'Rector'
            - 'NodeVisitorAbstract'

parameters:
    exclude_checkers:
        # run manually from time to time, not to bother user with it
        - 'Symplify\CodingStandard\Fixer\Order\PropertyOrderByComplexityFixer'
        - 'Symplify\CodingStandard\Fixer\Order\PrivateMethodOrderByUseFixer'

    exclude_files:
        - '*tests/*Source/*.php'
        # tests files
        - '*tests/*/Fixture/*'
        - '*tests/*/Expected/*'
        - '*packages/ContributorTools/templates/*'

    skip:
        Symplify\CodingStandard\Fixer\Php\ClassStringToClassConstantFixer:
            # classes might not exist
            - 'bin/bootstrap.php'
            - '*/packages/*/src/Rector/*Rector.php'
            - 'src/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector.php'
            - 'src/Rector/Constant/RenameClassConstantsUseToStringsRector.php'
            - '*/packages/NodeTypeResolver/**/PerNodeTypeResolver/**TypeResolver.php'
            - '*/packages/NodeTypeResolver/**/PerNodeTypeResolver/**TypeResolver/*Test.php'
            - '*RectorTest.php'
            - 'tests/PhpParser/Node/ConstExprEvaluatorFactoryTest.php'
            - 'src/Rector/AbstractPHPUnitRector.php'
            - 'src/Rector/Class_/ParentClassToTraitsRector.php'
            # required for exact string match with "\"
            - 'packages/NodeTypeResolver/src/Php/AbstractTypeInfo.php'
            # example in description
            - 'src/Rector/Annotation/AnnotationReplacerRector.php'

        Symplify\CodingStandard\Sniffs\CleanCode\ForbiddenStaticFunctionSniff:
            # required by Composer interface
            - 'tests/Composer/AutoloadWrongCasesEventSubscriber.php'
            - 'src/Php/TypeAnalyzer.php'
            # exclusive static config for type support
            - 'src/Php/PhpTypeSupport.php'
            - 'src/Util/RectorStrings.php'

        Symplify\CodingStandard\Fixer\Naming\PropertyNameMatchingTypeFixer:
            - 'packages/NodeTypeResolver/src/PHPStan/Scope/NodeScopeResolver.php'

        Symplify\CodingStandard\Sniffs\Naming\ClassNameSuffixByParentSniff:
            # hidden API
            - 'src/Rector/AbstractRector.php'

        Symplify\CodingStandard\Sniffs\CleanCode\CognitiveComplexitySniff:
            # tough logic
            - 'src/Rector/MethodBody/NormalToFluentRector.php'
            # copied 3rd party logic
            - 'packages/Php/src/EregToPcreTransformer.php'
            # dev
            - 'packages/Php/src/Rector/FunctionLike/*ScalarTypehintRector.php'
            - 'examples/*'

        SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff.UnusedParameter:
            # enforced by interface
            - '*Command.php'
            - '*NodeVisitor.php'
            - '*CompilerPass.php'
            - 'packages/Php/src/Rector/Unset_/UnsetCastRector.php'
            - 'packages/Php/src/Rector/ConstFetch/BarewordStringRector.php'
            - 'packages/CodeQuality/src/Rector/Foreach_/ForeachToInArrayRector.php'
            # array type check
            - 'src/RectorDefinition/RectorDefinition.php'

        Symplify\CodingStandard\Sniffs\ControlStructure\SprintfOverContactSniff:
            # respects inherited pattern for better comparing
            - 'src/PhpParser/Printer/BetterStandardPrinter.php'

        PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff.FoundInWhileCondition: ~

        SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff.MissingParameterTypeHint:
            # 3rd party parent code
            - 'src/DependencyInjection/Loader/TolerantRectorYamlFileLoader.php'
            - 'src/PhpParser/Printer/BetterStandardPrinter.php'

        Symplify\CodingStandard\Sniffs\Debug\CommentedOutCodeSniff.Found:
            # notes
            - 'packages/Php/src/Rector/Each/ListEachRector.php'
