Skip to content

Commit fc879ea

Browse files
committed
simplify
1 parent ea0ea33 commit fc879ea

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Type/Php/ArrayKeysFunctionDynamicReturnTypeExtension.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,22 @@ public function isFunctionSupported(FunctionReflection $functionReflection): boo
2828

2929
public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): ?Type
3030
{
31-
if (count($functionCall->getArgs()) < 1) {
31+
$args = $functionCall->getArgs();
32+
if (count($args) < 1) {
3233
return null;
3334
}
3435

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

40-
if (count($functionCall->getArgs()) >= 2) {
41-
$filterType = $scope->getType($functionCall->getArgs()[1]->value);
41+
if (count($args) >= 2) {
42+
$filterType = $scope->getType($args[1]->value);
4243

4344
$strict = TrinaryLogic::createNo();
44-
if (count($functionCall->getArgs()) >= 3) {
45-
$strict = $scope->getType($functionCall->getArgs()[2]->value)->isTrue();
45+
if (count($args) >= 3) {
46+
$strict = $scope->getType($args[2]->value)->isTrue();
4647
}
4748

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

0 commit comments

Comments
 (0)