Skip to content

Commit f904caa

Browse files
authored
Merge pull request #8267 from zigzagdev/fix/abort-strlen-condition
Fix: inconsistency between condition and error message in `abort()` example
1 parent f55060a commit f904caa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/en/console-commands/commands.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ to terminate execution:
212212
public function execute(Arguments $args, ConsoleIo $io): int
213213
{
214214
$name = $args->getArgument('name');
215-
if (mb_strlen($name) < 5) {
215+
if (mb_strlen($name) < 4) {
216216
// Halt execution, output to stderr, and set exit code to 1
217217
$io->error('Name must be at least 4 characters long.');
218218
$this->abort();
@@ -228,7 +228,7 @@ You can also use `abort()` on the `$io` object to emit a message and code:
228228
public function execute(Arguments $args, ConsoleIo $io): int
229229
{
230230
$name = $args->getArgument('name');
231-
if (mb_strlen($name) < 5) {
231+
if (mb_strlen($name) < 4) {
232232
// Halt execution, output to stderr, and set exit code to 99
233233
$io->abort('Name must be at least 4 characters long.', 99);
234234
}

docs/ja/console-commands/commands.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class UserCommand extends Command
196196
public function execute(Arguments $args, ConsoleIo $io)
197197
{
198198
$name = $args->getArgument('name');
199-
if (strlen($name) < 5) {
199+
if (strlen($name) < 4) {
200200
// 実行を停止し、標準エラーに出力し、終了コードを 1 に設定
201201
$io->error('Name must be at least 4 characters long.');
202202
$this->abort();
@@ -210,7 +210,7 @@ public function execute(Arguments $args, ConsoleIo $io)
210210
public function execute(Arguments $args, ConsoleIo $io)
211211
{
212212
$name = $args->getArgument('name');
213-
if (strlen($name) < 5) {
213+
if (strlen($name) < 4) {
214214
// 実行を停止しstderrに出力し、終了コードを99に設定します
215215
$io->abort('名前は4文字以上にする必要があります。', 99);
216216
}

0 commit comments

Comments
 (0)