Skip to content

Commit debac46

Browse files
uekannstaabm
authored andcommitted
Refactor
1 parent dc94a01 commit debac46

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Type/Php/ArrayAllFunctionTypeSpecifyingExtension.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use PHPStan\Type\MixedType;
1919
use PHPStan\Type\Type;
2020
use function array_find;
21-
use function assert;
2221
use function count;
2322
use function is_string;
2423
use function strtolower;
@@ -38,7 +37,7 @@ public function isFunctionSupported(FunctionReflection $functionReflection, Func
3837
public function specifyTypes(FunctionReflection $functionReflection, FuncCall $node, Scope $scope, TypeSpecifierContext $context): SpecifiedTypes
3938
{
4039
$args = $node->getArgs();
41-
if (!$context->true() || count($args) < 2) {
40+
if (!$context->truthy() || count($args) < 2) {
4241
return new SpecifiedTypes();
4342
}
4443

@@ -49,15 +48,14 @@ public function specifyTypes(FunctionReflection $functionReflection, FuncCall $n
4948
} elseif (
5049
$callable instanceof Expr\Closure &&
5150
count($callable->stmts) === 1 &&
52-
$callable->stmts[0] instanceof Stmt\Return_
51+
$callable->stmts[0] instanceof Stmt\Return_ &&
52+
isset($callable->stmts[0]->expr)
5353
) {
5454
$callableExpr = $callable->stmts[0]->expr;
5555
} else {
5656
return new SpecifiedTypes();
5757
}
5858

59-
assert(isset($callableExpr));
60-
6159
$callableParams = $callable->params;
6260
$specifiedTypesInFuncCall = $this->typeSpecifier->specifyTypesInCondition($scope, $callableExpr, $context)->getSureTypes();
6361

0 commit comments

Comments
 (0)