includes:
    - dev-tools/vendor/phpstan/phpstan/conf/bleedingEdge.neon

    # Baseline, should only shrink! To regenerate it, just execute `composer phpstan:baseline`.
    - dev-tools/phpstan/baseline.php

parameters:
    level: 7
    paths:
        - src
        - tests
    excludePaths:
        - tests/Fixtures
    polluteScopeWithLoopInitialAssignments: true # Do not enforce assignments outside of the loops
    reportUnmatchedIgnoredErrors: true # Do not allow outdated errors in the baseline
    reportPossiblyNonexistentGeneralArrayOffset: true # enabled, but huge exceptions count; example fix: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/8089
    reportPossiblyNonexistentConstantArrayOffset: true
    treatPhpDocTypesAsCertain: false
    ignoreErrors:
        - '/^Class [a-zA-Z\\]+ extends @final class PhpCsFixer\\(ConfigurationException\\InvalidConfigurationException|ConfigurationException\\InvalidFixerConfigurationException|Tokenizer\\Tokens|Console\\Command\\FixCommand)\.$/'
        - '/^\$this\(PhpCsFixer\\Tokenizer\\Tokens\) does not accept PhpCsFixer\\Tokenizer\\Token\|null\.$/'

        # We often need to iterate multiple times within single method and we re-use variable name
        -
            message: '/^For loop initial assignment overwrites variable \$(i|index|endIndex)+\.$/'
            paths:
                - src/Fixer/Comment/CommentToPhpdocFixer.php
                - src/Fixer/ControlStructure/YodaStyleFixer.php
                - src/Fixer/Import/GlobalNamespaceImportFixer.php
                - src/Fixer/Import/OrderedImportsFixer.php
                - src/Fixer/LanguageConstruct/SingleSpaceAroundConstructFixer.php
                - src/Fixer/Operator/NoUselessConcatOperatorFixer.php
                - src/Fixer/PhpUnit/PhpUnitDedicateAssertInternalTypeFixer.php
                - src/Fixer/ReturnNotation/ReturnAssignmentFixer.php
                - src/Fixer/Whitespace/StatementIndentationFixer.php
                - tests/DocBlock/TypeExpressionTest.php
        -
            message: '/^Foreach overwrites \$index with its key variable.$/'
            paths:
                - src/Fixer/DoctrineAnnotation/DoctrineAnnotationIndentationFixer.php
                - src/Fixer/Import/GlobalNamespaceImportFixer.php
                - src/Fixer/LanguageConstruct/GetClassToClassKeywordFixer.php

        # Types related to tokens collections are purposefully narrowed, because we expect only tokens there
        - '/^Parameter #1 \$array \(array<int, PhpCsFixer\\(Tokenizer|Doctrine\\Annotation)+\\Token>\) of method PhpCsFixer\\(Tokenizer|Doctrine\\Annotation)+\\Tokens::fromArray\(\) should be contravariant with parameter \$array \(array<int, mixed>\) of method SplFixedArray<PhpCsFixer\\(Tokenizer|Doctrine\\Annotation)+\\Token>::fromArray\(\)$/'
        - '/^Parameter .* of method PhpCsFixer\\Tokenizer\\Tokens::offsetSet\(\) should be contravariant with parameter .* of method .*::offsetSet\(\)$/'
        - '/^Parameter .* of method PhpCsFixer\\Tests\\Test\\TokensWithObservedTransformers::offsetSet\(\) should be contravariant with parameter .* of method .*::offsetSet\(\)$/'

        # This one is tricky, because adding @param to PHPDoc causes failures on PHP7.4 with lowest deps (phpdoc_to_param_type), using @phpstan-param causes failures on all PHP versions (phpdoc_add_missing_param_annotation)
        - '/^Parameter #1 \$class \(string\) of method PhpCsFixer\\StdinFileInfo::get(File|Path)+Info+\(\) should be contravariant with parameter \$class \(string\|null\) of method SplFileInfo::get(File|Path)+Info\(\)$/'

        # PHPUnit data providers return type were not maintained originally, this exception should shrink over time (eg with help of custom, re-usable type)
        -
            message: '#^Method PhpCsFixer\\Tests\\.+::provide.+Cases\(\) return type has no value type specified in iterable type iterable\.$#'
            path: tests
            count: 1013
        -
            identifier: offsetAccess.notFound
            path: .
            count: 560
    tipsOfTheDay: false
    tmpDir: dev-tools/phpstan/cache