Skip to content

Commit 9c5f6a7

Browse files
committed
fix: Apply suggestion
1 parent 8393661 commit 9c5f6a7

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

system/HTTP/Parameters/InputParameters.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
/**
2020
* @template TKey of string
21-
* @template TValue of bool|float|int|string|array<int|string, mixed>
21+
* @template TValue of scalar|array<(int|string), mixed>
2222
*
2323
* @see \CodeIgniter\HTTP\Parameters\InputParametersTest
2424
*/
@@ -33,7 +33,7 @@ public function override(array $parameters = []): void
3333
}
3434
}
3535

36-
public function get(string $key, $default = null)
36+
public function get(string $key, mixed $default = null)
3737
{
3838
if ($default !== null && ! is_scalar($default)) {
3939
throw new InvalidArgumentException(sprintf('The default value for the InputParameters must be a scalar type, "%s" given.', gettype($default)));
@@ -51,7 +51,7 @@ public function get(string $key, $default = null)
5151
return $value === $tempDefault ? $default : $value;
5252
}
5353

54-
public function set(string $key, $value): void
54+
public function set(string $key, mixed $value): void
5555
{
5656
if (! is_scalar($value) && ! is_array($value)) {
5757
throw new InvalidArgumentException(sprintf('The value for the InputParameters must be a scalar type, "%s" given.', gettype($value)));

system/HTTP/Parameters/Parameters.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
/**
2020
* @template TKey of string
21-
* @template TValue of mixed
21+
* @template TValue
2222
*
2323
* @property array<TKey, TValue> $parameters
2424
*
@@ -41,12 +41,12 @@ public function has(string $key): bool
4141
return array_key_exists($key, $this->parameters);
4242
}
4343

44-
public function get(string $key, $default = null)
44+
public function get(string $key, mixed $default = null)
4545
{
4646
return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default;
4747
}
4848

49-
public function set(string $key, $value): void
49+
public function set(string $key, mixed $value): void
5050
{
5151
$this->parameters[$key] = $value;
5252
}

system/HTTP/Parameters/ParametersInterface.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
/**
2020
* @template TKey of string
21-
* @template TValue of mixed
21+
* @template TValue
22+
*
23+
* @extends IteratorAggregate<TKey, TValue>
2224
*/
2325
interface ParametersInterface extends IteratorAggregate, Countable
2426
{
@@ -41,15 +43,15 @@ public function has(string $key): bool;
4143
* @param TKey $key
4244
* @param TValue $default
4345
*
44-
* @return ?TValue
46+
* @return TValue|null
4547
*/
46-
public function get(string $key, $default = null);
48+
public function get(string $key, mixed $default = null);
4749

4850
/**
4951
* @param TKey $key
5052
* @param TValue $value
5153
*/
52-
public function set(string $key, $value): void;
54+
public function set(string $key, mixed $value): void;
5355

5456
/**
5557
* @param TKey $key
@@ -59,7 +61,7 @@ public function set(string $key, $value): void;
5961
public function all(?string $key = null): array;
6062

6163
/**
62-
* @return array<int, TKey>
64+
* @return list<TKey>
6365
*/
6466
public function keys(): array;
6567
}

system/HTTP/Parameters/ServerParameters.php

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313

1414
namespace CodeIgniter\HTTP\Parameters;
1515

16+
/**
17+
* @template TKey of string
18+
* @template TValue
19+
*
20+
* @extends Parameters<TKey, TValue>
21+
*/
1622
class ServerParameters extends Parameters
1723
{
1824
}

0 commit comments

Comments
 (0)