Skip to content

Fix types for ConfirmableTrait::confirmToProceed#58681

Merged
taylorotwell merged 1 commit into
laravel:12.xfrom
rolfvandekrol:bugfix/confirm-to-proceed-types
Feb 9, 2026
Merged

Fix types for ConfirmableTrait::confirmToProceed#58681
taylorotwell merged 1 commit into
laravel:12.xfrom
rolfvandekrol:bugfix/confirm-to-proceed-types

Conversation

@rolfvandekrol

@rolfvandekrol rolfvandekrol commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

This PR adds a default value to the TReturn template type for ConfirmableTrait::confirmToProceed. Without this, the following code gives a PHPStan error (on level 6 and higher).

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;

class MyCommand extends Command
{
    use ConfirmableTrait;

    protected $signature = 'my-command';

    public function handle(): void
    {
        if ($this->confirmToProceed()) {
            // Do something destructive
        }
    }
}

Without any parameters PHPStan cannot determine the value of TReturn. In that case bool seems like a reasonable default. This is a problem since Laravel 12.50.0 because of the changes in #58565

@rolfvandekrol

Copy link
Copy Markdown
Contributor Author

The MariaDB tests have failed, because Github thinks they take too long. I can't find a button to retry (probably don't have the permissions for that), but I can't imagine this change breaks the MariaDB tests.

@taylorotwell taylorotwell merged commit 2d4252d into laravel:12.x Feb 9, 2026
71 of 72 checks passed
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