Skip to content

Commit fb2fc30

Browse files
authored
Add phpdoc to classes' constructors (#36)
1 parent 8081e54 commit fb2fc30

File tree

6 files changed

+46
-28
lines changed

6 files changed

+46
-28
lines changed

src/Request.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ final class Request implements RequestInterface
1313
use RequestTrait;
1414

1515
/**
16-
* @param string $method
17-
* @param UriInterface|string $uri
18-
* @param array $headers
19-
* @param StreamInterface|string|resource|null $body
20-
* @param string $protocol
16+
* @param string $method The HTTP method.
17+
* @param UriInterface|string $uri The URI to request.
18+
* @param array $headers The headers to send with the request.
19+
* @param StreamInterface|string|resource|null $body The body of the request. Must be one of the following:
20+
* - an instance of `StreamInterface`;
21+
* - a string stream identifier (e.g., 'php://temp') or a file path;
22+
* - a valid stream resource;
23+
* - `null`.
24+
* @param string $protocol The HTTP protocol version.
2125
*/
2226
public function __construct(
2327
string $method = 'GET',

src/Response.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ final class Response implements ResponseInterface
1212
use ResponseTrait;
1313

1414
/**
15-
* @param int $statusCode
16-
* @param array $headers
17-
* @param StreamInterface|string|resource|null $body
18-
* @param string $protocol
19-
* @param string $reasonPhrase
15+
* @param int $statusCode The HTTP status code.
16+
* @param array $headers The headers to send with the response.
17+
* @param StreamInterface|string|resource|null $body The body of the response. Must be one of the following:
18+
* - an instance of `StreamInterface`;
19+
* - a string stream identifier (e.g., 'php://temp') or a file path;
20+
* - a valid stream resource;
21+
* - `null`.
22+
* @param string $protocol The HTTP protocol version.
23+
* @param string $reasonPhrase The reason phrase associated with the status code.
2024
*/
2125
public function __construct(
2226
int $statusCode = 200,

src/ServerRequest.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,21 @@ final class ServerRequest implements ServerRequestInterface
5252
private array $uploadedFiles;
5353

5454
/**
55-
* @param array $serverParams
56-
* @param array $uploadedFiles
57-
* @param array $cookieParams
58-
* @param array $queryParams
59-
* @param array|object|null $parsedBody
60-
* @param string $method
61-
* @param UriInterface|string $uri
62-
* @param array $headers
63-
* @param StreamInterface|string|resource|null $body
64-
* @param string $protocol
55+
* @param array $serverParams The server parameters.
56+
* @param array $uploadedFiles The array of uploaded files, each being an instance of `UploadedFileInterface`.
57+
* Nested arrays are allowed.
58+
* @param array $cookieParams The cookie parameters.
59+
* @param array $queryParams The query parameters.
60+
* @param array|object|null $parsedBody The parsed body.
61+
* @param string $method The HTTP method.
62+
* @param UriInterface|string $uri The URI to request.
63+
* @param array $headers The headers to send with the request.
64+
* @param StreamInterface|string|resource|null $body The body of the request. Must be one of the following:
65+
* - an instance of `StreamInterface`;
66+
* - a string stream identifier (e.g., 'php://temp') or a file path;
67+
* - a valid stream resource;
68+
* - `null`.
69+
* @param string $protocol The HTTP protocol version.
6570
*/
6671
public function __construct(
6772
array $serverParams = [],

src/Stream.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ final class Stream implements StreamInterface
1111
use StreamTrait;
1212

1313
/**
14-
* @param string|resource $stream
15-
* @param string $mode
14+
* @param string|resource $stream The stream to use. Must be one of the following:
15+
* - a string stream identifier (e.g., 'php://temp') or a file path;
16+
* - a valid stream resource.
17+
* @param string $mode The mode in which to open the stream.
1618
*/
1719
public function __construct($stream = 'php://temp', string $mode = 'wb+')
1820
{

src/UploadedFile.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,14 @@ final class UploadedFile implements UploadedFileInterface
9292
private bool $isMoved = false;
9393

9494
/**
95-
* @param StreamInterface|string|resource $streamOrFile
96-
* @param int $size
97-
* @param int $error
98-
* @param string|null $clientFilename
99-
* @param string|null $clientMediaType
95+
* @param StreamInterface|string|resource $streamOrFile The file to upload. Must be one of the following:
96+
* - an instance of `StreamInterface`;
97+
* - a string stream identifier (e.g., 'php://temp') or a file path;
98+
* - a valid stream resource.
99+
* @param int $size The size of the uploaded file.
100+
* @param int $error The error code.
101+
* @param string|null $clientFilename Client filename.
102+
* @param string|null $clientMediaType Client media type.
100103
* @psalm-suppress DocblockTypeContradiction
101104
* @psalm-suppress RedundantConditionGivenDocblockType
102105
*/

src/Uri.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ final class Uri implements UriInterface
7272
private ?string $cache = null;
7373

7474
/**
75-
* @param string $uri
75+
* @param string $uri The URI string to parse.
7676
*/
7777
public function __construct(string $uri = '')
7878
{

0 commit comments

Comments
 (0)