Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a0572ad

Browse files
Fixes after PHPStan update
1 parent 7e5633f commit a0572ad

14 files changed

+14
-28
lines changed

‎src/Rules/Symfony/InvalidArgumentDefaultValueRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use PHPStan\Type\NullType;
1414
use PHPStan\Type\ObjectType;
1515
use PHPStan\Type\StringType;
16-
use PHPStan\Type\TypeUtils;
1716
use PHPStan\Type\UnionType;
1817
use PHPStan\Type\VerbosityLevel;
1918
use function count;
@@ -46,7 +45,7 @@ public function processNode(Node $node, Scope $scope): array
4645
if ($modeType->isNull()->yes()) {
4746
$modeType = new ConstantIntegerType(2); // InputArgument::OPTIONAL
4847
}
49-
$modeTypes = TypeUtils::getConstantScalars($modeType);
48+
$modeTypes = $modeType->getConstantScalarTypes();
5049
if (count($modeTypes) !== 1) {
5150
return [];
5251
}

‎src/Rules/Symfony/InvalidOptionDefaultValueRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use PHPStan\Type\NullType;
1616
use PHPStan\Type\ObjectType;
1717
use PHPStan\Type\StringType;
18-
use PHPStan\Type\TypeUtils;
1918
use PHPStan\Type\UnionType;
2019
use PHPStan\Type\VerbosityLevel;
2120
use function count;
@@ -48,7 +47,7 @@ public function processNode(Node $node, Scope $scope): array
4847
if ($modeType->isNull()->yes()) {
4948
$modeType = new ConstantIntegerType(1); // InputOption::VALUE_NONE
5049
}
51-
$modeTypes = TypeUtils::getConstantScalars($modeType);
50+
$modeTypes = $modeType->getConstantScalarTypes();
5251
if (count($modeTypes) !== 1) {
5352
return [];
5453
}

‎src/Rules/Symfony/UndefinedArgumentRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use PHPStan\Symfony\ConsoleApplicationResolver;
1313
use PHPStan\Type\ObjectType;
1414
use PHPStan\Type\Symfony\Helper;
15-
use PHPStan\Type\TypeUtils;
1615
use function count;
1716
use function sprintf;
1817

@@ -58,7 +57,7 @@ public function processNode(Node $node, Scope $scope): array
5857
}
5958

6059
$argType = $scope->getType($node->getArgs()[0]->value);
61-
$argStrings = TypeUtils::getConstantStrings($argType);
60+
$argStrings = $argType->getConstantStrings();
6261
if (count($argStrings) !== 1) {
6362
return [];
6463
}

‎src/Rules/Symfony/UndefinedOptionRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use PHPStan\Symfony\ConsoleApplicationResolver;
1313
use PHPStan\Type\ObjectType;
1414
use PHPStan\Type\Symfony\Helper;
15-
use PHPStan\Type\TypeUtils;
1615
use function count;
1716
use function sprintf;
1817

@@ -58,7 +57,7 @@ public function processNode(Node $node, Scope $scope): array
5857
}
5958

6059
$optType = $scope->getType($node->getArgs()[0]->value);
61-
$optStrings = TypeUtils::getConstantStrings($optType);
60+
$optStrings = $optType->getConstantStrings();
6261
if (count($optStrings) !== 1) {
6362
return [];
6463
}

‎src/Symfony/DefaultParameterMap.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use PhpParser\Node\Expr;
66
use PHPStan\Analyser\Scope;
77
use PHPStan\Type\Type;
8-
use PHPStan\Type\TypeUtils;
98
use function array_map;
109

1110
final class DefaultParameterMap implements ParameterMap
@@ -37,7 +36,7 @@ public function getParameter(string $key): ?ParameterDefinition
3736

3837
public static function getParameterKeysFromNode(Expr $node, Scope $scope): array
3938
{
40-
$strings = TypeUtils::getConstantStrings($scope->getType($node));
39+
$strings = $scope->getType($node)->getConstantStrings();
4140

4241
return array_map(static fn (Type $type) => $type->getValue(), $strings);
4342
}

