Skip to content

Commit 3721127

Browse files
authored
Merge pull request #44 from johnbillion/fix/get-posts-return-type
Correct the default return type of `get_posts()`
2 parents 075d3db + 9f5cf67 commit 3721127

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/GetPostsDynamicFunctionReturnTypeExtension.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use PhpParser\Node\Expr\FuncCall;
1212
use PHPStan\Analyser\Scope;
1313
use PHPStan\Reflection\FunctionReflection;
14-
use PHPStan\Reflection\ParametersAcceptorSelector;
1514
use PHPStan\Type\Type;
1615
use PHPStan\Type\ArrayType;
1716
use PHPStan\Type\IntegerType;
@@ -60,11 +59,7 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
6059

6160
// Without constant argument return default return type
6261
if (! isset($fields)) {
63-
return ParametersAcceptorSelector::selectFromArgs(
64-
$scope,
65-
$functionCall->args,
66-
$functionReflection->getVariants()
67-
)->getReturnType();
62+
return new ArrayType(new IntegerType(), new ObjectType('WP_Post'));
6863
}
6964

7065
switch ($fields) {

0 commit comments

Comments
 (0)