Skip to content

Commit 1d61d45

Browse files
authored
Ignore PHPStan's ClassReflection::isEnum error when analyzing the extension code on PHP 7.4 (#324)
The error is unintentional and maybe it will be resolved soon, but until then let's ignore it. It needs to be ignored only when running on PHP 7.4 and with PHPStan 2.x. The ignore would be reported as unmatched when running with `--prefer-lowest` (PHPStan 1.x), so that's why `reportUnmatched` is set to `false`. See phpstan/phpstan#12888
2 parents 1c5e699 + 853ca73 commit 1d61d45

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

phpstan-ignore-errors.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
declare(strict_types = 1);
3+
4+
$config = [
5+
'parameters' => [
6+
'ignoreErrors' => [],
7+
]
8+
];
9+
10+
if (PHP_VERSION_ID < 80000) {
11+
// https://github.com/phpstan/phpstan/discussions/12888
12+
$config['parameters']['ignoreErrors'][] = [
13+
'message' => '#^Call to method PHPStan\\\\Reflection\\\\ClassReflection::isEnum\\(\\) will always evaluate to false\\.$#',
14+
'reportUnmatched' => false,
15+
];
16+
}
17+
18+
return $config;

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ parameters:
1717
- src/PHPStan1Compatibility.php
1818

1919
includes:
20+
- phpstan-ignore-errors.php
2021
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
2122
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
2223
- extension.neon

0 commit comments

Comments
 (0)