Skip to content

Commit 771ebe7

Browse files
committed
simplify
1 parent 79d10ea commit 771ebe7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Type/Php/ArrayKeysFunctionDynamicReturnTypeExtension.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,22 @@ public function isFunctionSupported(FunctionReflection $functionReflection): boo
3030

3131
public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
3232
{
33-
if (count($functionCall->getArgs()) < 1) {
33+
$args = $functionCall->getArgs();
34+
if (count($args) < 1) {
3435
return null;
3536
}
3637

37-
$arrayType = $scope->getType($functionCall->getArgs()[0]->value);
38+
$arrayType = $scope->getType($args[0]->value);
3839
if ($arrayType->isArray()->no()) {
3940
return $this->phpVersion->arrayFunctionsReturnNullWithNonArray() ? new NullType() : new NeverType();
4041
}
4142

42-
if (count($functionCall->getArgs()) >= 2) {
43-
$filterType = $scope->getType($functionCall->getArgs()[1]->value);
43+
if (count($args) >= 2) {
44+
$filterType = $scope->getType($args[1]->value);
4445

4546
$strict = TrinaryLogic::createNo();
46-
if (count($functionCall->getArgs()) >= 3) {
47-
$strict = $scope->getType($functionCall->getArgs()[2]->value)->isTrue();
47+
if (count($args) >= 3) {
48+
$strict = $scope->getType($args[2]->value)->isTrue();
4849
}
4950

5051
return $arrayType->getKeysArrayFiltered($filterType, $strict);

0 commit comments

Comments
 (0)