Skip to content

Commit bd74962

Browse files
committed
Improve compatibility with nikic/php-parser 4.13.0
1 parent 2ddd94d commit bd74962

9 files changed

+17
-17
lines changed

src/Rules/Doctrine/ORM/DqlRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function processNode(Node $node, Scope $scope): array
3434
return [];
3535
}
3636

37-
if (count($node->args) === 0) {
37+
if (count($node->getArgs()) === 0) {
3838
return [];
3939
}
4040

@@ -49,7 +49,7 @@ public function processNode(Node $node, Scope $scope): array
4949
return [];
5050
}
5151

52-
$dqls = TypeUtils::getConstantStrings($scope->getType($node->args[0]->value));
52+
$dqls = TypeUtils::getConstantStrings($scope->getType($node->getArgs()[0]->value));
5353
if (count($dqls) === 0) {
5454
return [];
5555
}

src/Rules/Doctrine/ORM/RepositoryMethodCallRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public function getNodeType(): string
3434

3535
public function processNode(Node $node, Scope $scope): array
3636
{
37-
if (!isset($node->args[0])) {
37+
if (!isset($node->getArgs()[0])) {
3838
return [];
3939
}
40-
$argType = $scope->getType($node->args[0]->value);
40+
$argType = $scope->getType($node->getArgs()[0]->value);
4141
if (!$argType instanceof ConstantArrayType) {
4242
return [];
4343
}

src/Type/Doctrine/GetRepositoryDynamicReturnTypeExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ public function getTypeFromMethodCall(
4848
Scope $scope
4949
): Type
5050
{
51-
if (count($methodCall->args) === 0) {
51+
if (count($methodCall->getArgs()) === 0) {
5252
return new GenericObjectType(
5353
$this->metadataResolver->getResolvedRepositoryClass(),
5454
[new ObjectWithoutClassType()]
5555
);
5656
}
57-
$argType = $scope->getType($methodCall->args[0]->value);
57+
$argType = $scope->getType($methodCall->getArgs()[0]->value);
5858
if ($argType instanceof ConstantStringType) {
5959
$objectName = $argType->getValue();
6060
$classType = new ObjectType($objectName);
@@ -69,13 +69,13 @@ public function getTypeFromMethodCall(
6969

7070
$objectName = $classType->getClassName();
7171
} else {
72-
return $this->getDefaultReturnType($scope, $methodCall->args, $methodReflection);
72+
return $this->getDefaultReturnType($scope, $methodCall->getArgs(), $methodReflection);
7373
}
7474

7575
try {
7676
$repositoryClass = $this->metadataResolver->getRepositoryClass($objectName);
7777
} catch (\Doctrine\ORM\Mapping\MappingException $e) {
78-
return $this->getDefaultReturnType($scope, $methodCall->args, $methodReflection);
78+
return $this->getDefaultReturnType($scope, $methodCall->getArgs(), $methodReflection);
7979
}
8080

8181
return new GenericObjectType($repositoryClass, [

src/Type/Doctrine/Query/QueryGetDqlDynamicReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getTypeFromMethodCall(
3636
if (count($queryTypes) === 0) {
3737
return ParametersAcceptorSelector::selectFromArgs(
3838
$scope,
39-
$methodCall->args,
39+
$methodCall->getArgs(),
4040
$methodReflection->getVariants()
4141
)->getReturnType();
4242
}

src/Type/Doctrine/QueryBuilder/EntityRepositoryCreateQueryBuilderDynamicReturnTypeExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ public function getTypeFromMethodCall(
4040
$entityNameExpr = new String_($entityNameExprType->getGenericType()->getClassName());
4141
}
4242

43-
if (!isset($methodCall->args[0])) {
43+
if (!isset($methodCall->getArgs()[0])) {
4444
return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
4545
}
4646

47-
$fromArgs = $methodCall->args;
47+
$fromArgs = $methodCall->getArgs();
4848
array_unshift($fromArgs, new Arg($entityNameExpr));
4949

5050
$callStack = new MethodCall($methodCall->var, new Identifier('getEntityManager'));
5151
$callStack = new MethodCall($callStack, new Identifier('createQueryBuilder'));
52-
$callStack = new MethodCall($callStack, new Identifier('select'), [$methodCall->args[0]]);
52+
$callStack = new MethodCall($callStack, new Identifier('select'), [$methodCall->getArgs()[0]]);
5353
$callStack = new MethodCall($callStack, new Identifier('from'), $fromArgs);
5454

5555
return $scope->getType($callStack);

src/Type/Doctrine/QueryBuilder/Expr/ExpressionBuilderDynamicReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
5959
$queryBuilder = $objectManager->createQueryBuilder();
6060

6161
try {
62-
$args = $this->argumentsProcessor->processArgs($scope, $methodReflection->getName(), $methodCall->args);
62+
$args = $this->argumentsProcessor->processArgs($scope, $methodReflection->getName(), $methodCall->getArgs());
6363
} catch (DynamicQueryBuilderArgumentException $e) {
6464
return $defaultReturnType;
6565
}

src/Type/Doctrine/QueryBuilder/Expr/NewExprDynamicReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function getTypeFromStaticMethodCall(MethodReflection $methodReflection,
6666
...$this->argumentsProcessor->processArgs(
6767
$scope,
6868
$methodReflection->getName(),
69-
$methodCall->args
69+
$methodCall->getArgs()
7070
)
7171
);
7272
} catch (DynamicQueryBuilderArgumentException $e) {

src/Type/Doctrine/QueryBuilder/QueryBuilderGetQueryDynamicReturnTypeExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getTypeFromMethodCall(
6060
$calledOnType = $scope->getType($methodCall->var);
6161
$defaultReturnType = ParametersAcceptorSelector::selectFromArgs(
6262
$scope,
63-
$methodCall->args,
63+
$methodCall->getArgs(),
6464
$methodReflection->getVariants()
6565
)->getReturnType();
6666
$queryBuilderTypes = DoctrineTypeUtils::getQueryBuilderTypes($calledOnType);
@@ -113,7 +113,7 @@ public function getTypeFromMethodCall(
113113
}
114114

115115
try {
116-
$args = $this->argumentsProcessor->processArgs($scope, $methodName, $calledMethodCall->args);
116+
$args = $this->argumentsProcessor->processArgs($scope, $methodName, $calledMethodCall->getArgs());
117117
} catch (DynamicQueryBuilderArgumentException $e) {
118118
return $defaultReturnType;
119119
}

src/Type/Doctrine/QueryBuilder/QueryBuilderTypeSpecifyingExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function specifyTypes(MethodReflection $methodReflection, MethodCall $nod
6060

6161
$returnType = ParametersAcceptorSelector::selectFromArgs(
6262
$scope,
63-
$node->args,
63+
$node->getArgs(),
6464
$methodReflection->getVariants()
6565
)->getReturnType();
6666
if ($returnType instanceof MixedType) {

0 commit comments

Comments
 (0)