Check non-null type for numeric type

$maxAge and $sharedAge can both be zero
This commit is contained in:
Arman Hosseini 2020-01-02 00:53:08 +03:30 committed by GitHub
parent 8e9aafc84f
commit 2797867ae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -75,17 +75,17 @@ class TemplateController implements ContainerAwareInterface
throw new \LogicException('You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.');
}
if ($maxAge) {
if (null !== $maxAge) {
$response->setMaxAge($maxAge);
}
if ($sharedAge) {
if (null !== $sharedAge) {
$response->setSharedMaxAge($sharedAge);
}
if ($private) {
$response->setPrivate();
} elseif (false === $private || (null === $private && ($maxAge || $sharedAge))) {
} elseif (false === $private || (null === $private && (null !== $maxAge || null !== $sharedAge))) {
$response->setPublic();
}