Skip to content

Commit 95a827a

Browse files
committed
Fix PHPStan error about non-callable being returned
> phpstan: Method WP_AI_Client_Prompt_Builder::get_builder_callable() should return callable(): mixed but returns array{WordPress\AiClient\Builders\PromptBuilder, string}.
1 parent a2d738f commit 95a827a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/wp-includes/ai-client/class-wp-ai-client-prompt-builder.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,8 @@ private static function is_generating_method( string $name ): bool {
392392
protected function get_builder_callable( string $name ): callable {
393393
$camel_case_name = $this->snake_to_camel_case( $name );
394394

395-
if ( ! is_callable( array( $this->builder, $camel_case_name ) ) ) {
395+
$method = array( $this->builder, $camel_case_name );
396+
if ( ! is_callable( $method ) ) {
396397
throw new BadMethodCallException(
397398
sprintf(
398399
/* translators: 1: Method name. 2: Class name. */
@@ -403,7 +404,7 @@ protected function get_builder_callable( string $name ): callable {
403404
);
404405
}
405406

406-
return array( $this->builder, $camel_case_name );
407+
return $method;
407408
}
408409

409410
/**

0 commit comments

Comments
 (0)