[12.x] add type declarations for Console Events#53947
Conversation
the added types match the existing constructor docblocks
|
I predict, this will be rejected due to backwards compatibility |
|
@browner12 under what situation does |
|
@taylorotwell I don't know if it actually happens, but in https://github.com/laravel/framework/blob/11.x/src/Illuminate/Foundation/Console/Kernel.php#L166 the |
|
Hmm, ok, I guess we should coalesce in the callers then so the event itself only receives strings. |
both the `CommandStarting` and `CommandFinished` require a string to be passed as the first argument, so we need to account for nullable scenarios.
|
@taylorotwell code has been updated. I realized the Very weird on symfonys part, how could you have a command event without a command? |
php artisan --versionThis could be one example. |
if that's not a command, then why is it firing off a command event? I'm sure they had good reason, just seems odd from the outside looking in. |
the added types match the existing constructor docblocks.
not sure what the current sentiment on stricter typing is from the core team, but thought I'd throw this out there. these events are a good place to start as their construction should basically only be internal.
I checked all the calling code, and this may have already uncovered a bug. the
CommandStartingclaims to accept a string$commandparameter, but the calling code possibly sendsnull. two ways to fix this would be to acceptstring|null, or to have the calling code null coalesce and empty string (?? '').if accepted, I'll update all the other events as well.