Skip to content

fix: precedence of command classes with the same $name#8898

Merged
kenjis merged 2 commits intocodeigniter4:developfrom
kenjis:fix-command-discovery
Jun 24, 2024
Merged

fix: precedence of command classes with the same $name#8898
kenjis merged 2 commits intocodeigniter4:developfrom
kenjis:fix-command-discovery

Conversation

@kenjis
Copy link
Copy Markdown
Member

@kenjis kenjis commented May 17, 2024

Description
This PR allows users to override commands in the framework with commands in App\Commands,
and prevents other packages from overriding commands in the framework.

This PR changes to use the first command class discovered.
In the current implementation, the last class discovered is executed.
However, for CI4's behavior, if there is a command class in App\Commands, it should take precedence.

See also https://forum.codeigniter.com/showthread.php?tid=90877&pid=418854#pid418854

Checklist:

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

@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label May 17, 2024
@kenjis kenjis marked this pull request as draft May 17, 2024 00:16
Now you can replace CI4's commands with your commands in app/Commands/.
@kenjis kenjis force-pushed the fix-command-discovery branch 4 times, most recently from 8ce24a7 to 831ffcb Compare June 18, 2024 02:30
@kenjis kenjis force-pushed the fix-command-discovery branch from 831ffcb to e6b5931 Compare June 18, 2024 02:40
@kenjis kenjis marked this pull request as ready for review June 18, 2024 02:44
@kenjis kenjis merged commit 9d02066 into codeigniter4:develop Jun 24, 2024
@kenjis kenjis deleted the fix-command-discovery branch June 24, 2024 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants