Skip to content

Pre-release 4.2.122 → 4.2.121 — task 4.5 (foundation): Artisan commands through v13's withCommands() - #95

Merged
agissept merged 1 commit into
masterfrom
pre-release/4.2.122
Oct 6, 2026
Merged

agissept merged 1 commit into
masterfrom
pre-release/4.2.122

Conversation

@oonid

@oonid oonid commented Oct 1, 2026 •

Copy link
Copy Markdown

Task 4.5, foundation — Artisan commands registered through v13's withCommands()

Stacks on #94. This is the second foundation slice. The dicoding app registers its commands as a Laravel 13 app does, with ->withCommands([...]) in bootstrap/app.php. Until now they were ~150 Artisan::add(App::make(...)) lines in app/start/artisan.php, a file only L4.2 loads.

Changes

  • ApplicationBuilder::withCommands(array $commands) hands the command classes to the console Kernel once it resolves, as in v13. Only command classes are supported: the app passes no paths and relies on no discovery.
  • The Artisan wrapper (the console Kernel stand-in) gains v13's addCommands(). When the console starts, it builds those commands through the container with v13's resolveCommands(), as v13's Kernel does. #[AsCommand] commands join the lazy command map.
  • app/start/artisan.php is no longer loaded.
  • Tests: FoundationApplicationBuilderTest now registers its probe command with withCommands(), and its fixture start/artisan.php throws if loaded. A new test adds a second command through addCommands(), runs both and checks that the first gets its constructor dependency from the container.

Verification

  • Fork: the suite is 274 green on PHPUnit 11.5.56. The ratchet is green, with every pattern at its baseline.
  • The tests catch real breaks. Each of these 4 mutations fails at least one test:
    • withCommands() registering nothing;
    • addCommands() replacing instead of adding;
    • not resolving the commands;
    • still loading start/artisan.php.
  • Downstream: the dicoding app pair is dicoding-dev/dicoding#5999 (feature/platform/framework-4.2.122-rc1). It moves its 150 commands from app/start/artisan.php to ->withCommands([...]). It ran with vendor installed exactly from its lock:
    • artisan list --format=json is byte-identical to 4.2.121: all 188 commands, with every argument and option.
    • Psalm (full project, no cache): no errors.
    • Unit suite: 8962 green.
    • Integration suite: all 3022 tests, including the 158 command tests. The only failures are the 4 long-standing ones and two timing-sensitive tests. One crosses its time boundary on 4.2.121 as well. The other matches a row by the exact second and passed 4 of 4 runs alone on both. 196 are skipped, and no test is flagged risky.
    • The real entry points (php -S + server.php → index.php, and 7 artisan commands) are identical to 4.2.121.
  • Checks ran in a cloud container without deck (PHP 8.4.26, MariaDB 10.11).

Tag

4.2.122 (9079a822) is not pushed, and neither are 4.2.119–4.2.121. Tag pushes are refused for this session.

🤖 Generated with Claude Code

https://claude.ai/code/session_0169SsatCE8LhaTsQTPiGtVo

@agissept
agissept force-pushed the pre-release/4.2.122 branch from 9079a82 to 1a857e4 Compare October 2, 2026 09:20
@agissept
agissept added this pull request to stack #102 October 5, 2026 06:14
@agissept
agissept force-pushed the pre-release/4.2.122 branch 2 times, most recently from 0a3d002 to e9b7202 Compare October 5, 2026 07:26
Base automatically changed from pre-release/4.2.121 to master October 5, 2026 08:39
…s() (task 4.5)

The app registers its commands the way a Laravel 13 app does, with
->withCommands([...]) in bootstrap/app.php, instead of ~150
Artisan::add(App::make(...)) lines in app/start/artisan.php:

- ApplicationBuilder::withCommands() hands the command classes to the console
  Kernel once it resolves, as in v13.
- The Artisan wrapper (the console Kernel stand-in) gains v13's addCommands()
  and builds them through the container when the console starts, with v13's
  resolveCommands(); #[AsCommand] commands join the lazy command map.
- The wrapper no longer requires app/start/artisan.php.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169SsatCE8LhaTsQTPiGtVo
@agissept
agissept force-pushed the pre-release/4.2.122 branch from e9b7202 to ac1e494 Compare October 5, 2026 08:40
@agissept agissept self-assigned this Oct 6, 2026
@agissept
agissept marked this pull request as ready for review October 6, 2026 02:34
@agissept
agissept merged commit f906c70 into master Oct 6, 2026
2 checks passed
@agissept
agissept deleted the pre-release/4.2.122 branch October 6, 2026 02:35
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.

3 participants