Skip to content

Commit

Permalink
Use new matchExpr API
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jul 19, 2024
1 parent c2f6808 commit 744502a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/PHPStan/PregMatchParameterOutTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ public function getParameterOutTypeFromStaticMethodCall(MethodReflection $method
if ($flagsType === null) {
return null;
}
$patternType = $scope->getType($patternArg->value);

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

}
3 changes: 1 addition & 2 deletions src/PHPStan/PregMatchTypeSpecifyingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ public function specifyTypes(MethodReflection $methodReflection, StaticCall $nod
if ($flagsType === null) {
return new SpecifiedTypes();
}
$patternType = $scope->getType($patternArg->value);

$matchedType = $this->regexShapeMatcher->matchExpr($patternType, $flagsType, TrinaryLogic::createFromBoolean($context->true()));
$matchedType = $this->regexShapeMatcher->matchExpr($patternArg->value, $flagsType, TrinaryLogic::createFromBoolean($context->true()), $scope);
if ($matchedType === null) {
return new SpecifiedTypes();
}
Expand Down
3 changes: 1 addition & 2 deletions src/PHPStan/UnsafeStrictGroupsCallRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ public function processNode(Node $node, Scope $scope): array
if ($flagsType === null) {
return [];
}
$patternType = $scope->getType($patternArg->value);

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

0 comments on commit 744502a

Please sign in to comment.