Skip to content

Commit

Permalink
Ignore PHPStan wrong array-shape subtraction warnings (#1233)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored Sep 10, 2024
1 parent ed9f0e6 commit e724dc6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
27 changes: 27 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,33 @@ parameters:
message: '~^Class Doctrine\\DBAL\\(Platforms\\SqlitePlatform|Schema\\SqliteSchemaManager) referenced with incorrect case: Doctrine\\DBAL\\(Platforms\\SQLitePlatform|Schema\\SQLiteSchemaManager)\.$~'
count: 24

# remove once https://github.com/phpstan/phpstan/issues/11488 is fixed
-
path: 'src/Persistence/Sql/Oracle/Query.php'
identifier: nullCoalesce.variable
message: '~^Variable \$operator on left side of \?\? is never defined\.$~'
count: 1
-
path: 'src/Persistence/Sql/Oracle/Query.php'
identifier: instanceof.alwaysFalse
message: '~^Instanceof between \*NEVER\* and Atk4\\Data\\Field will always evaluate to false\.$~'
count: 2
-
path: 'src/Persistence/Sql/Oracle/Query.php'
identifier: booleanAnd.alwaysFalse
message: '~^Result of && is always false\.$~'
count: 3
-
path: 'src/Persistence/Sql/Query.php'
identifier: identical.alwaysFalse
message: '~^Strict comparison using === between \*NEVER\* and 3 will always evaluate to false\.$~'
count: 1
-
path: 'src/Persistence/Sql/Query.php'
identifier: variable.undefined
message: '~^(Undefined variable: \$(operator|value)|Variable \$value might not be defined\.)$~'
count: 3

# TODO these rules are generated, this ignores should be fixed in the code
# for src/Schema/TestCase.php
-
Expand Down
2 changes: 1 addition & 1 deletion src/Persistence/Sql/Oracle/ExpressionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function escapeStringLiteral(string $value): string
/**
* Like mb_str_split() function, but split by length in bytes.
*
* @return array<string>
* @return list<string>
*/
private function splitLongString(string $value, int $lengthBytes): array
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Schema/TestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function testLogQuery(): void
/**
* @param int<1, 12> $month
*
* @return array<mixed>
* @return array<mixed, mixed>
*/
private function createAssertSameExportUnorderedTestRow(int $month): array
{
Expand Down

0 comments on commit e724dc6

Please sign in to comment.