Skip to content

Commit ddb9dc5

Browse files
committedJan 24, 2023
Use isSuperTypeOf() instead of accepts() in the right places
1 parent 2ec815b commit ddb9dc5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎src/Rules/Classes/ImpossibleInstanceOfRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function processNode(Node $node, Scope $scope): array
4949
new StringType(),
5050
new ObjectWithoutClassType(),
5151
);
52-
if (!$allowed->accepts($classType, true)->yes()) {
52+
if (!$allowed->isSuperTypeOf($classType)->yes()) {
5353
return [
5454
RuleErrorBuilder::message(sprintf(
5555
'Instanceof between %s and %s results in an error.',

‎src/Rules/Operators/InvalidComparisonOperationRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function processNode(Node $node, Scope $scope): array
7575
private function isNumberType(Scope $scope, Node\Expr $expr): bool
7676
{
7777
$acceptedType = new UnionType([new IntegerType(), new FloatType()]);
78-
$onlyNumber = static fn (Type $type): bool => $acceptedType->accepts($type, true)->yes();
78+
$onlyNumber = static fn (Type $type): bool => $acceptedType->isSuperTypeOf($type)->yes();
7979

8080
$type = $this->ruleLevelHelper->findTypeToCheck($scope, $expr, '', $onlyNumber)->getType();
8181

0 commit comments

Comments
 (0)
Please sign in to comment.