Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: PHPStan CLI no type specified #7753

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 0 additions & 85 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,91 +31,6 @@
'count' => 1,
'path' => __DIR__ . '/system/BaseModel.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:showError\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:showHelp\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:beep\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:clearScreen\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:error\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:fwrite\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:generateDimensions\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:init\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:newLine\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:parseCommandLine\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:print\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:showProgress\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:table\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:wait\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:write\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/CLI.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\Commands\\:\\:discoverCommands\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/Commands.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\Console\\:\\:showHeader\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/Console.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Cache\\\\CacheInterface\\:\\:initialize\\(\\) has no return type specified\\.$#',
'count' => 1,
Expand Down
4 changes: 4 additions & 0 deletions system/CLI/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ protected function call(string $command, array $params = [])

/**
* A simple method to display an error with line/file, in child commands.
*
* @return void
*/
protected function showError(Throwable $e)
{
Expand All @@ -129,6 +131,8 @@ protected function showError(Throwable $e)

/**
* Show Help includes (Usage, Arguments, Description, Options).
*
* @return void
*/
public function showHelp()
{
Expand Down
26 changes: 26 additions & 0 deletions system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ class CLI

/**
* Static "constructor".
*
* @return void
*/
public static function init()
{
Expand Down Expand Up @@ -429,6 +431,8 @@ protected static function validate(string $field, string $value, $rules): bool
/**
* Outputs a string to the CLI without any surrounding newlines.
* Useful for showing repeating elements on a single line.
*
* @return void
*/
public static function print(string $text = '', ?string $foreground = null, ?string $background = null)
{
Expand All @@ -443,6 +447,8 @@ public static function print(string $text = '', ?string $foreground = null, ?str

/**
* Outputs a string to the cli on it's own line.
*
* @return void
*/
public static function write(string $text = '', ?string $foreground = null, ?string $background = null)
{
Expand All @@ -460,6 +466,8 @@ public static function write(string $text = '', ?string $foreground = null, ?str

/**
* Outputs an error to the CLI using STDERR instead of STDOUT
*
* @return void
*/
public static function error(string $text, string $foreground = 'light_red', ?string $background = null)
{
Expand All @@ -481,6 +489,8 @@ public static function error(string $text, string $foreground = 'light_red', ?st
* Beeps a certain number of times.
*
* @param int $num The number of times to beep
*
* @return void
*/
public static function beep(int $num = 1)
{
Expand All @@ -493,6 +503,8 @@ public static function beep(int $num = 1)
*
* @param int $seconds Number of seconds
* @param bool $countdown Show a countdown or not
*
* @return void
*/
public static function wait(int $seconds, bool $countdown = false)
{
Expand Down Expand Up @@ -529,6 +541,8 @@ public static function isWindows(): bool

/**
* Enter a number of empty lines
*
* @return void
*/
public static function newLine(int $num = 1)
{
Expand All @@ -542,6 +556,8 @@ public static function newLine(int $num = 1)
* Clears the screen of output
*
* @codeCoverageIgnore
*
* @return void
*/
public static function clearScreen()
{
Expand Down Expand Up @@ -735,6 +751,8 @@ public static function getHeight(int $default = 32): int
* Populates the CLI's dimensions.
*
* @codeCoverageIgnore
*
* @return void
*/
public static function generateDimensions()
{
Expand Down Expand Up @@ -778,6 +796,8 @@ public static function generateDimensions()
* to update it. Set $thisStep = false to erase the progress bar.
*
* @param bool|int $thisStep
*
* @return void
*/
public static function showProgress($thisStep = 1, int $totalSteps = 10)
{
Expand Down Expand Up @@ -859,6 +879,8 @@ public static function wrap(?string $string = null, int $max = 0, int $padLeft =
/**
* Parses the command line it was called from and collects all
* options and valid segments.
*
* @return void
*/
protected static function parseCommandLine()
{
Expand Down Expand Up @@ -998,6 +1020,8 @@ public static function getOptionString(bool $useLongOpts = false, bool $trim = f
*
* @param array $tbody List of rows
* @param array $thead List of columns
*
* @return void
*/
public static function table(array $tbody, array $thead = [])
{
Expand Down Expand Up @@ -1096,6 +1120,8 @@ public static function table(array $tbody, array $thead = [])
* solution down the road.
*
* @param resource $handle
*
* @return void
*/
protected static function fwrite($handle, string $string)
{
Expand Down
2 changes: 2 additions & 0 deletions system/CLI/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public function getCommands()
/**
* Discovers all commands in the framework and within user code,
* and collects instances of them to work with.
*
* @return void
*/
public function discoverCommands()
{
Expand Down
2 changes: 2 additions & 0 deletions system/CLI/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function run()

/**
* Displays basic information about the Console.
*
* @return void
*/
public function showHeader(bool $suppress = false)
{
Expand Down