Skip to content

Commit 829e62b

Browse files
committed
fix: add phpstan ignores conditionally
1 parent b8c75f9 commit 829e62b

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$ignoreErrors = [];
6+
7+
if (version_compare(PHP_VERSION, '8.4', '<')) {
8+
$ignoreErrors = [
9+
'#Call to an undefined static method PDO::connect\(\)#',
10+
'#PHPDoc tag @var for variable \$db contains unknown class PDO\\Sqlite#',
11+
'#Call to method createFunction\(\) on an unknown class PDO\\Sqlite#',
12+
'#Call to method exec\(\) on an unknown class PDO\\Sqlite#',
13+
'#Call to method query\(\) on an unknown class PDO\\Sqlite#',
14+
'#Call to an undefined method Pdo\\Sqlite::createFunction\(\)#'
15+
];
16+
}
17+
18+
return [
19+
'parameters' => [
20+
'ignoreErrors' => $ignoreErrors
21+
]
22+
];
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
includes:
22
- vendor/phpstan/phpstan-phpunit/extension.neon
3+
- ignore-by-php-version.neon.php
34

45
parameters:
56
tmpDir: var/cache/phpstan
67
level: 5
78
paths:
89
- src
910
- tests
10-
ignoreErrors:
11-
# PHP 8.4 PDO subclass issues
12-
- '#Call to an undefined static method PDO::connect\(\)#'
13-
- '#PHPDoc tag @var for variable \$db contains unknown class PDO\\Sqlite#'
14-
- '#Call to method createFunction\(\) on an unknown class PDO\\Sqlite#'
15-
- '#Call to method exec\(\) on an unknown class PDO\\Sqlite#'
16-
- '#Call to method query\(\) on an unknown class PDO\\Sqlite#'

0 commit comments

Comments
 (0)