Skip to content

Commit 797fe80

Browse files
authored
Fix nullable types for PHP 8.4 #9
2 parents 3233c54 + 23ecfc8 commit 797fe80

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/ArrayReader.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function createFromArray(array $data = []): self
4747
*
4848
* @return int The value
4949
*/
50-
public function getInt(string $key, int $default = null): int
50+
public function getInt(string $key, ?int $default = null): int
5151
{
5252
$value = $this->find($key, $default);
5353

@@ -66,7 +66,7 @@ public function getInt(string $key, int $default = null): int
6666
*
6767
* @return int|null The value
6868
*/
69-
public function findInt(string $key, int $default = null): ?int
69+
public function findInt(string $key, ?int $default = null): ?int
7070
{
7171
$value = $this->find($key, $default);
7272

@@ -87,7 +87,7 @@ public function findInt(string $key, int $default = null): ?int
8787
*
8888
* @return string The value
8989
*/
90-
public function getString(string $key, string $default = null): string
90+
public function getString(string $key, ?string $default = null): string
9191
{
9292
$value = $this->find($key, $default);
9393

@@ -106,7 +106,7 @@ public function getString(string $key, string $default = null): string
106106
*
107107
* @return string|null The value
108108
*/
109-
public function findString(string $key, string $default = null): ?string
109+
public function findString(string $key, ?string $default = null): ?string
110110
{
111111
$value = $this->find($key, $default);
112112

@@ -127,7 +127,7 @@ public function findString(string $key, string $default = null): ?string
127127
*
128128
* @return array<mixed> The value
129129
*/
130-
public function getArray(string $key, array $default = null): array
130+
public function getArray(string $key, ?array $default = null): array
131131
{
132132
$value = $this->find($key, $default);
133133

@@ -146,7 +146,7 @@ public function getArray(string $key, array $default = null): array
146146
*
147147
* @return array<mixed>|null The value
148148
*/
149-
public function findArray(string $key, array $default = null): ?array
149+
public function findArray(string $key, ?array $default = null): ?array
150150
{
151151
$value = $this->find($key, $default);
152152

@@ -167,7 +167,7 @@ public function findArray(string $key, array $default = null): ?array
167167
*
168168
* @return float The value
169169
*/
170-
public function getFloat(string $key, float $default = null): float
170+
public function getFloat(string $key, ?float $default = null): float
171171
{
172172
$value = $this->find($key, $default);
173173

@@ -186,7 +186,7 @@ public function getFloat(string $key, float $default = null): float
186186
*
187187
* @return float|null The value
188188
*/
189-
public function findFloat(string $key, float $default = null): ?float
189+
public function findFloat(string $key, ?float $default = null): ?float
190190
{
191191
$value = $this->find($key, $default);
192192

@@ -207,7 +207,7 @@ public function findFloat(string $key, float $default = null): ?float
207207
*
208208
* @return bool The value
209209
*/
210-
public function getBool(string $key, bool $default = null): bool
210+
public function getBool(string $key, ?bool $default = null): bool
211211
{
212212
$value = $this->find($key, $default);
213213

@@ -226,7 +226,7 @@ public function getBool(string $key, bool $default = null): bool
226226
*
227227
* @return bool|null The value
228228
*/
229-
public function findBool(string $key, bool $default = null): ?bool
229+
public function findBool(string $key, ?bool $default = null): ?bool
230230
{
231231
$value = $this->find($key, $default);
232232

@@ -247,7 +247,7 @@ public function findBool(string $key, bool $default = null): ?bool
247247
*
248248
* @return Chronos The value
249249
*/
250-
public function getChronos(string $key, Chronos $default = null): Chronos
250+
public function getChronos(string $key, ?Chronos $default = null): Chronos
251251
{
252252
$value = $this->find($key, $default);
253253

@@ -270,7 +270,7 @@ public function getChronos(string $key, Chronos $default = null): Chronos
270270
*
271271
* @return Chronos|null The value
272272
*/
273-
public function findChronos(string $key, Chronos $default = null): ?Chronos
273+
public function findChronos(string $key, ?Chronos $default = null): ?Chronos
274274
{
275275
$value = $this->find($key, $default);
276276

0 commit comments

Comments
 (0)