Skip to content

Commit

Permalink
Fix CS (#186)
Browse files Browse the repository at this point in the history
* Fix CS

* Fix PHP 7.2 compat.
  • Loading branch information
szepeviktor committed Apr 23, 2023
1 parent 68cdfe3 commit 5b5cc77
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/GetPostsDynamicFunctionReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private static function getIndeterminedType(): Type
{
return TypeCombinator::union(
new ArrayType(new IntegerType(), new ObjectType(WP_Post::class)),
new ArrayType(new IntegerType(), new IntegerType()),
new ArrayType(new IntegerType(), new IntegerType())
);
}
}
8 changes: 3 additions & 5 deletions src/GetTermsDynamicFunctionReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use PHPStan\Type\Accessory\AccessoryNumericStringType;
use PHPStan\Type\Constant\ConstantStringType;


class GetTermsDynamicFunctionReturnTypeExtension implements \PHPStan\Type\DynamicFunctionReturnTypeExtension
{
private const SUPPORTED_FUNCTIONS = [
Expand All @@ -40,6 +39,8 @@ public function isFunctionSupported(FunctionReflection $functionReflection): boo
/**
* @see https://developer.wordpress.org/reference/functions/get_terms/
* @see https://developer.wordpress.org/reference/classes/wp_term_query/__construct/
*
* phpcs:ignore NeutronStandard.Functions.LongFunction.LongFunction
*/
public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
{
Expand All @@ -48,10 +49,7 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,

if ($argsParameterPosition === null) {
throw new \PHPStan\ShouldNotHappenException(
sprintf(
'Could not detect parameter position for function %s()',
$name
)
sprintf('Could not detect parameter position for function %s()', $name)
);
}

Expand Down

0 comments on commit 5b5cc77

Please sign in to comment.