Skip to content

Commit d68938d

Browse files
committed
Improve compatibility with nikic/php-parser 4.13.0
1 parent 41afc8e commit d68938d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Type/WebMozartAssert/AssertTypeSpecifyingExtension.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function isStaticMethodSupported(
5757
'allNotSame' => 2,
5858
];
5959
return array_key_exists($staticMethodReflection->getName(), $methods)
60-
&& count($node->args) >= $methods[$staticMethodReflection->getName()];
60+
&& count($node->getArgs()) >= $methods[$staticMethodReflection->getName()];
6161
}
6262

6363
$trimmedName = self::trimName($staticMethodReflection->getName());
@@ -70,7 +70,7 @@ public function isStaticMethodSupported(
7070
$resolver = $resolvers[$trimmedName];
7171
$resolverReflection = new \ReflectionObject($resolver);
7272

73-
return count($node->args) >= (count($resolverReflection->getMethod('__invoke')->getParameters()) - 1);
73+
return count($node->getArgs()) >= (count($resolverReflection->getMethod('__invoke')->getParameters()) - 1);
7474
}
7575

7676
private static function trimName(string $name): string
@@ -99,7 +99,7 @@ public function specifyTypes(
9999
$scope
100100
);
101101
}
102-
$expression = self::createExpression($scope, $staticMethodReflection->getName(), $node->args);
102+
$expression = self::createExpression($scope, $staticMethodReflection->getName(), $node->getArgs());
103103
if ($expression === null) {
104104
return new SpecifiedTypes([], []);
105105
}
@@ -466,34 +466,34 @@ private function handleAllNot(
466466
if ($methodName === 'allNotNull') {
467467
return $this->arrayOrIterable(
468468
$scope,
469-
$node->args[0]->value,
469+
$node->getArgs()[0]->value,
470470
function (Type $type): Type {
471471
return TypeCombinator::removeNull($type);
472472
}
473473
);
474474
}
475475

476476
if ($methodName === 'allNotInstanceOf') {
477-
$classType = $scope->getType($node->args[1]->value);
477+
$classType = $scope->getType($node->getArgs()[1]->value);
478478
if (!$classType instanceof ConstantStringType) {
479479
return new SpecifiedTypes([], []);
480480
}
481481

482482
$objectType = new ObjectType($classType->getValue());
483483
return $this->arrayOrIterable(
484484
$scope,
485-
$node->args[0]->value,
485+
$node->getArgs()[0]->value,
486486
function (Type $type) use ($objectType): Type {
487487
return TypeCombinator::remove($type, $objectType);
488488
}
489489
);
490490
}
491491

492492
if ($methodName === 'allNotSame') {
493-
$valueType = $scope->getType($node->args[1]->value);
493+
$valueType = $scope->getType($node->getArgs()[1]->value);
494494
return $this->arrayOrIterable(
495495
$scope,
496-
$node->args[0]->value,
496+
$node->getArgs()[0]->value,
497497
function (Type $type) use ($valueType): Type {
498498
return TypeCombinator::remove($type, $valueType);
499499
}

0 commit comments

Comments
 (0)