From: Jeremy Benoist Date: Wed, 7 Jun 2017 21:23:34 +0000 (+0200) Subject: CS X-Git-Tag: 2.3.0~31^2~64^2~1 X-Git-Url: https://git.immae.eu/?p=github%2Fwallabag%2Fwallabag.git;a=commitdiff_plain;h=eb570e49c8e3ba12638fac600bb5527191c2aaa2 CS --- diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php index 5c75846f..aba76ca7 100644 --- a/src/Wallabag/UserBundle/Entity/User.php +++ b/src/Wallabag/UserBundle/Entity/User.php @@ -110,6 +110,8 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf private $trusted; /** + * @var ArrayCollection + * * @ORM\OneToMany(targetEntity="Wallabag\ApiBundle\Entity\Client", mappedBy="user", cascade={"remove"}) */ protected $clients; @@ -306,10 +308,8 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf */ public function getFirstClient() { - if (empty($this->clients)) { - return $this->clients; + if (!empty($this->clients)) { + return $this->clients->first(); } - - return $this->clients->first(); } } diff --git a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php index 8f87ccf3..3c94382c 100644 --- a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php +++ b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php @@ -85,7 +85,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase 'text' => 'my annotation', 'quote' => 'my quote', 'ranges' => [ - ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31] + ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], ], ]); $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); @@ -130,7 +130,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase 'text' => 'my annotation', 'quote' => $longQuote, 'ranges' => [ - ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31] + ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], ], ]); $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); diff --git a/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php b/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php index 3b928d1e..c0a4acfa 100644 --- a/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php @@ -4,10 +4,8 @@ namespace Tests\Wallabag\CoreBundle\Command; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Wallabag\CoreBundle\Command\CleanDuplicatesCommand; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Wallabag\CoreBundle\Command\ShowUserCommand; -use Wallabag\CoreBundle\Entity\Entry; use Wallabag\UserBundle\Entity\User; class ShowUserCommandTest extends WallabagCoreTestCase