Skip to content

refactor: update Console::run() to allow it be called in command() function#10080

Merged
paulbalandan merged 7 commits intocodeigniter4:4.8from
paulbalandan:refactor-console
Apr 5, 2026
Merged

refactor: update Console::run() to allow it be called in command() function#10080
paulbalandan merged 7 commits intocodeigniter4:4.8from
paulbalandan:refactor-console

Conversation

@paulbalandan
Copy link
Copy Markdown
Member

Description
This refactors Console::run() so that it can accept a list of tokens to parse (defaulting to $_SERVER['argv'] if empty) when run() is called. This consequently allows it to be called inside the command() function so that the latter can also enjoy the enhancements to command line parsing.

A behavior break that I am seeing is that command() now receives the $params as a merge of arguments and options, instead of the previous how-it-was-parsed order. However, since getting the params passed to a command by this function is not an intended use, I believe its impact is minimal.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@paulbalandan paulbalandan added refactor Pull requests that refactor code breaking change Pull requests that may break existing functionalities labels Mar 31, 2026
@github-actions github-actions bot added the 4.8 PRs that target the `4.8` branch. label Mar 31, 2026
@paulbalandan paulbalandan force-pushed the refactor-console branch 2 times, most recently from a7fdc17 to 2c1f8cc Compare March 31, 2026 19:00
@paulbalandan paulbalandan force-pushed the refactor-console branch 3 times, most recently from 5c4f7b7 to 51f329d Compare April 4, 2026 13:29
Copy link
Copy Markdown
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - thanks!

@paulbalandan
Copy link
Copy Markdown
Member Author

I reverted the deprecation on Boot::initializeConsole() as I figured there may be users who modified the Console class. The previous deprecation will no longer give the chance to provide a user's own Console class which is too much of a break.

@paulbalandan paulbalandan requested a review from michalsn April 5, 2026 12:41
@paulbalandan paulbalandan merged commit d6e3f7b into codeigniter4:4.8 Apr 5, 2026
55 checks passed
@paulbalandan paulbalandan deleted the refactor-console branch April 5, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.8 PRs that target the `4.8` branch. breaking change Pull requests that may break existing functionalities refactor Pull requests that refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants