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:
    Symplify\CodingStandard\Fixer\Php\ClassStringToClassConstantFixer:
        allow_classes:
            - 'SomeClass' # from PHPUnit
            - 'PHPUnit\Framework\TestCase' # usually part of node construction, it can be missed

    Symplify\CodingStandard\Sniffs\CleanCode\CognitiveComplexitySniff:
        max_cognitive_complexity: 9

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

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

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

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

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

    skip:
        Symplify\CodingStandard\Sniffs\Architecture\DuplicatedClassShortNameSniff: ~
        # skip temporary due to missing "import" feature in PhpStorm
        SlevomatCodingStandard\Sniffs\Namespaces\ReferenceUsedNamesOnlySniff.PartialUse: ~

        # run manually from time to time - performance demanding + not to bother user with it
        Symplify\CodingStandard\Fixer\Order\PropertyOrderByComplexityFixer: ~
        Symplify\CodingStandard\Fixer\Order\PrivateMethodOrderByUseFixer: ~

        PhpCsFixer\Fixer\Phpdoc\PhpdocTypesFixer:
            - 'packages/Php/src/Rector/Double/RealToFloatTypeCastRector.php'

        Symplify\CodingStandard\Sniffs\CleanCode\ForbiddenReferenceSniff:
            # 3rd party contract
            - 'src/PhpParser/Printer/BetterStandardPrinter.php'

        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'
            - '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/RenameAnnotationRector.php'
            - 'packages/NetteToSymfony/src/Event/EventInfosFactory.php'
            - 'packages/NetteTesterToPHPUnit/src/AssertManipulator.php'

        Symplify\CodingStandard\Sniffs\CleanCode\ForbiddenStaticFunctionSniff:
            - 'src/Util/*.php'
            - 'packages/BetterPhpDocParser/src/Annotation/AnnotationNaming.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/Psr4/MultipleClassFileToPsr4ClassesRector.php'
            - 'src/PhpParser/Node/Resolver/NameResolver.php'
            - 'src/Rector/MethodBody/NormalToFluentRector.php'
            - 'packages/CodingStyle/src/Rector/Use_/RemoveUnusedAliasRector.php'
            - 'packages/NetteToSymfony/src/Route/RouteInfoFactory.php'
            - 'packages/ContributorTools/src/Command/DumpNodesCommand.php'
            - 'packages/CodeQuality/src/Rector/Identical/SimplifyBoolIdenticalTrueRector.php'
            - 'packages/BetterPhpDocParser/src/Attributes/Ast/AttributeAwareNodeFactory.php'
            - 'packages/Laravel/src/Rector/FuncCall/HelperFunctionToConstructorInjectionRector.php'
            - 'packages/PhpSpecToPHPUnit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php'
            - 'packages/NetteTesterToPHPUnit/src/AssertManipulator.php'
            # aliases
            - 'packages/CodingStyle/src/Rector/Namespace_/ImportFullyQualifiedNamesRector.php'

            # copied 3rd party logic
            - 'packages/Php/src/EregToPcreTransformer.php'
            # dev
            - 'packages/TypeDeclaration/src/Rector/FunctionLike/*TypeDeclarationRector.php'
            - 'packages/Php/src/Rector/If_/IfToSpaceshipRector.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'
            - 'tests/AbstractContainerAwareTestCase.php'

        SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff.MissingTraversableReturnTypeHintSpecification:
            # false positive
            - 'src/Testing/PHPUnit/AbstractRectorTestCase.php'

        Symplify\CodingStandard\Sniffs\Debug\CommentedOutCodeSniff.Found:
            # notes
            - 'packages/Php/src/Rector/Each/ListEachRector.php'
            - 'packages/DeadCode/src/Rector/ClassMethod/RemoveOverriddenValuesRector.php'
            - 'packages/PhpSpecToPHPUnit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php'

        Symplify\CodingStandard\Sniffs\DependencyInjection\NoClassInstantiationSniff:
            # 3rd party api
            - 'src/PhpParser/Node/Value/ValueResolver.php'