‎src/Symfony/DefaultServiceMap.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use PhpParser\Node\Expr;
66
use PHPStan\Analyser\Scope;
7-
use PHPStan\Type\TypeUtils;
87
use function count;
98

109
final class DefaultServiceMap implements ServiceMap
@@ -36,7 +35,7 @@ public function getService(string $id): ?ServiceDefinition
3635

3736
public static function getServiceIdFromNode(Expr $node, Scope $scope): ?string
3837
{
39-
$strings = TypeUtils::getConstantStrings($scope->getType($node));
38+
$strings = $scope->getType($node)->getConstantStrings();
4039
return count($strings) === 1 ? $strings[0]->getValue() : null;
4140
}
4241

‎src/Type/Symfony/CommandGetHelperDynamicReturnTypeExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use PHPStan\Type\ObjectType;
1111
use PHPStan\Type\Type;
1212
use PHPStan\Type\TypeCombinator;
13-
use PHPStan\Type\TypeUtils;
1413
use Throwable;
1514
use function count;
1615
use function get_class;
@@ -46,7 +45,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
4645
return null;
4746
}
4847

49-
$argStrings = TypeUtils::getConstantStrings($scope->getType($methodCall->getArgs()[0]->value));
48+
$argStrings = $scope->getType($methodCall->getArgs()[0]->value)->getConstantStrings();
5049
if (count($argStrings) !== 1) {
5150
return null;
5251
}

‎src/Type/Symfony/Config/ArrayNodeDefinitionPrototypeDynamicReturnTypeExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use PHPStan\Type\DynamicMethodReturnTypeExtension;
1010
use PHPStan\Type\Symfony\Config\ValueObject\ParentObjectType;
1111
use PHPStan\Type\Type;
12-
use PHPStan\Type\TypeUtils;
1312
use PHPStan\Type\VerbosityLevel;
1413
use function count;
1514
use function in_array;
@@ -66,7 +65,7 @@ public function getTypeFromMethodCall(
6665
return $defaultType;
6766
}
6867

69-
$argStrings = TypeUtils::getConstantStrings($scope->getType($methodCall->getArgs()[0]->value));
68+
$argStrings = $scope->getType($methodCall->getArgs()[0]->value)->getConstantStrings();
7069
if (count($argStrings) === 1 && isset(self::MAPPING[$argStrings[0]->getValue()])) {
7170
$type = $argStrings[0]->getValue();
7271

‎src/Type/Symfony/Config/TreeBuilderDynamicReturnTypeExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use PHPStan\Type\DynamicStaticMethodReturnTypeExtension;
1111
use PHPStan\Type\Symfony\Config\ValueObject\TreeBuilderType;
1212
use PHPStan\Type\Type;
13-
use PHPStan\Type\TypeUtils;
1413
use function count;
1514

1615
final class TreeBuilderDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension
@@ -47,7 +46,7 @@ public function getTypeFromStaticMethodCall(MethodReflection $methodReflection,
4746
$type = 'array';
4847

4948
if (isset($methodCall->getArgs()[1])) {
50-
$argStrings = TypeUtils::getConstantStrings($scope->getType($methodCall->getArgs()[1]->value));
49+
$argStrings = $scope->getType($methodCall->getArgs()[1]->value)->getConstantStrings();
5150
if (count($argStrings) === 1 && isset(self::MAPPING[$argStrings[0]->getValue()])) {
5251
$type = $argStrings[0]->getValue();
5352
}

‎src/Type/Symfony/InputInterfaceGetArgumentDynamicReturnTypeExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use PHPStan\Type\StringType;
1515
use PHPStan\Type\Type;
1616
use PHPStan\Type\TypeCombinator;
17-
use PHPStan\Type\TypeUtils;
1817
use function count;
1918
use function in_array;
2019

@@ -49,7 +48,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
4948
return null;
5049
}
5150

52-
$argStrings = TypeUtils::getConstantStrings($scope->getType($methodCall->getArgs()[0]->value));
51+
$argStrings = $scope->getType($methodCall->getArgs()[0]->value)->getConstantStrings();
5352
if (count($argStrings) !== 1) {
5453
return null;
5554
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /