Skip to content

Commit f844008

Browse files
committed
chore: larastan ci
1 parent 167d1fe commit f844008

File tree

3 files changed

+22
-31
lines changed

3 files changed

+22
-31
lines changed

Diff for: app/Console/Commands/GitUpdater.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ class GitUpdater extends Command
8282
/**
8383
* Path to the log file.
8484
*
85-
* @var string|null
85+
* @var string
8686
*/
87-
private ?string $logFile;
87+
private string $logFile;
8888

8989
/**
9090
* Execute the console command.

Diff for: app/Console/ConsoleTools.php

+20-11
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public function success(string $message): void
7474
/**
7575
* Display an error message.
7676
*
77-
* @param string|array $string
78-
* @param int|string|null $verbosity
77+
* @param string|array<string> $string
78+
* @param int|string|null $verbosity
7979
*/
8080
public function error($string, $verbosity = null): void
8181
{
@@ -91,8 +91,8 @@ public function error($string, $verbosity = null): void
9191
/**
9292
* Display an info message.
9393
*
94-
* @param string|array $string
95-
* @param int|string|null $verbosity
94+
* @param string|array<string> $string
95+
* @param int|string|null $verbosity
9696
*/
9797
public function info($string, $verbosity = null): void
9898
{
@@ -176,6 +176,8 @@ protected function execCommand(string $command, bool $silent = false): Process
176176

177177
/**
178178
* Execute multiple shell commands.
179+
*
180+
* @param array<string> $commands
179181
*/
180182
protected function execCommands(array $commands, bool $silent = false): void
181183
{
@@ -206,8 +208,8 @@ protected function createProgressBar(): ProgressBar
206208
/**
207209
* Display a stylized alert box.
208210
*
209-
* @param string|array $string
210-
* @param int|string|null $verbosity
211+
* @param string|array<string> $string
212+
* @param int|string|null $verbosity
211213
*/
212214
public function alert($string, $verbosity = null): void
213215
{
@@ -228,14 +230,21 @@ public function alert($string, $verbosity = null): void
228230

229231
/**
230232
* Render a stylized alert box with type detection.
233+
*
234+
* @param string $message The message to display
235+
* @param string|null $type Optional alert type (success, error, warning, info)
231236
*/
232-
protected function renderAlert(string $message): void
237+
protected function renderAlert(string $message, ?string $type = null): void
233238
{
234-
$type = 'info';
239+
if ($type === null) {
240+
$detectedType = 'info';
241+
242+
if (preg_match('/^(success|error|warning|info):/i', $message, $matches)) {
243+
$detectedType = strtolower($matches[1]);
244+
$message = trim(substr($message, \strlen($matches[1]) + 1));
245+
}
235246

236-
if (preg_match('/^(success|error|warning|info):/i', $message, $matches)) {
237-
$type = strtolower($matches[1]);
238-
$message = trim(substr($message, \strlen($matches[1]) + 1));
247+
$type = $detectedType;
239248
}
240249

241250
$style = match ($type) {

Diff for: phpstan-baseline.neon

-18
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,6 @@ parameters:
7272
count: 1
7373
path: app/Console/Commands/AutoWarning.php
7474

75-
-
76-
message: '#^Call to function is_countable\(\) with array\<string\> will always evaluate to true\.$#'
77-
identifier: function.alreadyNarrowedType
78-
count: 1
79-
path: app/Console/Commands/GitUpdater.php
80-
81-
-
82-
message: '#^Method App\\Console\\Commands\\GitUpdater\:\:commands\(\) has parameter \$commands with no value type specified in iterable type array\.$#'
83-
identifier: missingType.iterableValue
84-
count: 1
85-
path: app/Console/Commands/GitUpdater.php
86-
87-
-
88-
message: '#^Method App\\Console\\Commands\\GitUpdater\:\:manualUpdate\(\) has parameter \$updating with no value type specified in iterable type array\.$#'
89-
identifier: missingType.iterableValue
90-
count: 1
91-
path: app/Console/Commands/GitUpdater.php
92-
9375
-
9476
message: '#^Parameter \#2 \$callback of function array_filter expects \(callable\(string\)\: bool\)\|null, ''strlen'' given\.$#'
9577
identifier: argument.type

0 commit comments

Comments
 (0)