Skip to content

Commit e7767d9

Browse files
eliashaeusslerondrejmirtes
authored andcommitted
Skip check for negatable input options on symfony/console < 5.3
Related: #300
1 parent a14d467 commit e7767d9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

phpstan-baseline.neon

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
parameters:
22
ignoreErrors:
3+
-
4+
message: "#^Call to function method_exists\\(\\) with Symfony\\\\Component\\\\Console\\\\Input\\\\InputOption and 'isNegatable' will always evaluate to true\\.$#"
5+
count: 1
6+
path: src/Type/Symfony/GetOptionTypeHelper.php
7+
38
-
49
message: "#^Accessing PHPStan\\\\Rules\\\\Methods\\\\CallMethodsRule\\:\\:class is not covered by backward compatibility promise\\. The class might change in a minor PHPStan version\\.$#"
510
count: 1

src/Type/Symfony/GetOptionTypeHelper.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
use PHPStan\Type\TypeCombinator;
1313
use PHPStan\Type\UnionType;
1414
use Symfony\Component\Console\Input\InputOption;
15+
use function method_exists;
1516

1617
class GetOptionTypeHelper
1718
{
1819

1920
public function getOptionType(Scope $scope, InputOption $option): Type
2021
{
2122
if (!$option->acceptValue()) {
22-
if ($option->isNegatable()) {
23+
if (method_exists($option, 'isNegatable') && $option->isNegatable()) {
2324
return new UnionType([new BooleanType(), new NullType()]);
2425
}
2526

0 commit comments

Comments
 (0)