Skip to content

Fix phpdoc type in promptForMissingArgumentsUsing#58768

Merged
taylorotwell merged 2 commits intolaravel:12.xfrom
billypoke:patch-2
Feb 12, 2026
Merged

Fix phpdoc type in promptForMissingArgumentsUsing#58768
taylorotwell merged 2 commits intolaravel:12.xfrom
billypoke:patch-2

Conversation

@billypoke
Copy link

in #58565 another of the new types is for PromptsForMissingInput::promptForMissingArgumentsUsing. When using a callable to fully control the missing argument prompt such as using laravel/prompts, the union return type isn't quite correct. When specifying a callable return type, multiple return types should be wrapped in parentheses, not the entire \Closure block.

PHPStan docs ref - https://phpstan.org/writing-php-code/phpdoc-types#callables

PHPStan repros here:
Error (current phpdoc) - https://phpstan.org/r/a1815f96-87f0-45eb-920a-3759e941e682
Fixed - https://phpstan.org/r/8d1bd604-6a48-4e7e-8d60-17a76f420ebf

Here's the actual code that is triggering the error:

protected function promptForMissingArgumentsUsing(): array
{
    return [
        'result' => fn (): string => textarea(
            'Enter the payload',
            required: true,
        ),
    ];
}

PHPStan error:

Method App\Console\CommandName::promptForMissingArgumentsUsing() should return array<string,
         array{string, string}|bool|(Closure(): array<int|string>)|int|string> but returns array{result: Closure(): string}.

@taylorotwell taylorotwell merged commit 22323c4 into laravel:12.x Feb 12, 2026
71 checks passed
@billypoke billypoke deleted the patch-2 branch February 12, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants