[13.x] Consolidate Artisan command $name/getArguments()/getOptions() into $signature - #60926
Conversation
Snapshots the name, aliases, arguments, and options of every Artisan command into a data-provider test, so a future refactor consolidating each command's $name/getArguments()/getOptions() into a single $signature string can be verified to leave behavior unchanged.
|
Thanks for submitting a PR! Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
Converts most framework Artisan commands that used the separate $name + getArguments()/getOptions() style over to the single $signature string DSL, as verified by CommandSignatureTest. Commands with a genuinely required-value option (migrate:rollback --batch, make:component --path, dev:list --filter, make:controller --type) are left on the array-based $name/getOptions() style, since the signature DSL can only ever produce VALUE_OPTIONAL options. Command gained a configureDefaults() hook, called once the argument/option definition is built, for defaults that can't be expressed as static signature text: environment-dependent values (ServeCommand's --host/--port) and non-string literal defaults (StatusCommand's --pending and MailMakeCommand's --markdown/--view, which default to false rather than null so handle() can tell "not passed" apart from "passed with no value"). ServeCommand's --tries default changes from int 10 to string '10', since the signature DSL only ever produces string defaults -- this already matches every other numeric-looking default on every command in the framework that was already signature-based (e.g. WorkCommand's --memory=128), so it's not a new inconsistency. Also removes a dead, unused $name property left over on ShowModelCommand from an earlier partial migration to $signature.
97acdd2 to
36218d6
Compare
|
FWIW this might be a breaking change, see archtechx/tenancy#1474 I'm not sure if extending a Laravel command and overriding just Assuming we can migrate to Update: Managed to do just a conditional |
|
Isn't |
|
it looks like this change breaks the migrate command when using the schema loader. I'm used to call EDIT: it's actually because we're using https://github.com/jlorente/laravel-data-migrations which extends Illuminate\Database\Console\Migrations\InstallCommand while overriding $name and not $signature. it makes it register itself as the migrate:install command instead of the Laravel one. sorry for the noise |
* fix: preserve Oxygen seed command registration Laravel framework PR #60926 consolidated inherited command metadata into $signature, causing the previous $name override to be ignored and the package command to register as db:seed. Rename the command through configure() and verify that oxygen:seed remains distinct from Laravel’s native db:seed. Upstream breaking change: laravel/framework#60926 Upstream commit: laravel/framework@08bb3da * ci: run tests for pull requests targeting 6.x
|
Breaking change if we extend one of these command and override Custom options will just be ignored as we now use Solution : move custom options inside |
|
If you're extending one of these commands, the proper way is overriding |
Laravel 13.24 changed how the framework generator commands are defined (laravel/framework#60926), which breaks ddd:* command registration under v2 (#115). Rather than backporting the fix, v2 is now end of life: a composer conflict with illuminate/console >= 13.24.0 surfaces the incompatibility at dependency resolution time, and the README directs users to the automated ddd:upgrade path to v3. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
$name+getArguments()/getOptions()style to the single$signaturestring.Excluded commands
These commands keep the old array-based style, because each has an option whose value is required, and the
$signatureDSL can only make option values optional. Supporting required values would need a!marker in the signature DSL, which was proposed but not merged in #60888:migrate:rollback(--batch)make:component(--path)dev:list(--filter)make:controller(--type)