Skip to content

Commit 13a55f3

Browse files
committed
Add missing types
Signed-off-by: ADmad <[email protected]>
1 parent 746db20 commit 13a55f3

File tree

6 files changed

+13
-27
lines changed

6 files changed

+13
-27
lines changed

src/MessageTrait.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,20 @@ trait MessageTrait
3030
/**
3131
* List of all registered headers, as key => array of values.
3232
*
33-
* @var array
3433
* @psalm-var array<non-empty-string, list<string>>
3534
*/
36-
protected $headers = [];
35+
protected array $headers = [];
3736

3837
/**
3938
* Map of normalized header name to original name used to register header.
4039
*
41-
* @var array
4240
* @psalm-var array<non-empty-string, non-empty-string>
4341
*/
44-
protected $headerNames = [];
42+
protected array $headerNames = [];
4543

46-
/** @var string */
47-
private $protocol = '1.1';
44+
private string $protocol = '1.1';
4845

49-
/** @var StreamInterface */
50-
private $stream;
46+
private StreamInterface $stream;
5147

5248
/**
5349
* Retrieves the HTTP protocol version as a string.

src/Request/ArraySerializer.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,9 @@ public static function fromArray(array $serializedRequest): Request
7070
}
7171

7272
/**
73-
* @return mixed
7473
* @throws Exception\DeserializationException
7574
*/
76-
private static function getValueFromKey(array $data, string $key, ?string $message = null)
75+
private static function getValueFromKey(array $data, string $key, ?string $message = null): mixed
7776
{
7877
if (isset($data[$key])) {
7978
return $data[$key];

src/RequestTrait.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,14 @@ trait RequestTrait
2828
{
2929
use MessageTrait;
3030

31-
/** @var string */
32-
private $method = 'GET';
31+
private string $method = 'GET';
3332

3433
/**
3534
* The request-target, if it has been provided or calculated.
36-
*
37-
* @var null|string
3835
*/
39-
private $requestTarget;
36+
private ?string $requestTarget = null;
4037

41-
/** @var UriInterface */
42-
private $uri;
38+
private UriInterface $uri;
4339

4440
/**
4541
* Initialize request state.

src/Response/ArraySerializer.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ public static function fromArray(array $serializedResponse): Response
6868
}
6969

7070
/**
71-
* @return mixed
7271
* @throws Exception\DeserializationException
7372
*/
74-
private static function getValueFromKey(array $data, string $key, ?string $message = null)
73+
private static function getValueFromKey(array $data, string $key, ?string $message = null): mixed
7574
{
7675
if (isset($data[$key])) {
7776
return $data[$key];

src/Response/JsonResponse.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class JsonResponse extends Response
4343
| JSON_HEX_QUOT
4444
| JSON_UNESCAPED_SLASHES;
4545

46-
/** @var mixed */
47-
private $payload;
46+
private mixed $payload;
4847

4948
/**
5049
* Create a JSON response with the given data.
@@ -65,7 +64,7 @@ class JsonResponse extends Response
6564
* @throws Exception\InvalidArgumentException If unable to encode the $data to JSON.
6665
*/
6766
public function __construct(
68-
$data,
67+
mixed $data,
6968
int $status = 200,
7069
array $headers = [],
7170
private int $encodingOptions = self::DEFAULT_JSON_FLAGS
@@ -80,10 +79,7 @@ public function __construct(
8079
parent::__construct($body, $status, $headers);
8180
}
8281

83-
/**
84-
* @return mixed
85-
*/
86-
public function getPayload()
82+
public function getPayload(): mixed
8783
{
8884
return $this->payload;
8985
}

src/Uri.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Uri implements UriInterface, Stringable
5353
public const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~\pL';
5454

5555
/** @var int[] Array indexed by valid scheme names to their corresponding ports. */
56-
protected $allowedSchemes = [
56+
protected array $allowedSchemes = [
5757
'http' => 80,
5858
'https' => 443,
5959
];

0 commit comments

Comments
 (0)