diff --git a/src/MessageTrait.php b/src/MessageTrait.php index e95d072a..87cd267a 100644 --- a/src/MessageTrait.php +++ b/src/MessageTrait.php @@ -30,24 +30,20 @@ trait MessageTrait /** * List of all registered headers, as key => array of values. * - * @var array * @psalm-var array> */ - protected $headers = []; + protected array $headers = []; /** * Map of normalized header name to original name used to register header. * - * @var array * @psalm-var array */ - protected $headerNames = []; + protected array $headerNames = []; - /** @var string */ - private $protocol = '1.1'; + private string $protocol = '1.1'; - /** @var StreamInterface */ - private $stream; + private StreamInterface $stream; /** * Retrieves the HTTP protocol version as a string. diff --git a/src/Request/ArraySerializer.php b/src/Request/ArraySerializer.php index e3c10485..58fe17e4 100644 --- a/src/Request/ArraySerializer.php +++ b/src/Request/ArraySerializer.php @@ -70,10 +70,9 @@ public static function fromArray(array $serializedRequest): Request } /** - * @return mixed * @throws Exception\DeserializationException */ - private static function getValueFromKey(array $data, string $key, ?string $message = null) + private static function getValueFromKey(array $data, string $key, ?string $message = null): mixed { if (isset($data[$key])) { return $data[$key]; diff --git a/src/RequestTrait.php b/src/RequestTrait.php index e8519a36..3717ee9b 100644 --- a/src/RequestTrait.php +++ b/src/RequestTrait.php @@ -28,18 +28,14 @@ trait RequestTrait { use MessageTrait; - /** @var string */ - private $method = 'GET'; + private string $method = 'GET'; /** * The request-target, if it has been provided or calculated. - * - * @var null|string */ - private $requestTarget; + private ?string $requestTarget = null; - /** @var UriInterface */ - private $uri; + private UriInterface $uri; /** * Initialize request state. diff --git a/src/Response/ArraySerializer.php b/src/Response/ArraySerializer.php index 0828e798..ddbf17bc 100644 --- a/src/Response/ArraySerializer.php +++ b/src/Response/ArraySerializer.php @@ -68,10 +68,9 @@ public static function fromArray(array $serializedResponse): Response } /** - * @return mixed * @throws Exception\DeserializationException */ - private static function getValueFromKey(array $data, string $key, ?string $message = null) + private static function getValueFromKey(array $data, string $key, ?string $message = null): mixed { if (isset($data[$key])) { return $data[$key]; diff --git a/src/Response/JsonResponse.php b/src/Response/JsonResponse.php index f570a0a0..96fc6b21 100644 --- a/src/Response/JsonResponse.php +++ b/src/Response/JsonResponse.php @@ -43,8 +43,7 @@ class JsonResponse extends Response | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES; - /** @var mixed */ - private $payload; + private mixed $payload; /** * Create a JSON response with the given data. @@ -65,7 +64,7 @@ class JsonResponse extends Response * @throws Exception\InvalidArgumentException If unable to encode the $data to JSON. */ public function __construct( - $data, + mixed $data, int $status = 200, array $headers = [], private int $encodingOptions = self::DEFAULT_JSON_FLAGS @@ -80,10 +79,7 @@ public function __construct( parent::__construct($body, $status, $headers); } - /** - * @return mixed - */ - public function getPayload() + public function getPayload(): mixed { return $this->payload; } diff --git a/src/Uri.php b/src/Uri.php index 0c35fdc6..51afbfff 100644 --- a/src/Uri.php +++ b/src/Uri.php @@ -53,7 +53,7 @@ class Uri implements UriInterface, Stringable public const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~\pL'; /** @var int[] Array indexed by valid scheme names to their corresponding ports. */ - protected $allowedSchemes = [ + protected array $allowedSchemes = [ 'http' => 80, 'https' => 443, ];