diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a86a4a2d..4abdaa0a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,5 +1,10 @@ parameters: ignoreErrors: + - + message: "#^Call to function method_exists\\(\\) with Symfony\\\\Component\\\\Console\\\\Input\\\\InputOption and 'isNegatable' will always evaluate to true\\.$#" + count: 1 + path: src/Type/Symfony/GetOptionTypeHelper.php + - message: "#^Accessing PHPStan\\\\Rules\\\\Methods\\\\CallMethodsRule\\:\\:class is not covered by backward compatibility promise\\. The class might change in a minor PHPStan version\\.$#" count: 1 diff --git a/src/Type/Symfony/GetOptionTypeHelper.php b/src/Type/Symfony/GetOptionTypeHelper.php index 9406698e..6ddf87d8 100644 --- a/src/Type/Symfony/GetOptionTypeHelper.php +++ b/src/Type/Symfony/GetOptionTypeHelper.php @@ -12,6 +12,7 @@ use PHPStan\Type\TypeCombinator; use PHPStan\Type\UnionType; use Symfony\Component\Console\Input\InputOption; +use function method_exists; class GetOptionTypeHelper { @@ -19,7 +20,7 @@ class GetOptionTypeHelper public function getOptionType(Scope $scope, InputOption $option): Type { if (!$option->acceptValue()) { - if ($option->isNegatable()) { + if (method_exists($option, 'isNegatable') && $option->isNegatable()) { return new UnionType([new BooleanType(), new NullType()]); }