Skip to content

Commit 99c5f7b

Browse files
committed
feat: document language-level parameter and return type declarations
This patch adds section 7.2 to the metadocument, detailing the (proposed) changes to the specification to use explicit, language-level parameter and return type declarations. It documents the addition of parameter type declarations for the 1.1 release, the addition of return type declarations for 2.0, and how implementations may adopt one or both versions. It also documents and links to the (forthcoming) package releases within the primary document, detailing the changes in brief. The format follows that of the already accepted PSR-13 evolution proposal.
1 parent da346b1 commit 99c5f7b

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

accepted/PSR-7-http-message-meta.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,4 +690,23 @@ be normalized to a single SPACE (0x20).
690690
Further characters or sequences in header values should be rejected according
691691
to the HTTP specification.
692692

693+
### 7.2 Type Additions
694+
695+
The 1.1 release of the `psr/http-message` package includes scalar parameter types.
696+
The 2.0 release of the package includes return types.
697+
This structure leverages PHP 7.2 covariance support to allow for a gradual upgrade process, but requires PHP 8.0 for type compatibility.
698+
699+
Implementers MAY add return types to their own packages at their discretion, provided that:
700+
701+
* the return types match those in the 2.0 package.
702+
* the implementation specifies a minimum PHP version of 8.0.0 or later.
703+
704+
Implementers MAY add parameter types to their own packages in a new major release, either at the same time as adding return types or in a subsequent release, provided that:
705+
706+
* the parameter types match those in the 1.1 package.
707+
* the implementation specifies a minimum PHP version of 8.0.0 or later.
708+
* the implementation depends on `"psr/http-message": "^1.1 || ^2.0"` so as to exclude the untyped 1.0 version.
709+
710+
Implementers are encouraged but not required to transition their packages toward the 2.0 version of the package at their earliest convenience.
711+
693712
[1]: https://datatracker.ietf.org/doc/html/rfc7230#section-3.2

accepted/PSR-7-http-message.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,3 +1903,6 @@ interface UploadedFileInterface
19031903
public function getClientMediaType();
19041904
}
19051905
```
1906+
1907+
Since [psr/http-message version 1.1](https://packagist.org/packages/psr/http-message#1.1.0), the above interfaces have been updated to add argument type hints.
1908+
Since [psr/http-message version 2.0](https://packagist.org/packages/psr/http-message#2.0.0), the above interfaces have been updated to add return type hints.

0 commit comments

Comments
 (0)