phpstan.neon.dist

Summary

Maintainability
Test Coverage
includes:
    - phar://phpstan.phar/conf/bleedingEdge.neon

parameters:
    level: 6
    checkMissingOverrideMethodAttribute: true
    paths:
        - .
    excludePaths:
        - vendor

    ignoreErrors:
        - '~^Unsafe usage of new static\(\)\.$~'

        # relax strict rules
        - '~^Only booleans are allowed in .+, .+ given( on the (left|right) side)?\.$~'
        - '~^Variable (static )?(property access|method call) on .+\.$~'

        # assign to generic callable property is broken https://github.com/phpstan/phpstan/issues/8964
        -
            path: '*'
            identifier: assign.propertyType
            message: '~^Property Atk4\\Data\\Model\\UserAction::\$(enabled|preview) .*Closure<.+ does not accept .*Closure\(.+\.$~'
            count: 3

        # https://github.com/phpstan/phpstan/issues/5551
        -
            path: 'src/*'
            message: '~^(Static property Atk4\\Data\\Reference::\$analysingClosureMap \(Atk4\\Data\\Reference\\WeakAnalysingMap<list<mixed>, Closure, Atk4\\Data\\Model\|Atk4\\Data\\Persistence>\) does not accept Atk4\\Data\\Reference\\WeakAnalysingMap<array\|object, array\|object, object>\.|Static property Atk4\\Data\\Reference::\$analysingTheirModelMap \(Atk4\\Data\\Reference\\WeakAnalysingMap<array\{Atk4\\Data\\Persistence, array\|Atk4\\Data\\Model\|\(Closure\(Atk4\\Data\\Persistence, array<string, mixed>\): Atk4\\Data\\Model\), array\}, Atk4\\Data\\Model, Atk4\\Data\\Model\|Atk4\\Data\\Persistence>\) does not accept Atk4\\Data\\Reference\\WeakAnalysingMap<array\|object, array\|object, object>\.|Cannot call method assertIsInitialized\(\) on array\|object\.)$~'
            count: 5

        # fix https://github.com/phpstan/phpstan-deprecation-rules/issues/52 and https://github.com/phpstan/phpstan/issues/6444
        -
            path: '*'
            identifier: staticMethod.deprecatedClass
            message: '~^Call to method (getVarcharTypeDeclarationSQL|getClobTypeDeclarationSQL|getCreateIndexSQL|getCreateTableSQL|getCurrentDatabaseExpression|initializeDoctrineTypeMappings)\(\) of deprecated class Doctrine\\DBAL\\Platforms\\(PostgreSQLPlatform|SQLServerPlatform|AbstractPlatform):\nUse.+instead\.$~'
            count: 6
        # https://github.com/phpstan/phpstan-deprecation-rules/issues/75
        -
            path: '*'
            identifier: method.deprecated
            message: '~^Call to deprecated method getVarcharTypeDeclarationSQL\(\) of class AnonymousClass\w+:\nUse \{@link getStringTypeDeclarationSQL\(\)\} instead\.$~'
            count: 1

        # AbstractPlatform::getIdentitySequenceName() method is deprecated in DBAL 3.4+,
        # in DBAL 4.0 OraclePlatform::getIdentitySequenceName() is protected and
        # PostgreSQLPlatform::getIdentitySequenceName() is removed:
        # https://github.com/doctrine/dbal/blob/3.5.1/src/Platforms/PostgreSQLPlatform.php#L611
        # https://github.com/doctrine/dbal/blob/4.0.0-beta1/src/Platforms/PostgreSQLPlatform.php#L297
        -
            path: '*'
            identifier: method.deprecated
            message: '~^Call to deprecated method getIdentitySequenceName\(\) of class Doctrine\\DBAL\\Platforms\\(PostgreSQLPlatform|OraclePlatform)\.$~'
            count: 3

        # FC for DBAL 4.0, remove once DBAL 3.x support is dropped
        -
            path: '*'
            identifier: class.nameCase
            message: '~^Class Doctrine\\DBAL\\(Platforms\\SqlitePlatform|Schema\\SqliteSchemaManager) referenced with incorrect case: Doctrine\\DBAL\\(Platforms\\SQLitePlatform|Schema\\SQLiteSchemaManager)\.$~'
            count: 24

        # TODO these rules are generated, this ignores should be fixed in the code
        # for src/Schema/TestCase.php
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Persistence::dsql\(\)\.$~'
        # for src/Field/SqlExpressionField.php
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Model::expr\(\)\.$~'
        # for src/Model.php
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Persistence::export\(\)\.$~'
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Persistence::prepareIterator\(\)\.$~'
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Persistence::action\(\)\.$~'
        # for src/Model/ReferencesTrait.php (in context of class Atk4\Data\Model)
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Reference::refLink\(\)\.$~'
        # for src/Persistence/Sql.php
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Persistence::expr\(\)\.$~'
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Persistence::exprNow\(\)\.$~'
        # for src/Reference/HasMany.php
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Model::dsql\(\)\.$~'
        # for tests/FieldTest.php
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Reference\\HasOne::addTitle\(\)\.$~'
        # for tests/JoinSqlTest.php
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Reference\\HasOne::addField\(\)\.$~'
        # for tests/ReferenceSqlTest.php
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Reference\\HasOne::addFields\(\)\.$~'
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Reference::addTitle\(\)\.$~'
        # for tests/ScopeTest.php
        -
            identifier: method.notFound
            message: '~^Call to an undefined method Atk4\\Data\\Tests\\SUser::expr\(\)\.$~'