Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for psr/http-message 2.x #56

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"require": {
"php": "^7.2 || ^8.0",
"psr/http-message": "^1.0",
"psr/http-message": "^1.1 || ^2.0",
"psr/http-server-middleware": "^1.0"
},
"require-dev": {
Expand Down
3 changes: 1 addition & 2 deletions src/CacheProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use function gmdate;
use function in_array;
use function is_integer;
use function is_null;
use function strtotime;
use function time;

Expand Down Expand Up @@ -43,7 +42,7 @@ public function allowCache(
}
$headerValue = $type;
if ($maxAge || is_integer($maxAge)) {
if (!is_integer($maxAge) && !is_null($maxAge)) {
if (!is_integer($maxAge) && $maxAge !== null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line relevant for the new version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not changed, the static analysis (performed by composer test) fails

$maxAge = strtotime($maxAge) - time();
}
$headerValue = $headerValue.', max-age='.$maxAge;
Expand Down