Skip to content

Commit

Permalink
Check non-null type for numeric type
Browse files Browse the repository at this point in the history
$maxAge and $sharedAge can both be zero
  • Loading branch information
Arman-Hosseini committed Jan 1, 2020
1 parent 8e9aafc commit 2797867
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -75,17 +75,17 @@ public function templateAction($template, $maxAge = null, $sharedAge = null, $pr
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();
}

Expand Down

0 comments on commit 2797867

Please sign in to comment.