Skip to content

Commit 39294b4

Browse files
committed
refactor: remove deprecations in CLI
1 parent cd3013b commit 39294b4

File tree

5 files changed

+8
-74
lines changed

5 files changed

+8
-74
lines changed

system/CLI/BaseCommand.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -193,26 +193,6 @@ public function setPad(string $item, int $max, int $extra = 2, int $indent = 0):
193193
return str_pad(str_repeat(' ', $indent) . $item, $max);
194194
}
195195

196-
/**
197-
* Get pad for $key => $value array output
198-
*
199-
* @param array<string, string> $array
200-
*
201-
* @deprecated Use setPad() instead.
202-
*
203-
* @codeCoverageIgnore
204-
*/
205-
public function getPad(array $array, int $pad): int
206-
{
207-
$max = 0;
208-
209-
foreach (array_keys($array) as $key) {
210-
$max = max($max, strlen($key));
211-
}
212-
213-
return $max + $pad;
214-
}
215-
216196
/**
217197
* Makes it simple to access our protected properties.
218198
*

system/CLI/CLI.php

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,10 @@
3232
*/
3333
class CLI
3434
{
35-
/**
36-
* Is the readline library on the system?
37-
*
38-
* @var bool
39-
*
40-
* @deprecated 4.4.2 Should be protected, and no longer used.
41-
* @TODO Fix to camelCase in the next major version.
42-
*/
43-
public static $readline_support = false;
44-
4535
/**
4636
* The message displayed at prompts.
47-
*
48-
* @var string
49-
*
50-
* @deprecated 4.4.2 Should be protected.
51-
* @TODO Fix to camelCase in the next major version.
5237
*/
53-
public static $wait_msg = 'Press any key to continue...';
38+
protected static string $waitMsg = 'Press any key to continue...';
5439

5540
/**
5641
* Has the class already been initialized?
@@ -159,11 +144,6 @@ class CLI
159144
public static function init()
160145
{
161146
if (is_cli()) {
162-
// Readline is an extension for PHP that makes interactivity with PHP
163-
// much more bash-like.
164-
// http://www.php.net/manual/en/readline.installation.php
165-
static::$readline_support = extension_loaded('readline');
166-
167147
// clear segments & options to keep testing clean
168148
static::$segments = [];
169149
static::$options = [];
@@ -522,21 +502,11 @@ public static function wait(int $seconds, bool $countdown = false)
522502
} elseif ($seconds > 0) {
523503
sleep($seconds);
524504
} else {
525-
static::write(static::$wait_msg);
505+
static::write(static::$waitMsg);
526506
static::$io->input();
527507
}
528508
}
529509

530-
/**
531-
* if operating system === windows
532-
*
533-
* @deprecated 4.3.0 Use `is_windows()` instead
534-
*/
535-
public static function isWindows(): bool
536-
{
537-
return is_windows();
538-
}
539-
540510
/**
541511
* Enter a number of empty lines
542512
*

system/CLI/GeneratorTrait.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,6 @@ trait GeneratorTrait
100100
*/
101101
private $params = [];
102102

103-
/**
104-
* Execute the command.
105-
*
106-
* @param array<int|string, string|null> $params
107-
*
108-
* @deprecated use generateClass() instead
109-
*/
110-
protected function execute(array $params): void
111-
{
112-
$this->generateClass($params);
113-
}
114-
115103
/**
116104
* Generates a class file from an existing template.
117105
*

user_guide_src/source/changelogs/v4.8.0.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ Removed Deprecated Items
5555
- ``CodeIgniter\Cache\Handlers\FileHandler::deleteFile()``
5656
- ``CodeIgniter\Cache\Handlers\FileHandler::getDirFileInfo()``
5757
- ``CodeIgniter\Cache\Handlers\FileHandler::getFileInfo()``
58+
- **CLI:** Removed the following properties and methods deprecated:
59+
- ``CodeIgniter\CLI\BaseCommand::getPad()``
60+
- ``CodeIgniter\CLI\CLI::$readline_support``
61+
- ``CodeIgniter\CLI\CLI::$wait_msg``
62+
- ``CodeIgniter\CLI\CLI::isWindows()``
63+
- ``CodeIgniter\CLI\GeneratorTrait::execute()``
5864
- **CodeIgniter:** Removed the following properties and methods deprecated:
5965
- ``CodeIgniter\CodeIgniter::$cacheTTL``
6066
- ``CodeIgniter\CodeIgniter::$returnResponse``

user_guide_src/source/cli/cli_commands.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,3 @@ be familiar with when creating your own commands. It also has a :doc:`Logger </g
141141

142142
.. literalinclude:: cli_commands/007.php
143143
:lines: 2-
144-
145-
.. php:method:: getPad($array, $pad)
146-
147-
.. deprecated:: 4.0.5
148-
Use :php:meth:`CodeIgniter\\CLI\\BaseCommand::setPad()` instead.
149-
150-
:param array $array: The $key => $value array.
151-
:param integer $pad: The pad spaces.
152-
153-
A method to calculate padding for ``$key => $value`` array output. The padding can be used to output a will formatted table in CLI.

0 commit comments

Comments
 (0)