Skip to content

Commit 6a98863

Browse files
authored
[TASK] Silence warnings from PHPStan (#1647)
These would be emitted when we update PHPStan to 2.2.8 or later, breaking the build. We use semantic versioning, but it seems disappointingly that PHPStan does not.
1 parent 45b5629 commit 6a98863

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Build/phpstan/phpstan.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ parameters:
2828
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) .* will always evaluate to#'
2929
path: '%currentWorkingDirectory%/tests/'
3030

31+
# This is a temporary but sadly necessary setting to allow upgrade to PHPStan 2.2.8.
32+
# It maintains compatibility with PHPStan 2.2.7.
33+
# When it has been bedded in, it can (and should) be removed.
34+
reportUnmatchedIgnoredErrors: false
35+
3136
services:
3237
-
3338
class: \Pelago\Emogrifier\PhpStan\IgnoreBooleanAlways

src/PhpStan/IgnoreBooleanAlways.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ private static function shouldIgnoreFunctionAlreadyNarrowedType(Node $node): boo
4040
{
4141
$shouldIgnore = false;
4242

43+
// This is an unstable API that does not adhere to semver.
44+
// @phpstan-ignore phpstanApi.classConstant, phpstanApi.class
4345
if (\class_exists(FunctionCallExpressionNode::class) && $node instanceof FunctionCallExpressionNode) {
4446
// Unwrap for PHPStan >= 2.2.8
47+
// @phpstan-ignore phpstanApi.method
4548
$node = $node->getOriginalNode();
4649
}
4750
if ($node instanceof FuncCall) {

0 commit comments

Comments
 (0)