]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
CS
authorJeremy Benoist <jeremy.benoist@gmail.com>
Wed, 7 Jun 2017 21:23:34 +0000 (23:23 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Wed, 7 Jun 2017 21:31:14 +0000 (23:31 +0200)
src/Wallabag/UserBundle/Entity/User.php
tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php

index 5c75846f85993f8bf677fa0110bee9516400f9bf..aba76ca74a262e3ddcc83b90d26519a0af151d2d 100644 (file)
@@ -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();
     }
 }
index 8f87ccf3f40b9a23b2ab467db05391e570f64794..3c94382cef6ce6acee0cc655ac4f0045c7ff4bca 100644 (file)
@@ -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);
index 3b928d1e17be11290a13c5d3ca4c0684f96b2747..c0a4acfaa62b994ca2eafe96cfac4ae73cecc1ce 100644 (file)
@@ -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