Skip to content

Commit 310d6b8

Browse files
committed
Merge branch 'master' into 9.x
2 parents ea35c47 + 0c5d04c commit 310d6b8

40 files changed

+69
-187
lines changed

src/Helpers/Artisan/BackgroundCommand.php

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,29 @@ class BackgroundCommand
99
{
1010
/**
1111
* The artisan command.
12-
*
13-
* @var string
1412
*/
15-
private $command;
13+
private string $command;
1614

1715
/**
1816
* The command which should be executed before.
19-
*
20-
* @var string
2117
*/
22-
private $before;
18+
private string $before;
2319

2420
/**
2521
* The command which should be executed after.
26-
*
27-
* @var string
2822
*/
29-
private $after;
23+
private string $after;
3024

3125
/**
3226
* Create background command by the given parameters.
33-
*
34-
* @param string $command
35-
* @param string $before
36-
* @param string $after
37-
* @return \Illuminated\Helpers\Artisan\BackgroundCommand
3827
*/
39-
public static function factory(string $command, string $before = '', string $after = '')
28+
public static function factory(string $command, string $before = '', string $after = ''): self
4029
{
4130
return new self($command, $before, $after);
4231
}
4332

4433
/**
4534
* Create a new instance of the background command.
46-
*
47-
* @param string $command
48-
* @param string $before
49-
* @param string $after
50-
* @return void
5135
*/
5236
public function __construct(string $command, string $before = '', string $after = '')
5337
{
@@ -58,10 +42,8 @@ public function __construct(string $command, string $before = '', string $after
5842

5943
/**
6044
* Run the command in background.
61-
*
62-
* @return void
6345
*/
64-
public function run()
46+
public function run(): void
6547
{
6648
$command = $this->composeCommand();
6749

@@ -74,10 +56,8 @@ public function run()
7456

7557
/**
7658
* Compose the command.
77-
*
78-
* @return string
7959
*/
80-
protected function composeCommand()
60+
protected function composeCommand(): string
8161
{
8262
return collect()
8363
->when($this->before, function (Collection $collection) {
@@ -92,20 +72,16 @@ protected function composeCommand()
9272

9373
/**
9474
* Get the path to PHP executable.
95-
*
96-
* @return string
9775
*/
98-
protected function getPhpExecutable()
76+
protected function getPhpExecutable(): string
9977
{
10078
return (new PhpExecutableFinder)->find();
10179
}
10280

10381
/**
10482
* Get the path to artisan.
105-
*
106-
* @return string
10783
*/
108-
protected function getArtisan()
84+
protected function getArtisan(): string
10985
{
11086
return defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan';
11187
}

src/Helpers/System/OS.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ class OS
66
{
77
/**
88
* Check whether the operating system is Windows or not.
9-
*
10-
* @return bool
119
*/
12-
public static function isWindows()
10+
public static function isWindows(): bool
1311
{
1412
return stripos(php_uname(), 'windows') === 0;
1513
}

src/array.php

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
if (!function_exists('array_except_value')) {
66
/**
77
* Remove the given values from the array.
8-
*
9-
* @param array $array
10-
* @param mixed $except
11-
* @return array
128
*/
13-
function array_except_value(array $array, $except)
9+
function array_except_value(array $array, mixed $except): array
1410
{
1511
if (!is_array($except)) {
1612
$except = [$except];
@@ -27,13 +23,8 @@ function array_except_value(array $array, $except)
2723
if (!function_exists('multiarray_set')) {
2824
/**
2925
* Set the value for each item of the multidimensional array using "dot" notation.
30-
*
31-
* @param array $multiarray
32-
* @param mixed $key
33-
* @param mixed $value
34-
* @return array
3526
*/
36-
function multiarray_set(array &$multiarray, $key, $value)
27+
function multiarray_set(array &$multiarray, mixed $key, mixed $value): array
3728
{
3829
foreach ($multiarray as &$array) {
3930
Arr::set($array, $key, $value);
@@ -48,14 +39,8 @@ function multiarray_set(array &$multiarray, $key, $value)
4839
* Sort the multidimensional array by several fields.
4940
*
5041
* Use either SORT_ASC or SORT_DESC for `sort` arguments.
51-
*
52-
* @param array $multiarray
53-
* @param string $field1
54-
* @param int $sort1
55-
* @param null $_
56-
* @return array
5742
*/
58-
function multiarray_sort_by(array $multiarray, $field1 = null, $sort1 = null, $_ = null)
43+
function multiarray_sort_by(array $multiarray, mixed $field1 = null, mixed $sort1 = null, mixed $_ = null): array
5944
{
6045
$arguments = collect(func_get_args());
6146

src/artisan.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@
77
* Call the given artisan console command in background.
88
*
99
* Code execution continues immediately, without waiting for results.
10-
*
11-
* @param string $command
12-
* @param string $before
13-
* @param string $after
14-
* @return void
1510
*/
16-
function call_in_background(string $command, string $before = '', string $after = '')
11+
function call_in_background(string $command, string $before = '', string $after = ''): void
1712
{
1813
BackgroundCommand::factory($command, $before, $after)->run();
1914
}

src/date.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
if (!function_exists('to_default_timezone')) {
77
/**
88
* Convert the given datetime to the default timezone (see `app.timezone` config).
9-
*
10-
* @param mixed $datetime
11-
* @return mixed
129
*/
13-
function to_default_timezone($datetime)
10+
function to_default_timezone(mixed $datetime): mixed
1411
{
1512
return empty($datetime)
1613
? $datetime

src/db.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
if (!function_exists('db_is_sqlite')) {
77
/**
88
* Check whether the default database connection driver is `sqlite` or not.
9-
*
10-
* @return bool
119
*/
12-
function db_is_sqlite()
10+
function db_is_sqlite(): bool
1311
{
1412
$connection = DB::getDefaultConnection();
1513

@@ -20,10 +18,8 @@ function db_is_sqlite()
2018
if (!function_exists('db_is_mysql')) {
2119
/**
2220
* Check whether the default database connection driver is `mysql` or not.
23-
*
24-
* @return bool
2521
*/
26-
function db_is_mysql()
22+
function db_is_mysql(): bool
2723
{
2824
$connection = DB::getDefaultConnection();
2925

@@ -34,10 +30,8 @@ function db_is_mysql()
3430
if (!function_exists('db_mysql_now')) {
3531
/**
3632
* Get the current MySQL datetime.
37-
*
38-
* @return string
3933
*/
40-
function db_mysql_now()
34+
function db_mysql_now(): string
4135
{
4236
return DB::selectOne('select now() as now')->now;
4337
}
@@ -46,11 +40,8 @@ function db_mysql_now()
4640
if (!function_exists('db_mysql_variable')) {
4741
/**
4842
* Get value of the specified MySQL variable.
49-
*
50-
* @param string $name
51-
* @return string|false
5243
*/
53-
function db_mysql_variable(string $name)
44+
function db_mysql_variable(string $name): string|false
5445
{
5546
return DB::selectOne('show variables where variable_name = ?', [$name])->Value ?? false;
5647
}

src/debug.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
if (!function_exists('backtrace_as_string')) {
44
/**
55
* Get backtrace without arguments, as a string.
6-
*
7-
* @return string
86
*/
9-
function backtrace_as_string()
7+
function backtrace_as_string(): string
108
{
119
ob_start();
1210

@@ -19,10 +17,8 @@ function backtrace_as_string()
1917
if (!function_exists('minimized_backtrace_as_string')) {
2018
/**
2119
* Get minimized backtrace, as a string.
22-
*
23-
* @return string
2420
*/
25-
function minimized_backtrace_as_string()
21+
function minimized_backtrace_as_string(): string
2622
{
2723
$backtrace = explode("\n", backtrace_as_string());
2824

src/filesystem.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
if (!function_exists('relative_path')) {
66
/**
77
* Get a relative path for the given folders.
8-
*
9-
* @param string $to
10-
* @param string $from
11-
* @return string
128
*/
13-
function relative_path(string $to, string $from)
9+
function relative_path(string $to, string $from): string
1410
{
1511
return (new Filesystem)->makePathRelative(realpath($to), realpath($from));
1612
}

src/format.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
* Get a nicely formatted string representation of the variable, using the Symfony VarDumper Component.
99
*
1010
* @see https://symfony.com/doc/current/components/var_dumper/introduction.html
11-
*
12-
* @param mixed $var
13-
* @return string
1411
*/
15-
function get_dump($var)
12+
function get_dump(mixed $var): string
1613
{
1714
$cloner = new VarCloner();
1815
$cloner->setMaxItems(-1);
@@ -35,12 +32,8 @@ function get_dump($var)
3532
if (!function_exists('format_bytes')) {
3633
/**
3734
* Format bytes into kilobytes, megabytes, gigabytes or terabytes.
38-
*
39-
* @param int $bytes
40-
* @param int $precision
41-
* @return string
4235
*/
43-
function format_bytes(int $bytes, int $precision = 2)
36+
function format_bytes(int $bytes, int $precision = 2): string
4437
{
4538
$units = ['B', 'KB', 'MB', 'GB', 'TB'];
4639

@@ -56,11 +49,8 @@ function format_bytes(int $bytes, int $precision = 2)
5649
if (!function_exists('format_xml')) {
5750
/**
5851
* Format the given XML string using new lines and indents.
59-
*
60-
* @param string $xml
61-
* @return string
6252
*/
63-
function format_xml(string $xml)
53+
function format_xml(string $xml): string
6454
{
6555
$dom = dom_import_simplexml(new SimpleXMLElement($xml))->ownerDocument;
6656

src/json.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
if (!function_exists('is_json')) {
44
/**
55
* Check whether the given value is a valid JSON-encoded string or not.
6-
*
7-
* @param mixed $value
8-
* @param bool $return
9-
* @return bool|array
106
*/
11-
function is_json($value, bool $return = false)
7+
function is_json(mixed $value, bool $return = false): array|bool
128
{
139
if (empty($value) || !is_string($value)) {
1410
return false;

0 commit comments

Comments
 (0)