Skip to content

Commit

Permalink
Merge pull request #1321 from alexandre-daubois/psr-17-explicit-nullable
Browse files Browse the repository at this point in the history
Add explicit nullable types to PSR-17
  • Loading branch information
Jean85 committed May 10, 2024
2 parents 416ef0e + 796564d commit 8639a87
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
14 changes: 14 additions & 0 deletions accepted/PSR-17-http-factory-meta.md
Expand Up @@ -306,3 +306,17 @@ _**Note:** Order descending chronologically._
- [shadowhand Dependency Inversion and PSR-7 Bodies](http://shadowhand.me/dependency-inversion-and-psr-7-bodies/)
- [PHP-FIG mailing list thread discussing factories](https://groups.google.com/d/msg/php-fig/G5pgQfQ9fpA/UWeM1gm1CwAJ)
- [PHP-FIG mailing list thread feedback on proposal](https://groups.google.com/d/msg/php-fig/piRtB2Z-AZs/8UIwY1RtDgAJ)

## 9. Errata

### 9.1 Use of explicit nullable type

Prior to PHP 8.4, it was allowed to declare a type accepting `null` by omitting
the nullable part of the type if the default value of the property or parameter
was set to null. This implicit type declaration is now deprecated and all
types should be declared explicitly.

This change also requires the minimum PHP version required by this PSR to
be updated to 7.1, as nullable types were introduced in this version. Apart
from this change, no breaking change is introduced by this update and the
behavior of the interfaces remains the same.
9 changes: 6 additions & 3 deletions accepted/PSR-17-http-factory.md
Expand Up @@ -188,14 +188,17 @@ interface UploadedFileFactoryInterface
*/
public function createUploadedFile(
StreamInterface $stream,
int $size = null,
?int $size = null,
int $error = \UPLOAD_ERR_OK,
string $clientFilename = null,
string $clientMediaType = null
?string $clientFilename = null,
?string $clientMediaType = null
): UploadedFileInterface;
}
```

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

### 2.6 UriFactoryInterface

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

0 comments on commit 8639a87

Please sign in to comment.