<?xml version="1.0"?>
<psalm
    errorLevel="2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
    xsi:schemaLocation="https://getpsalm.org/schema/config file:///composer/vendor/vimeo/psalm/config.xsd"
>
    <projectFiles>
        <directory name="src" />
        <ignoreFiles>
            <directory name="vendor" />
        </ignoreFiles>
    </projectFiles>

    <issueHandlers>
        <RedundantConditionGivenDocblockType>
            <errorLevel type="info">
                <!-- Psalm is very strict and believe that because we documented a type, it is redundant to assert it -->
                <file name="src/DocBlock/StandardTagFactory.php"/>
            </errorLevel>
        </RedundantConditionGivenDocblockType>

        <PossiblyNullArrayOffset>
            <errorLevel type="info">
                <!-- Psalm forbid accessing an array with a null offset but it's still working code without notice -->
                <file name="src/DocBlock/StandardTagFactory.php"/>
            </errorLevel>
        </PossiblyNullArrayOffset>

        <DeprecatedInterface>
            <errorLevel type="info">
                <!-- Will be removed in 6.0.0 issues/211 -->
                <referencedClass name="phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod"/>
            </errorLevel>
        </DeprecatedInterface>

        <DeprecatedMethod>
            <errorLevel type="info">
                <!-- Will be removed in 6.0.0 issues/361 -->
                <referencedMethod name="phpDocumentor\Reflection\DocBlock\Tags\Param::create"/>
            </errorLevel>
        </DeprecatedMethod>

        <NoInterfaceProperties>
            <errorLevel type="info">
                <file name="src/DocBlock/Tags/Factory/ParamFactory.php"/>
                <file name="src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php"/>
            </errorLevel>
        </NoInterfaceProperties>

        <TooManyArguments>
            <errorLevel type="info">
                <file name="src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php"/>
            </errorLevel>
        </TooManyArguments>

        <RedundantConditionGivenDocblockType>
            <errorLevel type="info">
                <!-- Psalm manage to infer a more precise type than PHPStan. notNull assert is needed for PHPStan but
                Psalm sees it as redundant -->
                <directory name="src/DocBlock/Tags/"/>
            </errorLevel>
        </RedundantConditionGivenDocblockType>

        <ArgumentTypeCoercion>
            <errorLevel type="info">
                <!-- PHP handles invalid preg_split flags just fine. -->
                <file name="src/Utils.php"/>
            </errorLevel>
        </ArgumentTypeCoercion>

        <InvalidArgument>
            <errorLevel type="suppress">
                <referencedFunction name="PHPStan\PhpDocParser\Parser\PhpDocParser::__construct"/>
                <referencedFunction name="PHPStan\PhpDocParser\Parser\TypeParser::__construct"/>
            </errorLevel>
        </InvalidArgument>
    </issueHandlers>
</psalm>
