Returned 0 instead of returning empty array for Twig Extension

This commit is contained in:
Nicolas Lœuillet 2016-09-05 14:17:44 +02:00
parent a1d22ea7d0
commit 5173fd1c3d
No known key found for this signature in database
GPG Key ID: 5656BE27E1E34D0A

View File

@ -54,7 +54,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
if (null === $user || !is_object($user)) { if (null === $user || !is_object($user)) {
return []; return 0;
} }
switch ($type) { switch ($type) {
@ -101,7 +101,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
if (null === $user || !is_object($user)) { if (null === $user || !is_object($user)) {
return []; return 0;
} }
$qb = $this->tagRepository->findAllTags($user->getId()); $qb = $this->tagRepository->findAllTags($user->getId());