Skip to content

Commit 1ee9256

Browse files
committed
- fix: implicitly nullable parameter type updated with explicit type
1 parent c99cc26 commit 1ee9256

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Exceptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ class KodedException extends RuntimeException
3434
* defined by $code in the child classes are ignored
3535
* @param Throwable|null $previous [optional] The previous throwable used for the exception chaining
3636
*/
37-
public function __construct(int $code, array $arguments = [], Throwable $previous = null)
37+
public function __construct(int $code, array $arguments = [], ?Throwable $previous = null)
3838
{
3939
$message = $arguments['message'] ?? $this->messages[$code] ?? $this->message;
4040
parent::__construct(strtr($message, $arguments), $code, $previous);
4141
}
4242

43-
public static function generic(string $message, Throwable $previous = null): static
43+
public static function generic(string $message, ?Throwable $previous = null): static
4444
{
4545
return new static(Data::E_PHP_EXCEPTION, [':message' => $message], $previous);
4646
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ putenv('MY_APP_SETTINGS=/path/to/config/file.php');
128128
### `UUID`
129129
Class UUID generates `Universally Unique Identifiers` following the [RFC 4122][rfc-4122].
130130

131-
- `v1($address = null): string`
131+
- `v1(string|null $address = null): string`
132132
- `v3(string $namespace, $name): string`
133133
- `v4(): string`
134134
- `v5(string $namespace, string $name): string`
@@ -159,7 +159,7 @@ function extended(...$values): ExtendedArguments;
159159
function value(...$values): Data;
160160
function tap(mixed $value, callable|null $callable = null): mixed;
161161
function camel_to_snake_case(string $string): string;
162-
function env(string $name = null, mixed $default = null, array $initialState = null): mixed;
162+
function env(string|null $name = null, mixed $default = null, array|null $initialState = null): mixed;
163163
function error_log(string $function, string $message, $data): void;
164164
function htmlencode(string $input, string $encoding = 'UTF-8'): string;
165165
function is_associative(array $array): bool;

UUID.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static function matches(string $uuid, int $version = 4): bool
169169
*
170170
* @return string UUID v1
171171
*/
172-
public static function v1(string|int $address = null): string
172+
public static function v1(string|int|null $address = null): string
173173
{
174174
static $node, $clockSeq, $lastTimestamp;
175175

@@ -208,7 +208,7 @@ public static function v1(string|int $address = null): string
208208
* @param string|int|null $address [optional]
209209
* @return string
210210
*/
211-
$nodeIdentifier = static function(string|int $address = null) use ($fetchAddress): string {
211+
$nodeIdentifier = static function(string|int|null $address = null) use ($fetchAddress): string {
212212
$address = null !== $address
213213
? str_replace([':', '-', '.'], '', (string)$address)
214214
: $fetchAddress();

functions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ function error_log(string $func, string $message, mixed $data): void
136136
* or all variables if $name is not provided
137137
*/
138138
function env(
139-
string $name = null,
140-
mixed $default = null,
141-
array $initialState = null): mixed
139+
string|null $name = null,
140+
mixed $default = null,
141+
array|null $initialState = null): mixed
142142
{
143143
static $state = [];
144144
if (null !== $initialState) {

0 commit comments

Comments
 (0)