Skip to content

Commit 36f9b49

Browse files
Fix static analysis
1 parent 7c56c35 commit 36f9b49

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/Command/CommandHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public static function begin(
331331
&& $generatedConfigReflection->hasConstant('PHPSTAN_VERSION_CONSTRAINT')
332332
) {
333333
$generatedConfigPhpStanVersionConstraint = $generatedConfigReflection->getConstant('PHPSTAN_VERSION_CONSTRAINT');
334-
if ($generatedConfigPhpStanVersionConstraint !== null) {
334+
if (is_string($generatedConfigPhpStanVersionConstraint)) {
335335
$phpstanSemverVersion = ComposerHelper::getPhpStanVersion();
336336
if (
337337
$phpstanSemverVersion !== ComposerHelper::UNKNOWN_VERSION

src/Type/PHPStan/ClassNameUsageLocationCreateIdentifierDynamicReturnTypeExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use PHPStan\Type\TypeCombinator;
1414
use ReflectionClass;
1515
use function count;
16+
use function is_string;
1617
use function sort;
1718

1819
#[AutowiredService]
@@ -46,6 +47,9 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
4647
$identifiers = [];
4748
$locationValueType = $scope->getType(new PropertyFetch($methodCall->var, 'value'));
4849
foreach ($reflection->getConstants() as $constant) {
50+
if (!is_string($constant)) {
51+
continue;
52+
}
4953
if (!$locationValueType->isSuperTypeOf($scope->getTypeFromValue($constant))->yes()) {
5054
continue;
5155
}

0 commit comments

Comments
 (0)