Skip to content

Commit cf9f5f8

Browse files
committed
- chore: replace alias join function with implode
1 parent 7f19d84 commit cf9f5f8

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

Config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
use function file_get_contents;
2121
use function getcwd;
2222
use function getenv;
23+
use function implode;
2324
use function is_a;
2425
use function is_string;
2526
use function iterator_to_array;
26-
use function join;
2727
use function json_decode;
2828
use function parse_ini_file;
2929
use function parse_ini_string;
@@ -181,7 +181,7 @@ public function fromEnvironment(
181181
$value = getenv($variable);
182182
$data[] = $variable . '=' . (false === $value ? 'null' : $value);
183183
}
184-
$data = parse_ini_string(join(PHP_EOL, $data), true, INI_SCANNER_TYPED) ?: [];
184+
$data = parse_ini_string(implode(PHP_EOL, $data), true, INI_SCANNER_TYPED) ?: [];
185185
$this->import($this->filter($data, $namespace, $lowercase, $trim));
186186
return $this;
187187
}

ExtendedArguments.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
use function array_push;
1818
use function array_slice;
1919
use function explode;
20+
use function implode;
2021
use function is_array;
2122
use function is_string;
22-
use function join;
2323
use function str_contains;
2424

2525
/**
@@ -132,7 +132,7 @@ public function flatten(): static
132132
foreach ($iterator as $index => $value) {
133133
$indexes[$iterator->getDepth()] = $index;
134134
if (false === is_array($value)) {
135-
$_ = join('.', array_slice($indexes, 0, $iterator->getDepth() + 1));
135+
$_ = implode('.', array_slice($indexes, 0, $iterator->getDepth() + 1));
136136
$flatten[$_] = $value;
137137
}
138138
}

functions.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
use function date_create_immutable;
2727
use function getenv;
2828
use function htmlentities;
29-
use function join;
29+
use function implode;
3030
use function ord;
3131
use function preg_replace;
3232
use function preg_split;
@@ -78,16 +78,16 @@ function value(...$values): Data
7878
}
7979

8080
/**
81-
* Do something with an object or array inside the callable,
82-
* and return that value.
81+
* Do something with the $value (an object, array)
82+
* inside the callable, and return that value.
8383
*
8484
* @param mixed $value The value that is tapped into the callback
8585
* @param callable|null $callable Callback that can modify the value
8686
* @return mixed The tapped value
8787
*/
88-
function tap(mixed $value, callable $callable = null): mixed
88+
function tap(mixed $value, callable|null $callable = null): mixed
8989
{
90-
if (false === is_null($callable)) {
90+
if ($callable) {
9191
$callable($value);
9292
return $value;
9393
}
@@ -103,7 +103,7 @@ public function __call($method, $arguments) {
103103
}
104104

105105
/**
106-
* Transforms simple CamelCaseName into camel_case_name (lower case underscored).
106+
* Transforms CamelCaseName string into camel_case_name (lower case, underscored).
107107
*
108108
* @param string $string CamelCase string to be underscored
109109
* @return string Transformed string (for weird strings, you get what you deserve)
@@ -129,8 +129,8 @@ function error_log(string $func, string $message, mixed $data): void
129129
/**
130130
* Gets or sets environment variables.
131131
*
132-
* @param string|null $name
133-
* @param string [optional] $name The name of the env variable
132+
* @param string|null $name The name of the env variable
133+
* @param string|null $default The default value (NULL if not provided)
134134
* @param array|null $initialState
135135
* @return mixed The value for the env variable,
136136
* or all variables if $name is not provided
@@ -291,7 +291,7 @@ function snake_to_camel_case(string $string): string
291291
function to_delimited_string(string $string, int $delimiter): string
292292
{
293293
$str = preg_split('~[^\p{L}\p{N}\']+~u', trim($string));
294-
return join(chr($delimiter), $str);
294+
return implode(chr($delimiter), $str);
295295
}
296296

297297
/**
@@ -320,7 +320,7 @@ function xml_serialize(string $root, iterable $data): string
320320
/**
321321
* Unserialize an XML document into PHP array.
322322
* This function does not deal with magical conversions
323-
* of complicated XML structures.
323+
* of complicated XML documents.
324324
*
325325
* @param string $xml The XML document to be decoded into array
326326
* @return array Decoded version of the XML string,

semver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function get_complete_version(array $version): array
6363
{
6464
if (empty($version)) {
6565
$version = match (true) {
66-
defined('VERSION') && is_array(VERSION) => get_version_array(join('-', array_filter(VERSION))),
66+
defined('VERSION') && is_array(VERSION) => get_version_array(implode('-', array_filter(VERSION))),
6767
is_file($version = __DIR__ . '/../../../VERSION'), // project dir relative to /vendor
6868
is_file($version = getcwd() . '/VERSION') => get_version_array(@file_get_contents($version)),
6969
// @codeCoverageIgnoreStart

0 commit comments

Comments
 (0)