Skip to content

Commit 4620524

Browse files
committed
Improve compatibility with PHPParser 4.13.0
1 parent 88557fc commit 4620524

7 files changed

+15
-15
lines changed

src/Rules/PHPUnit/AssertSameBooleanExpectedRule.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ public function processNode(Node $node, Scope $scope): array
2626
/** @var \PhpParser\Node\Expr\MethodCall|\PhpParser\Node\Expr\StaticCall $node */
2727
$node = $node;
2828

29-
if (count($node->args) < 2) {
29+
if (count($node->getArgs()) < 2) {
3030
return [];
3131
}
3232
if (!$node->name instanceof Node\Identifier || strtolower($node->name->name) !== 'assertsame') {
3333
return [];
3434
}
3535

36-
$leftType = $scope->getType($node->args[0]->value);
36+
$leftType = $scope->getType($node->getArgs()[0]->value);
3737
if (!$leftType instanceof ConstantBooleanType) {
3838
return [];
3939
}

src/Rules/PHPUnit/AssertSameNullExpectedRule.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ public function processNode(Node $node, Scope $scope): array
2626
/** @var \PhpParser\Node\Expr\MethodCall|\PhpParser\Node\Expr\StaticCall $node */
2727
$node = $node;
2828

29-
if (count($node->args) < 2) {
29+
if (count($node->getArgs()) < 2) {
3030
return [];
3131
}
3232
if (!$node->name instanceof Node\Identifier || strtolower($node->name->name) !== 'assertsame') {
3333
return [];
3434
}
3535

36-
$leftType = $scope->getType($node->args[0]->value);
36+
$leftType = $scope->getType($node->getArgs()[0]->value);
3737

3838
if ($leftType instanceof NullType) {
3939
return [

src/Rules/PHPUnit/AssertSameWithCountRule.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ public function processNode(Node $node, Scope $scope): array
2626
/** @var \PhpParser\Node\Expr\MethodCall|\PhpParser\Node\Expr\StaticCall $node */
2727
$node = $node;
2828

29-
if (count($node->args) < 2) {
29+
if (count($node->getArgs()) < 2) {
3030
return [];
3131
}
3232
if (!$node->name instanceof Node\Identifier || strtolower($node->name->name) !== 'assertsame') {
3333
return [];
3434
}
3535

36-
$right = $node->args[1]->value;
36+
$right = $node->getArgs()[1]->value;
3737

3838
if (
3939
$right instanceof Node\Expr\FuncCall
@@ -49,7 +49,7 @@ public function processNode(Node $node, Scope $scope): array
4949
$right instanceof Node\Expr\MethodCall
5050
&& $right->name instanceof Node\Identifier
5151
&& strtolower($right->name->toString()) === 'count'
52-
&& count($right->args) === 0
52+
&& count($right->getArgs()) === 0
5353
) {
5454
$type = $scope->getType($right->var);
5555

src/Rules/PHPUnit/MockMethodCallRule.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ public function processNode(Node $node, Scope $scope): array
3131
return [];
3232
}
3333

34-
if (count($node->args) < 1) {
34+
if (count($node->getArgs()) < 1) {
3535
return [];
3636
}
3737

38-
$argType = $scope->getType($node->args[0]->value);
38+
$argType = $scope->getType($node->getArgs()[0]->value);
3939
if (!($argType instanceof ConstantStringType)) {
4040
return [];
4141
}

src/Type/PHPUnit/Assert/AssertFunctionTypeSpecifyingExtension.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function isFunctionSupported(
3030
{
3131
return AssertTypeSpecifyingExtensionHelper::isSupported(
3232
$this->trimName($functionReflection->getName()),
33-
$node->args
33+
$node->getArgs()
3434
);
3535
}
3636

@@ -45,7 +45,7 @@ public function specifyTypes(
4545
$this->typeSpecifier,
4646
$scope,
4747
$this->trimName($functionReflection->getName()),
48-
$node->args
48+
$node->getArgs()
4949
);
5050
}
5151

src/Type/PHPUnit/Assert/AssertMethodTypeSpecifyingExtension.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function isMethodSupported(
3535
{
3636
return AssertTypeSpecifyingExtensionHelper::isSupported(
3737
$methodReflection->getName(),
38-
$node->args
38+
$node->getArgs()
3939
);
4040
}
4141

@@ -50,7 +50,7 @@ public function specifyTypes(
5050
$this->typeSpecifier,
5151
$scope,
5252
$functionReflection->getName(),
53-
$node->args
53+
$node->getArgs()
5454
);
5555
}
5656

src/Type/PHPUnit/Assert/AssertStaticMethodTypeSpecifyingExtension.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function isStaticMethodSupported(
3535
{
3636
return AssertTypeSpecifyingExtensionHelper::isSupported(
3737
$methodReflection->getName(),
38-
$node->args
38+
$node->getArgs()
3939
);
4040
}
4141

@@ -50,7 +50,7 @@ public function specifyTypes(
5050
$this->typeSpecifier,
5151
$scope,
5252
$functionReflection->getName(),
53-
$node->args
53+
$node->getArgs()
5454
);
5555
}
5656

0 commit comments

Comments
 (0)