From 89599a5cc9b639df5f11a68f6ed8d588e87932e9 Mon Sep 17 00:00:00 2001 From: Jamison Bryant Date: Fri, 20 Feb 2026 09:06:46 -0500 Subject: [PATCH 1/2] Add note about class properties for IO/Args --- docs/en/console-commands/commands.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/en/console-commands/commands.md b/docs/en/console-commands/commands.md index 55cb26ebd8..b49e94787f 100644 --- a/docs/en/console-commands/commands.md +++ b/docs/en/console-commands/commands.md @@ -37,8 +37,8 @@ class HelloCommand extends Command ``` Command classes must implement an `execute()` method that does the bulk of -their work. This method is called when a command is invoked. Let's call our first -command application directory, run: +their work. This method is called when a command is invoked. Let's call our +first command. From your application directory, run: ```bash bin/cake hello @@ -48,6 +48,16 @@ You should see the following output: Hello world. +> [!NOTE] +> The `Arguments` and `ConsoleIo` instances passed to `execute()` are also +> available as `$this->args` and `$this->io` on the command instance. This +> lets any method in your command access them without needing them as +> parameters. In 6.x, the `execute()` method signature will change to +> `execute(): int` and `$this->args` / `$this->io` will be the only way to +> access these objects. See the +> [6.x command refactor](https://github.com/cakephp/cakephp/pull/18983) for +> details. + Our `execute()` method isn't very interesting let's read some input from the command line: From d50466763dc0ea257eee7c68bb6e1f712335f86c Mon Sep 17 00:00:00 2001 From: Jamison Bryant Date: Fri, 20 Feb 2026 09:30:35 -0500 Subject: [PATCH 2/2] Replace wrong GitHub-style note with proper Vitepress syntax --- docs/en/console-commands/commands.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/en/console-commands/commands.md b/docs/en/console-commands/commands.md index b49e94787f..ec3ab845a1 100644 --- a/docs/en/console-commands/commands.md +++ b/docs/en/console-commands/commands.md @@ -48,15 +48,15 @@ You should see the following output: Hello world. -> [!NOTE] -> The `Arguments` and `ConsoleIo` instances passed to `execute()` are also -> available as `$this->args` and `$this->io` on the command instance. This -> lets any method in your command access them without needing them as -> parameters. In 6.x, the `execute()` method signature will change to -> `execute(): int` and `$this->args` / `$this->io` will be the only way to -> access these objects. See the -> [6.x command refactor](https://github.com/cakephp/cakephp/pull/18983) for -> details. +::: info +The `Arguments` and `ConsoleIo` instances passed to `execute()` are also +available on the command instance as `$this->args` and `$this->io`. +In 6.x, the `execute()` method signature will drop these arguments +and `$this->args` / `$this->io` will be the only way to access +these objects. See the +[6.x command refactor](https://github.com/cakephp/cakephp/pull/18983) for +details. +::: Our `execute()` method isn't very interesting let's read some input from the command line: