<?xml version="1.0"?>
<psalm
    totallyTyped="false"
    errorLevel="3"
    resolveFromConfigFile="true"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
    xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
    <projectFiles>
        <directory name="src" />
        <directory name="tests" />
        <ignoreFiles>
            <directory name="vendor" />
        </ignoreFiles>
    </projectFiles>
    <stubs>
        <file name="vendor/jetbrains/phpstorm-stubs/PDO/PDO.php" />
        <file name="vendor/jetbrains/phpstorm-stubs/ibm_db2/ibm_db2.php" />
        <file name="vendor/jetbrains/phpstorm-stubs/mysqli/mysqli.php" />
        <file name="vendor/jetbrains/phpstorm-stubs/oci8/oci8.php" />
        <file name="vendor/jetbrains/phpstorm-stubs/pgsql/pgsql.php" />
        <file name="vendor/jetbrains/phpstorm-stubs/sqlsrv/sqlsrv.php" />
    </stubs>
    <issueHandlers>
        <ArgumentTypeCoercion>
            <errorLevel type="suppress">
                <!--
                    See https://github.com/composer/package-versions-deprecated/pull/12
                -->
                <file name="src/Tools/Console/ConsoleRunner.php"/>
            </errorLevel>
        </ArgumentTypeCoercion>
        <ConflictingReferenceConstraint>
            <errorLevel type="suppress">
                <!--
                    This one is just too convoluted for Psalm to figure out, by
                    its author's own admission
                -->
                <file name="src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php"/>
            </errorLevel>
        </ConflictingReferenceConstraint>
        <FalsableReturnStatement>
            <errorLevel type="suppress">
                <!--
                    Fixing these issues requires an API change
                -->
                <file name="src/Driver/PDO/SQLSrv/Connection.php"/>
                <file name="src/Driver/SQLSrv/Connection.php"/>
            </errorLevel>
        </FalsableReturnStatement>
        <ForbiddenCode>
            <errorLevel type="suppress">
                <!-- The call to var_dump() here is by design -->
                <file name="src/Tools/Dumper.php"/>
            </errorLevel>
        </ForbiddenCode>
        <ImplementedReturnTypeMismatch>
            <errorLevel type="suppress">
                <!-- Fixing this issue requires an API change -->
                <file name="src/Driver/OCI8/Connection.php"/>
            </errorLevel>
        </ImplementedReturnTypeMismatch>
        <InvalidPropertyAssignmentValue>
            <errorLevel type="suppress">
                <!-- Fixing this issue requires an API change -->
                <file name="src/Driver/PDO/Exception.php"/>
            </errorLevel>
        </InvalidPropertyAssignmentValue>
        <NullableReturnStatement>
            <errorLevel type="suppress">
                <!--
                    Fixing this issue requires an API change
                -->
                <file name="src/Driver/AbstractSQLiteDriver.php"/>
            </errorLevel>
        </NullableReturnStatement>
        <PossiblyNullArgument>
            <errorLevel type="suppress">
                <!-- See https://github.com/doctrine/dbal/pull/3488 -->
                <file name="src/Schema/AbstractSchemaManager.php"/>
            </errorLevel>
        </PossiblyNullArgument>
        <RedundantCondition>
            <errorLevel type="suppress">
                <!--
                    Requires a release of
                    https://github.com/sebastianbergmann/phpunit/commit/9c60d7d9fd3bfa80fa4aeab7090e1bbe0830dbcd
                -->
                <file name="tests/Driver/API/ExceptionConverterTest.php"/>
            </errorLevel>
        </RedundantCondition>
        <TooFewArguments>
            <errorLevel type="suppress">
                <!--
                    Requires a release of
                    https://github.com/JetBrains/phpstorm-stubs/pull/727
                -->
                <file name="src/Driver/SQLSrv/Statement.php"/>
            </errorLevel>
        </TooFewArguments>
        <TooManyArguments>
            <errorLevel type="suppress">
                <!-- See https://github.com/doctrine/dbal/pull/3562 -->
                <file name="src/Schema/AbstractSchemaManager.php"/>
                <file name="src/Schema/SqliteSchemaManager.php"/>
            </errorLevel>
        </TooManyArguments>
        <TypeDoesNotContainType>
            <errorLevel type="suppress">
                <!-- See https://github.com/vimeo/psalm/issues/4274 -->
                <file name="src/Schema/Index.php"/>
            </errorLevel>
        </TypeDoesNotContainType>
        <UndefinedConstant>
            <errorLevel type="suppress">
                <!--
                    Requires a release of
                    https://github.com/JetBrains/phpstorm-stubs/pull/732
                -->
                <file name="tests/Driver/PDO/PgSQL/DriverTest.php" />
            </errorLevel>
        </UndefinedConstant>
        <UndefinedClass>
            <errorLevel type="suppress">
                <!-- Contains references to optional dependencies -->
                <file name="src/Tools/Dumper.php"/>
            </errorLevel>
        </UndefinedClass>
        <InvalidReturnType>
            <errorLevel type="suppress">
                <!-- lastInsertId has a return type that does not match the one defined in the interface-->
                <file name="src/Driver/Mysqli/Connection.php"/>
            </errorLevel>
        </InvalidReturnType>
        <InvalidScalarArgument>
            <errorLevel type="suppress">
                <!-- See https://github.com/vimeo/psalm/issues/4295 -->
                <file name="src/Exception/DriverException.php"/>

                <!-- See https://github.com/doctrine/dbal/pull/3498 -->
                <file name="tests/Functional/DataAccessTest.php"/>
                <file name="tests/Platforms/AbstractPlatformTestCase.php"/>
                <file name="tests/Platforms/DB2PlatformTest.php"/>
                <file name="tests/Platforms/OraclePlatformTest.php"/>
                <file name="tests/Platforms/SqlitePlatformTest.php"/>

                <!-- See https://github.com/doctrine/dbal/pull/3574 -->
                <file name="tests/Query/Expression/ExpressionBuilderTest.php"/>
            </errorLevel>
        </InvalidScalarArgument>
        <InvalidReturnStatement>
            <errorLevel type="suppress">
                <!-- lastInsertId has a return type that does not match the one defined in the interface-->
                <file name="src/Driver/Mysqli/Connection.php"/>
            </errorLevel>
        </InvalidReturnStatement>
    </issueHandlers>
</psalm>
