Skip to content

Commit f09bc90

Browse files
committed
deprecate Boot::initializeConsole()
1 parent 3c36713 commit f09bc90

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

system/Boot.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,8 @@ public static function bootSpark(Paths $paths): int
161161
static::autoloadHelpers();
162162

163163
static::initializeCodeIgniter();
164-
$console = static::initializeConsole();
165164

166-
return static::runCommand($console);
165+
return static::runCommand(new Console());
167166
}
168167

169168
/**
@@ -422,8 +421,13 @@ protected static function saveConfigCache(FactoriesCache $factoriesCache): void
422421
$factoriesCache->save('config');
423422
}
424423

424+
/**
425+
* @deprecated 4.8.0 No longer used.
426+
*/
425427
protected static function initializeConsole(): Console
426428
{
429+
@trigger_error(sprintf('The static %s() method is deprecated and no longer used.', __METHOD__), E_USER_DEPRECATED);
430+
427431
$console = new Console();
428432

429433
// Show basic information before we do anything else.
@@ -439,8 +443,13 @@ protected static function initializeConsole(): Console
439443

440444
protected static function runCommand(Console $console): int
441445
{
442-
$exit = $console->run();
446+
$exitCode = $console->initialize()->run();
447+
448+
if (! is_int($exitCode)) {
449+
@trigger_error(sprintf('Starting with CodeIgniter v4.8.0, commands must return an integer exit code. Last command exited with %s. Defaulting to EXIT_SUCCESS.', get_debug_type($exitCode)), E_USER_DEPRECATED);
450+
$exitCode = EXIT_SUCCESS;
451+
}
443452

444-
return is_int($exit) ? $exit : EXIT_SUCCESS;
453+
return $exitCode;
445454
}
446455
}

0 commit comments

Comments
 (0)