Skip to content

Commit 8639a87

Browse files
authored
Merge pull request #1321 from alexandre-daubois/psr-17-explicit-nullable
Add explicit nullable types to PSR-17
2 parents 416ef0e + 796564d commit 8639a87

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

accepted/PSR-17-http-factory-meta.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,17 @@ _**Note:** Order descending chronologically._
306306
- [shadowhand Dependency Inversion and PSR-7 Bodies](http://shadowhand.me/dependency-inversion-and-psr-7-bodies/)
307307
- [PHP-FIG mailing list thread discussing factories](https://groups.google.com/d/msg/php-fig/G5pgQfQ9fpA/UWeM1gm1CwAJ)
308308
- [PHP-FIG mailing list thread feedback on proposal](https://groups.google.com/d/msg/php-fig/piRtB2Z-AZs/8UIwY1RtDgAJ)
309+
310+
## 9. Errata
311+
312+
### 9.1 Use of explicit nullable type
313+
314+
Prior to PHP 8.4, it was allowed to declare a type accepting `null` by omitting
315+
the nullable part of the type if the default value of the property or parameter
316+
was set to null. This implicit type declaration is now deprecated and all
317+
types should be declared explicitly.
318+
319+
This change also requires the minimum PHP version required by this PSR to
320+
be updated to 7.1, as nullable types were introduced in this version. Apart
321+
from this change, no breaking change is introduced by this update and the
322+
behavior of the interfaces remains the same.

accepted/PSR-17-http-factory.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,17 @@ interface UploadedFileFactoryInterface
188188
*/
189189
public function createUploadedFile(
190190
StreamInterface $stream,
191-
int $size = null,
191+
?int $size = null,
192192
int $error = \UPLOAD_ERR_OK,
193-
string $clientFilename = null,
194-
string $clientMediaType = null
193+
?string $clientFilename = null,
194+
?string $clientMediaType = null
195195
): UploadedFileInterface;
196196
}
197197
```
198198

199+
Since [psr/http-factory version 1.1](https://packagist.org/packages/psr/http-factory#1.1.0),
200+
the above interface has been updated to add explicit nullable types.
201+
199202
### 2.6 UriFactoryInterface
200203

201204
Has the ability to create URIs for client and server requests.

0 commit comments

Comments
 (0)