From 4094ea47712efbe58624ff74daeb1f77c9b0edcf Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 12 Apr 2016 11:36:01 +0200 Subject: Convert array + phpDoc Thanks for https://github.com/thomasbachem/php-short-array-syntax-converter --- .../Controller/WallabagAnnotationController.php | 4 ++-- .../Tests/Controller/AnnotationControllerTest.php | 26 +++++++++++----------- .../Tests/WallabagAnnotationTestCase.php | 6 ++--- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/Wallabag/AnnotationBundle') diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php index 5f981eb5..ad083e31 100644 --- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php +++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php @@ -30,7 +30,7 @@ class WallabagAnnotationController extends FOSRestController ->getRepository('WallabagAnnotationBundle:Annotation') ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); $total = count($annotationRows); - $annotations = array('total' => $total, 'rows' => $annotationRows); + $annotations = ['total' => $total, 'rows' => $annotationRows]; $json = $this->get('serializer')->serialize($annotations, 'json'); @@ -141,6 +141,6 @@ class WallabagAnnotationController extends FOSRestController */ private function renderJsonResponse($json, $code = 200) { - return new Response($json, $code, array('application/json')); + return new Response($json, $code, ['application/json']); } } diff --git a/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php b/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php index e972c2de..3eba7193 100644 --- a/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php +++ b/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php @@ -35,13 +35,13 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase ->getRepository('WallabagCoreBundle:Entry') ->findOneByUsernameAndNotArchived('admin'); - $headers = array('CONTENT_TYPE' => 'application/json'); - $content = json_encode(array( + $headers = ['CONTENT_TYPE' => 'application/json']; + $content = json_encode([ 'text' => 'my annotation', 'quote' => 'my quote', - 'ranges' => array('start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31), - )); - $crawler = $this->client->request('POST', 'annotations/'.$entry->getId().'.json', array(), array(), $headers, $content); + 'ranges' => ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], + ]); + $crawler = $this->client->request('POST', 'annotations/'.$entry->getId().'.json', [], [], $headers, $content); $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); @@ -69,11 +69,11 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $this->logInAs('admin'); - $headers = array('CONTENT_TYPE' => 'application/json'); - $content = json_encode(array( + $headers = ['CONTENT_TYPE' => 'application/json']; + $content = json_encode([ 'text' => 'a modified annotation', - )); - $crawler = $this->client->request('PUT', 'annotations/'.$annotation->getId().'.json', array(), array(), $headers, $content); + ]); + $crawler = $this->client->request('PUT', 'annotations/'.$annotation->getId().'.json', [], [], $headers, $content); $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); @@ -99,11 +99,11 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $this->logInAs('admin'); - $headers = array('CONTENT_TYPE' => 'application/json'); - $content = json_encode(array( + $headers = ['CONTENT_TYPE' => 'application/json']; + $content = json_encode([ 'text' => 'a modified annotation', - )); - $crawler = $this->client->request('DELETE', 'annotations/'.$annotation->getId().'.json', array(), array(), $headers, $content); + ]); + $crawler = $this->client->request('DELETE', 'annotations/'.$annotation->getId().'.json', [], [], $headers, $content); $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); diff --git a/src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php b/src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php index 2deff6bf..a9035acc 100644 --- a/src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php +++ b/src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php @@ -26,10 +26,10 @@ abstract class WallabagAnnotationTestCase extends WebTestCase { $crawler = $this->client->request('GET', '/login'); $form = $crawler->filter('button[type=submit]')->form(); - $data = array( + $data = [ '_username' => $username, '_password' => 'mypassword', - ); + ]; $this->client->submit($form, $data); } @@ -48,7 +48,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase $loginManager = $container->get('fos_user.security.login_manager'); $firewallName = $container->getParameter('fos_user.firewall_name'); - $this->user = $userManager->findUserBy(array('username' => 'admin')); + $this->user = $userManager->findUserBy(['username' => 'admin']); $loginManager->loginUser($firewallName, $this->user); // save the login token into the session and put it in a cookie -- cgit v1.2.3