Skip to content

Commit 30d1347

Browse files
authored
Merge pull request #1296 from weierophinney/feature/psr-7-type-hints
Add errata for addition of parameter and return type declarations to PSR-7 Accepted by votes in thread https://groups.google.com/g/php-fig/c/O9YaSCH3jI4
2 parents da346b1 + 2b99fb2 commit 30d1347

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 declarations.
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 declarations.

0 commit comments

Comments
 (0)