Skip to content

Generate the types file when --types is passed as a boolean#892

Open
lazerg wants to merge 1 commit into
tighten:2.xfrom
lazerg:fix/issue-879-types-boolean-flag
Open

Generate the types file when --types is passed as a boolean#892
lazerg wants to merge 1 commit into
tighten:2.xfrom
lazerg:fix/issue-879-types-boolean-flag

Conversation

@lazerg

@lazerg lazerg commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Passing --types as a boolean (e.g. Artisan::call('ziggy:generate', ['--types' => true]), which is the convention Laravel documents for boolean options) coerces the value to the string "1", which then falls through the match in CommandRouteGenerator and gets used as the types file's path, so the declaration file is written to a file named 1 in the project root instead of at the default location. This adds the coerced boolean value to the arm that already handles false/null, so a boolean --types generates the types file at the default path as expected.

Closes #879.

@lazerg

lazerg commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@bakerkretzmar since you already looked at the sister PR, mind also reviewing this one, it fixes the --types option breaking when passed as a boolean.

@bakerkretzmar bakerkretzmar self-assigned this Jul 7, 2026
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.

New --types flag behavior breaks Laravel convention

2 participants