laravel-shift/blueprint

Support for constructor property promotion

faustbrian opened this issue · 0 comments

Synopsis:

Following #617 it would be useful to make constructor property promotion configurable. This would allow for code generation that requires less refactoring after the fact. Even more fine-grained control would be to allow the use of readonly to further reduce the need for refactoring if someone wishes to use readonly in combination with constructor property promotion.

Proposed Syntax:

A simple boolean flag in the configuration that indicates whether or not templates should use constructor property promotion.

Expected Behavior:

<?php

namespace App\Events;

use App\Models\Ticket;
use Illuminate\Queue\SerializesModels;

class NewTicket
{
    use SerializesModels;

    /**
     * Create a new event instance.
     */
    public function __construct(public Ticket $ticket)
    {
        //
    }
}