Skip to content

Commit 2d5a1d2

Browse files
committed
Improve types
1 parent c7d231d commit 2d5a1d2

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

src/HttpWorker.php

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
* @psalm-import-type CookiesList from Request
2222
*
2323
* @psalm-type RequestContext = array {
24-
* remoteAddr?: string,
25-
* protocol?: string,
26-
* method?: string,
27-
* uri?: string,
28-
* attributes?: AttributesList,
29-
* headers?: HeadersList,
30-
* cookies?: CookiesList,
31-
* uploads?: UploadedFilesList|null,
32-
* rawQuery?: string,
33-
* parsed?: string|null
24+
* remoteAddr: string,
25+
* protocol: string,
26+
* method: string,
27+
* uri: string,
28+
* attributes: AttributesList,
29+
* headers: HeadersList,
30+
* cookies: CookiesList,
31+
* uploads: UploadedFilesList|null,
32+
* rawQuery: string,
33+
* parsed: bool
3434
* }
3535
*
3636
* @see Request
@@ -113,17 +113,10 @@ private function createRequest(string $body, array $context): Request
113113
* @param RequestContext $context
114114
*
115115
* @psalm-suppress InaccessibleProperty
116-
* @psalm-suppress PossiblyUndefinedArrayOffset
117116
* @psalm-suppress MixedPropertyTypeCoercion
118117
*/
119118
private function hydrateRequest(Request $request, array $context): void
120119
{
121-
assert(\is_string($context['remoteAddr'] ?? null), 'Missing remote address context argument');
122-
assert(\is_string($context['protocol'] ?? null), 'Missing protocol context argument');
123-
assert(\is_string($context['method'] ?? null), 'Missing method context argument');
124-
assert(\is_string($context['uri'] ?? null), 'Missing uri context argument');
125-
assert(\is_string($context['rawQuery'] ?? null), 'Missing rawQuery context argument');
126-
127120
$request->remoteAddr = $context['remoteAddr'];
128121
$request->protocol = $context['protocol'];
129122
$request->method = $context['method'];

0 commit comments

Comments
 (0)