Skip to content

Commit 744502a

Browse files
committed
Use new matchExpr API
1 parent c2f6808 commit 744502a

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

src/PHPStan/PregMatchParameterOutTypeExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ public function getParameterOutTypeFromStaticMethodCall(MethodReflection $method
5151
if ($flagsType === null) {
5252
return null;
5353
}
54-
$patternType = $scope->getType($patternArg->value);
5554

56-
return $this->regexShapeMatcher->matchExpr($patternType, $flagsType, TrinaryLogic::createMaybe());
55+
return $this->regexShapeMatcher->matchExpr($patternArg->value, $flagsType, TrinaryLogic::createMaybe(), $scope);
5756
}
5857

5958
}

src/PHPStan/PregMatchTypeSpecifyingExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@ public function specifyTypes(MethodReflection $methodReflection, StaticCall $nod
6666
if ($flagsType === null) {
6767
return new SpecifiedTypes();
6868
}
69-
$patternType = $scope->getType($patternArg->value);
7069

71-
$matchedType = $this->regexShapeMatcher->matchExpr($patternType, $flagsType, TrinaryLogic::createFromBoolean($context->true()));
70+
$matchedType = $this->regexShapeMatcher->matchExpr($patternArg->value, $flagsType, TrinaryLogic::createFromBoolean($context->true()), $scope);
7271
if ($matchedType === null) {
7372
return new SpecifiedTypes();
7473
}

src/PHPStan/UnsafeStrictGroupsCallRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ public function processNode(Node $node, Scope $scope): array
7575
if ($flagsType === null) {
7676
return [];
7777
}
78-
$patternType = $scope->getType($patternArg->value);
7978

80-
$matchedType = $this->regexShapeMatcher->matchExpr($patternType, $flagsType, TrinaryLogic::createYes());
79+
$matchedType = $this->regexShapeMatcher->matchExpr($patternArg->value, $flagsType, TrinaryLogic::createYes(), $scope);
8180
if ($matchedType === null) {
8281
return [
8382
RuleErrorBuilder::message(sprintf('The %s call is potentially unsafe as $matches\' type could not be inferred.', $node->name->name))

0 commit comments

Comments
 (0)