diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-04-12 11:36:01 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-04-12 12:25:29 +0200 |
commit | 4094ea47712efbe58624ff74daeb1f77c9b0edcf (patch) | |
tree | 3d2c168092d0208e6ba888de969252a54bf0c6c1 /src | |
parent | 7eccbda99f16dc39ee01a0c81ab88293e9b268fd (diff) | |
download | wallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.tar.gz wallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.tar.zst wallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.zip |
Convert array + phpDoc
Thanks for https://github.com/thomasbachem/php-short-array-syntax-converter
Diffstat (limited to 'src')
61 files changed, 599 insertions, 561 deletions
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 | |||
30 | ->getRepository('WallabagAnnotationBundle:Annotation') | 30 | ->getRepository('WallabagAnnotationBundle:Annotation') |
31 | ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); | 31 | ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); |
32 | $total = count($annotationRows); | 32 | $total = count($annotationRows); |
33 | $annotations = array('total' => $total, 'rows' => $annotationRows); | 33 | $annotations = ['total' => $total, 'rows' => $annotationRows]; |
34 | 34 | ||
35 | $json = $this->get('serializer')->serialize($annotations, 'json'); | 35 | $json = $this->get('serializer')->serialize($annotations, 'json'); |
36 | 36 | ||
@@ -141,6 +141,6 @@ class WallabagAnnotationController extends FOSRestController | |||
141 | */ | 141 | */ |
142 | private function renderJsonResponse($json, $code = 200) | 142 | private function renderJsonResponse($json, $code = 200) |
143 | { | 143 | { |
144 | return new Response($json, $code, array('application/json')); | 144 | return new Response($json, $code, ['application/json']); |
145 | } | 145 | } |
146 | } | 146 | } |
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 | |||
35 | ->getRepository('WallabagCoreBundle:Entry') | 35 | ->getRepository('WallabagCoreBundle:Entry') |
36 | ->findOneByUsernameAndNotArchived('admin'); | 36 | ->findOneByUsernameAndNotArchived('admin'); |
37 | 37 | ||
38 | $headers = array('CONTENT_TYPE' => 'application/json'); | 38 | $headers = ['CONTENT_TYPE' => 'application/json']; |
39 | $content = json_encode(array( | 39 | $content = json_encode([ |
40 | 'text' => 'my annotation', | 40 | 'text' => 'my annotation', |
41 | 'quote' => 'my quote', | 41 | 'quote' => 'my quote', |
42 | 'ranges' => array('start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31), | 42 | 'ranges' => ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], |
43 | )); | 43 | ]); |
44 | $crawler = $this->client->request('POST', 'annotations/'.$entry->getId().'.json', array(), array(), $headers, $content); | 44 | $crawler = $this->client->request('POST', 'annotations/'.$entry->getId().'.json', [], [], $headers, $content); |
45 | 45 | ||
46 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 46 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
47 | 47 | ||
@@ -69,11 +69,11 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase | |||
69 | 69 | ||
70 | $this->logInAs('admin'); | 70 | $this->logInAs('admin'); |
71 | 71 | ||
72 | $headers = array('CONTENT_TYPE' => 'application/json'); | 72 | $headers = ['CONTENT_TYPE' => 'application/json']; |
73 | $content = json_encode(array( | 73 | $content = json_encode([ |
74 | 'text' => 'a modified annotation', | 74 | 'text' => 'a modified annotation', |
75 | )); | 75 | ]); |
76 | $crawler = $this->client->request('PUT', 'annotations/'.$annotation->getId().'.json', array(), array(), $headers, $content); | 76 | $crawler = $this->client->request('PUT', 'annotations/'.$annotation->getId().'.json', [], [], $headers, $content); |
77 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 77 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
78 | 78 | ||
79 | $content = json_decode($this->client->getResponse()->getContent(), true); | 79 | $content = json_decode($this->client->getResponse()->getContent(), true); |
@@ -99,11 +99,11 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase | |||
99 | 99 | ||
100 | $this->logInAs('admin'); | 100 | $this->logInAs('admin'); |
101 | 101 | ||
102 | $headers = array('CONTENT_TYPE' => 'application/json'); | 102 | $headers = ['CONTENT_TYPE' => 'application/json']; |
103 | $content = json_encode(array( | 103 | $content = json_encode([ |
104 | 'text' => 'a modified annotation', | 104 | 'text' => 'a modified annotation', |
105 | )); | 105 | ]); |
106 | $crawler = $this->client->request('DELETE', 'annotations/'.$annotation->getId().'.json', array(), array(), $headers, $content); | 106 | $crawler = $this->client->request('DELETE', 'annotations/'.$annotation->getId().'.json', [], [], $headers, $content); |
107 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 107 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
108 | 108 | ||
109 | $content = json_decode($this->client->getResponse()->getContent(), true); | 109 | $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 | |||
26 | { | 26 | { |
27 | $crawler = $this->client->request('GET', '/login'); | 27 | $crawler = $this->client->request('GET', '/login'); |
28 | $form = $crawler->filter('button[type=submit]')->form(); | 28 | $form = $crawler->filter('button[type=submit]')->form(); |
29 | $data = array( | 29 | $data = [ |
30 | '_username' => $username, | 30 | '_username' => $username, |
31 | '_password' => 'mypassword', | 31 | '_password' => 'mypassword', |
32 | ); | 32 | ]; |
33 | 33 | ||
34 | $this->client->submit($form, $data); | 34 | $this->client->submit($form, $data); |
35 | } | 35 | } |
@@ -48,7 +48,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase | |||
48 | $loginManager = $container->get('fos_user.security.login_manager'); | 48 | $loginManager = $container->get('fos_user.security.login_manager'); |
49 | $firewallName = $container->getParameter('fos_user.firewall_name'); | 49 | $firewallName = $container->getParameter('fos_user.firewall_name'); |
50 | 50 | ||
51 | $this->user = $userManager->findUserBy(array('username' => 'admin')); | 51 | $this->user = $userManager->findUserBy(['username' => 'admin']); |
52 | $loginManager->loginUser($firewallName, $this->user); | 52 | $loginManager->loginUser($firewallName, $this->user); |
53 | 53 | ||
54 | // save the login token into the session and put it in a cookie | 54 | // save the login token into the session and put it in a cookie |
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index da671a61..316d45be 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php | |||
@@ -384,6 +384,6 @@ class WallabagRestController extends FOSRestController | |||
384 | */ | 384 | */ |
385 | private function renderJsonResponse($json) | 385 | private function renderJsonResponse($json) |
386 | { | 386 | { |
387 | return new Response($json, 200, array('application/json')); | 387 | return new Response($json, 200, ['application/json']); |
388 | } | 388 | } |
389 | } | 389 | } |
diff --git a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php index 04875f29..839ff386 100644 --- a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php +++ b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php | |||
@@ -13,7 +13,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
13 | $entry = $this->client->getContainer() | 13 | $entry = $this->client->getContainer() |
14 | ->get('doctrine.orm.entity_manager') | 14 | ->get('doctrine.orm.entity_manager') |
15 | ->getRepository('WallabagCoreBundle:Entry') | 15 | ->getRepository('WallabagCoreBundle:Entry') |
16 | ->findOneBy(array('user' => 1, 'isArchived' => false)); | 16 | ->findOneBy(['user' => 1, 'isArchived' => false]); |
17 | 17 | ||
18 | if (!$entry) { | 18 | if (!$entry) { |
19 | $this->markTestSkipped('No content found in db.'); | 19 | $this->markTestSkipped('No content found in db.'); |
@@ -44,7 +44,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
44 | $entry = $this->client->getContainer() | 44 | $entry = $this->client->getContainer() |
45 | ->get('doctrine.orm.entity_manager') | 45 | ->get('doctrine.orm.entity_manager') |
46 | ->getRepository('WallabagCoreBundle:Entry') | 46 | ->getRepository('WallabagCoreBundle:Entry') |
47 | ->findOneBy(array('user' => 2, 'isArchived' => false)); | 47 | ->findOneBy(['user' => 2, 'isArchived' => false]); |
48 | 48 | ||
49 | if (!$entry) { | 49 | if (!$entry) { |
50 | $this->markTestSkipped('No content found in db.'); | 50 | $this->markTestSkipped('No content found in db.'); |
@@ -79,7 +79,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
79 | 79 | ||
80 | public function testGetStarredEntries() | 80 | public function testGetStarredEntries() |
81 | { | 81 | { |
82 | $this->client->request('GET', '/api/entries', array('star' => 1, 'sort' => 'updated')); | 82 | $this->client->request('GET', '/api/entries', ['star' => 1, 'sort' => 'updated']); |
83 | 83 | ||
84 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 84 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
85 | 85 | ||
@@ -101,7 +101,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
101 | 101 | ||
102 | public function testGetArchiveEntries() | 102 | public function testGetArchiveEntries() |
103 | { | 103 | { |
104 | $this->client->request('GET', '/api/entries', array('archive' => 1)); | 104 | $this->client->request('GET', '/api/entries', ['archive' => 1]); |
105 | 105 | ||
106 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 106 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
107 | 107 | ||
@@ -149,10 +149,10 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
149 | 149 | ||
150 | public function testPostEntry() | 150 | public function testPostEntry() |
151 | { | 151 | { |
152 | $this->client->request('POST', '/api/entries.json', array( | 152 | $this->client->request('POST', '/api/entries.json', [ |
153 | 'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', | 153 | 'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', |
154 | 'tags' => 'google', | 154 | 'tags' => 'google', |
155 | )); | 155 | ]); |
156 | 156 | ||
157 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 157 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
158 | 158 | ||
@@ -168,11 +168,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
168 | 168 | ||
169 | public function testPostSameEntry() | 169 | public function testPostSameEntry() |
170 | { | 170 | { |
171 | $this->client->request('POST', '/api/entries.json', array( | 171 | $this->client->request('POST', '/api/entries.json', [ |
172 | 'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', | 172 | 'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', |
173 | 'archive' => '1', | 173 | 'archive' => '1', |
174 | 'tags' => 'google, apple', | 174 | 'tags' => 'google, apple', |
175 | )); | 175 | ]); |
176 | 176 | ||
177 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 177 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
178 | 178 | ||
@@ -187,11 +187,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
187 | 187 | ||
188 | public function testPostArchivedAndStarredEntry() | 188 | public function testPostArchivedAndStarredEntry() |
189 | { | 189 | { |
190 | $this->client->request('POST', '/api/entries.json', array( | 190 | $this->client->request('POST', '/api/entries.json', [ |
191 | 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', | 191 | 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', |
192 | 'archive' => '1', | 192 | 'archive' => '1', |
193 | 'starred' => '1', | 193 | 'starred' => '1', |
194 | )); | 194 | ]); |
195 | 195 | ||
196 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 196 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
197 | 197 | ||
@@ -206,11 +206,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
206 | 206 | ||
207 | public function testPostArchivedAndStarredEntryWithoutQuotes() | 207 | public function testPostArchivedAndStarredEntryWithoutQuotes() |
208 | { | 208 | { |
209 | $this->client->request('POST', '/api/entries.json', array( | 209 | $this->client->request('POST', '/api/entries.json', [ |
210 | 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', | 210 | 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', |
211 | 'archive' => 0, | 211 | 'archive' => 0, |
212 | 'starred' => 1, | 212 | 'starred' => 1, |
213 | )); | 213 | ]); |
214 | 214 | ||
215 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 215 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
216 | 216 | ||
@@ -236,12 +236,12 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
236 | // hydrate the tags relations | 236 | // hydrate the tags relations |
237 | $nbTags = count($entry->getTags()); | 237 | $nbTags = count($entry->getTags()); |
238 | 238 | ||
239 | $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', array( | 239 | $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ |
240 | 'title' => 'New awesome title', | 240 | 'title' => 'New awesome title', |
241 | 'tags' => 'new tag '.uniqid(), | 241 | 'tags' => 'new tag '.uniqid(), |
242 | 'starred' => '1', | 242 | 'starred' => '1', |
243 | 'archive' => '0', | 243 | 'archive' => '0', |
244 | )); | 244 | ]); |
245 | 245 | ||
246 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 246 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
247 | 247 | ||
@@ -268,12 +268,12 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
268 | // hydrate the tags relations | 268 | // hydrate the tags relations |
269 | $nbTags = count($entry->getTags()); | 269 | $nbTags = count($entry->getTags()); |
270 | 270 | ||
271 | $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', array( | 271 | $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ |
272 | 'title' => 'New awesome title', | 272 | 'title' => 'New awesome title', |
273 | 'tags' => 'new tag '.uniqid(), | 273 | 'tags' => 'new tag '.uniqid(), |
274 | 'starred' => 1, | 274 | 'starred' => 1, |
275 | 'archive' => 0, | 275 | 'archive' => 0, |
276 | )); | 276 | ]); |
277 | 277 | ||
278 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 278 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
279 | 279 | ||
@@ -298,9 +298,9 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
298 | $this->markTestSkipped('No content found in db.'); | 298 | $this->markTestSkipped('No content found in db.'); |
299 | } | 299 | } |
300 | 300 | ||
301 | $tags = array(); | 301 | $tags = []; |
302 | foreach ($entry->getTags() as $tag) { | 302 | foreach ($entry->getTags() as $tag) { |
303 | $tags[] = array('id' => $tag->getId(), 'label' => $tag->getLabel(), 'slug' => $tag->getSlug()); | 303 | $tags[] = ['id' => $tag->getId(), 'label' => $tag->getLabel(), 'slug' => $tag->getSlug()]; |
304 | } | 304 | } |
305 | 305 | ||
306 | $this->client->request('GET', '/api/entries/'.$entry->getId().'/tags'); | 306 | $this->client->request('GET', '/api/entries/'.$entry->getId().'/tags'); |
@@ -323,7 +323,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
323 | 323 | ||
324 | $newTags = 'tag1,tag2,tag3'; | 324 | $newTags = 'tag1,tag2,tag3'; |
325 | 325 | ||
326 | $this->client->request('POST', '/api/entries/'.$entry->getId().'/tags', array('tags' => $newTags)); | 326 | $this->client->request('POST', '/api/entries/'.$entry->getId().'/tags', ['tags' => $newTags]); |
327 | 327 | ||
328 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 328 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
329 | 329 | ||
@@ -337,7 +337,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
337 | ->getRepository('WallabagCoreBundle:Entry') | 337 | ->getRepository('WallabagCoreBundle:Entry') |
338 | ->find($entry->getId()); | 338 | ->find($entry->getId()); |
339 | 339 | ||
340 | $tagsInDB = array(); | 340 | $tagsInDB = []; |
341 | foreach ($entryDB->getTags()->toArray() as $tag) { | 341 | foreach ($entryDB->getTags()->toArray() as $tag) { |
342 | $tagsInDB[$tag->getId()] = $tag->getLabel(); | 342 | $tagsInDB[$tag->getId()] = $tag->getLabel(); |
343 | } | 343 | } |
diff --git a/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php b/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php index a415c749..13d72d2c 100644 --- a/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php +++ b/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php | |||
@@ -36,7 +36,7 @@ abstract class WallabagApiTestCase extends WebTestCase | |||
36 | $loginManager = $container->get('fos_user.security.login_manager'); | 36 | $loginManager = $container->get('fos_user.security.login_manager'); |
37 | $firewallName = $container->getParameter('fos_user.firewall_name'); | 37 | $firewallName = $container->getParameter('fos_user.firewall_name'); |
38 | 38 | ||
39 | $this->user = $userManager->findUserBy(array('username' => 'admin')); | 39 | $this->user = $userManager->findUserBy(['username' => 'admin']); |
40 | $loginManager->loginUser($firewallName, $this->user); | 40 | $loginManager->loginUser($firewallName, $this->user); |
41 | 41 | ||
42 | // save the login token into the session and put it in a cookie | 42 | // save the login token into the session and put it in a cookie |
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 779be268..ccc3e8a1 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -32,7 +32,7 @@ class ConfigController extends Controller | |||
32 | $user = $this->getUser(); | 32 | $user = $this->getUser(); |
33 | 33 | ||
34 | // handle basic config detail (this form is defined as a service) | 34 | // handle basic config detail (this form is defined as a service) |
35 | $configForm = $this->createForm(ConfigType::class, $config, array('action' => $this->generateUrl('config'))); | 35 | $configForm = $this->createForm(ConfigType::class, $config, ['action' => $this->generateUrl('config')]); |
36 | $configForm->handleRequest($request); | 36 | $configForm->handleRequest($request); |
37 | 37 | ||
38 | if ($configForm->isValid()) { | 38 | if ($configForm->isValid()) { |
@@ -52,7 +52,7 @@ class ConfigController extends Controller | |||
52 | } | 52 | } |
53 | 53 | ||
54 | // handle changing password | 54 | // handle changing password |
55 | $pwdForm = $this->createForm(ChangePasswordType::class, null, array('action' => $this->generateUrl('config').'#set4')); | 55 | $pwdForm = $this->createForm(ChangePasswordType::class, null, ['action' => $this->generateUrl('config').'#set4']); |
56 | $pwdForm->handleRequest($request); | 56 | $pwdForm->handleRequest($request); |
57 | 57 | ||
58 | if ($pwdForm->isValid()) { | 58 | if ($pwdForm->isValid()) { |
@@ -71,10 +71,10 @@ class ConfigController extends Controller | |||
71 | } | 71 | } |
72 | 72 | ||
73 | // handle changing user information | 73 | // handle changing user information |
74 | $userForm = $this->createForm(UserInformationType::class, $user, array( | 74 | $userForm = $this->createForm(UserInformationType::class, $user, [ |
75 | 'validation_groups' => array('Profile'), | 75 | 'validation_groups' => ['Profile'], |
76 | 'action' => $this->generateUrl('config').'#set3', | 76 | 'action' => $this->generateUrl('config').'#set3', |
77 | )); | 77 | ]); |
78 | $userForm->handleRequest($request); | 78 | $userForm->handleRequest($request); |
79 | 79 | ||
80 | if ($userForm->isValid()) { | 80 | if ($userForm->isValid()) { |
@@ -89,7 +89,7 @@ class ConfigController extends Controller | |||
89 | } | 89 | } |
90 | 90 | ||
91 | // handle rss information | 91 | // handle rss information |
92 | $rssForm = $this->createForm(RssType::class, $config, array('action' => $this->generateUrl('config').'#set2')); | 92 | $rssForm = $this->createForm(RssType::class, $config, ['action' => $this->generateUrl('config').'#set2']); |
93 | $rssForm->handleRequest($request); | 93 | $rssForm->handleRequest($request); |
94 | 94 | ||
95 | if ($rssForm->isValid()) { | 95 | if ($rssForm->isValid()) { |
@@ -106,7 +106,7 @@ class ConfigController extends Controller | |||
106 | 106 | ||
107 | // handle tagging rule | 107 | // handle tagging rule |
108 | $taggingRule = new TaggingRule(); | 108 | $taggingRule = new TaggingRule(); |
109 | $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, array('action' => $this->generateUrl('config').'#set5')); | 109 | $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, ['action' => $this->generateUrl('config').'#set5']); |
110 | $newTaggingRule->handleRequest($request); | 110 | $newTaggingRule->handleRequest($request); |
111 | 111 | ||
112 | if ($newTaggingRule->isValid()) { | 112 | if ($newTaggingRule->isValid()) { |
@@ -126,10 +126,10 @@ class ConfigController extends Controller | |||
126 | $newUser = $userManager->createUser(); | 126 | $newUser = $userManager->createUser(); |
127 | // enable created user by default | 127 | // enable created user by default |
128 | $newUser->setEnabled(true); | 128 | $newUser->setEnabled(true); |
129 | $newUserForm = $this->createForm(NewUserType::class, $newUser, array( | 129 | $newUserForm = $this->createForm(NewUserType::class, $newUser, [ |
130 | 'validation_groups' => array('Profile'), | 130 | 'validation_groups' => ['Profile'], |
131 | 'action' => $this->generateUrl('config').'#set6', | 131 | 'action' => $this->generateUrl('config').'#set6', |
132 | )); | 132 | ]); |
133 | $newUserForm->handleRequest($request); | 133 | $newUserForm->handleRequest($request); |
134 | 134 | ||
135 | if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { | 135 | if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { |
@@ -147,27 +147,27 @@ class ConfigController extends Controller | |||
147 | 147 | ||
148 | $this->get('session')->getFlashBag()->add( | 148 | $this->get('session')->getFlashBag()->add( |
149 | 'notice', | 149 | 'notice', |
150 | $this->get('translator')->trans('flashes.config.notice.user_added', array('%username%' => $newUser->getUsername())) | 150 | $this->get('translator')->trans('flashes.config.notice.user_added', ['%username%' => $newUser->getUsername()]) |
151 | ); | 151 | ); |
152 | 152 | ||
153 | return $this->redirect($this->generateUrl('config').'#set6'); | 153 | return $this->redirect($this->generateUrl('config').'#set6'); |
154 | } | 154 | } |
155 | 155 | ||
156 | return $this->render('WallabagCoreBundle:Config:index.html.twig', array( | 156 | return $this->render('WallabagCoreBundle:Config:index.html.twig', [ |
157 | 'form' => array( | 157 | 'form' => [ |
158 | 'config' => $configForm->createView(), | 158 | 'config' => $configForm->createView(), |
159 | 'rss' => $rssForm->createView(), | 159 | 'rss' => $rssForm->createView(), |
160 | 'pwd' => $pwdForm->createView(), | 160 | 'pwd' => $pwdForm->createView(), |
161 | 'user' => $userForm->createView(), | 161 | 'user' => $userForm->createView(), |
162 | 'new_user' => $newUserForm->createView(), | 162 | 'new_user' => $newUserForm->createView(), |
163 | 'new_tagging_rule' => $newTaggingRule->createView(), | 163 | 'new_tagging_rule' => $newTaggingRule->createView(), |
164 | ), | 164 | ], |
165 | 'rss' => array( | 165 | 'rss' => [ |
166 | 'username' => $user->getUsername(), | 166 | 'username' => $user->getUsername(), |
167 | 'token' => $config->getRssToken(), | 167 | 'token' => $config->getRssToken(), |
168 | ), | 168 | ], |
169 | 'twofactor_auth' => $this->getParameter('twofactor_auth'), | 169 | 'twofactor_auth' => $this->getParameter('twofactor_auth'), |
170 | )); | 170 | ]); |
171 | } | 171 | } |
172 | 172 | ||
173 | /** | 173 | /** |
@@ -187,7 +187,7 @@ class ConfigController extends Controller | |||
187 | $em->flush(); | 187 | $em->flush(); |
188 | 188 | ||
189 | if ($request->isXmlHttpRequest()) { | 189 | if ($request->isXmlHttpRequest()) { |
190 | return new JsonResponse(array('token' => $config->getRssToken())); | 190 | return new JsonResponse(['token' => $config->getRssToken()]); |
191 | } | 191 | } |
192 | 192 | ||
193 | $this->get('session')->getFlashBag()->add( | 193 | $this->get('session')->getFlashBag()->add( |
@@ -229,7 +229,7 @@ class ConfigController extends Controller | |||
229 | * Retrieve config for the current user. | 229 | * Retrieve config for the current user. |
230 | * If no config were found, create a new one. | 230 | * If no config were found, create a new one. |
231 | * | 231 | * |
232 | * @return Wallabag\CoreBundle\Entity\Config | 232 | * @return Config |
233 | */ | 233 | */ |
234 | private function getConfig() | 234 | private function getConfig() |
235 | { | 235 | { |
diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index 7cb0ead2..d85ba5ee 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php | |||
@@ -21,9 +21,9 @@ class DeveloperController extends Controller | |||
21 | { | 21 | { |
22 | $clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findAll(); | 22 | $clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findAll(); |
23 | 23 | ||
24 | return $this->render('WallabagCoreBundle:Developer:index.html.twig', array( | 24 | return $this->render('WallabagCoreBundle:Developer:index.html.twig', [ |
25 | 'clients' => $clients, | 25 | 'clients' => $clients, |
26 | )); | 26 | ]); |
27 | } | 27 | } |
28 | 28 | ||
29 | /** | 29 | /** |
@@ -43,7 +43,7 @@ class DeveloperController extends Controller | |||
43 | $clientForm->handleRequest($request); | 43 | $clientForm->handleRequest($request); |
44 | 44 | ||
45 | if ($clientForm->isValid()) { | 45 | if ($clientForm->isValid()) { |
46 | $client->setAllowedGrantTypes(array('token', 'authorization_code', 'password', 'refresh_token')); | 46 | $client->setAllowedGrantTypes(['token', 'authorization_code', 'password', 'refresh_token']); |
47 | $em->persist($client); | 47 | $em->persist($client); |
48 | $em->flush(); | 48 | $em->flush(); |
49 | 49 | ||
@@ -52,15 +52,15 @@ class DeveloperController extends Controller | |||
52 | 'flashes.developer.notice.client_created' | 52 | 'flashes.developer.notice.client_created' |
53 | ); | 53 | ); |
54 | 54 | ||
55 | return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', array( | 55 | return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', [ |
56 | 'client_id' => $client->getPublicId(), | 56 | 'client_id' => $client->getPublicId(), |
57 | 'client_secret' => $client->getSecret(), | 57 | 'client_secret' => $client->getSecret(), |
58 | )); | 58 | ]); |
59 | } | 59 | } |
60 | 60 | ||
61 | return $this->render('WallabagCoreBundle:Developer:client.html.twig', array( | 61 | return $this->render('WallabagCoreBundle:Developer:client.html.twig', [ |
62 | 'form' => $clientForm->createView(), | 62 | 'form' => $clientForm->createView(), |
63 | )); | 63 | ]); |
64 | } | 64 | } |
65 | 65 | ||
66 | /** | 66 | /** |
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index cba58858..17b72bd1 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -54,10 +54,10 @@ class EntryController extends Controller | |||
54 | if (false !== $existingEntry) { | 54 | if (false !== $existingEntry) { |
55 | $this->get('session')->getFlashBag()->add( | 55 | $this->get('session')->getFlashBag()->add( |
56 | 'notice', | 56 | 'notice', |
57 | $this->get('translator')->trans('flashes.entry.notice.entry_already_saved', array('%date%' => $existingEntry->getCreatedAt()->format('d-m-Y'))) | 57 | $this->get('translator')->trans('flashes.entry.notice.entry_already_saved', ['%date%' => $existingEntry->getCreatedAt()->format('d-m-Y')]) |
58 | ); | 58 | ); |
59 | 59 | ||
60 | return $this->redirect($this->generateUrl('view', array('id' => $existingEntry->getId()))); | 60 | return $this->redirect($this->generateUrl('view', ['id' => $existingEntry->getId()])); |
61 | } | 61 | } |
62 | 62 | ||
63 | $this->updateEntry($entry); | 63 | $this->updateEntry($entry); |
@@ -69,9 +69,9 @@ class EntryController extends Controller | |||
69 | return $this->redirect($this->generateUrl('homepage')); | 69 | return $this->redirect($this->generateUrl('homepage')); |
70 | } | 70 | } |
71 | 71 | ||
72 | return $this->render('WallabagCoreBundle:Entry:new_form.html.twig', array( | 72 | return $this->render('WallabagCoreBundle:Entry:new_form.html.twig', [ |
73 | 'form' => $form->createView(), | 73 | 'form' => $form->createView(), |
74 | )); | 74 | ]); |
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
@@ -131,12 +131,12 @@ class EntryController extends Controller | |||
131 | 'flashes.entry.notice.entry_updated' | 131 | 'flashes.entry.notice.entry_updated' |
132 | ); | 132 | ); |
133 | 133 | ||
134 | return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); | 134 | return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); |
135 | } | 135 | } |
136 | 136 | ||
137 | return $this->render('WallabagCoreBundle:Entry:edit.html.twig', array( | 137 | return $this->render('WallabagCoreBundle:Entry:edit.html.twig', [ |
138 | 'form' => $form->createView(), | 138 | 'form' => $form->createView(), |
139 | )); | 139 | ]); |
140 | } | 140 | } |
141 | 141 | ||
142 | /** | 142 | /** |
@@ -257,17 +257,17 @@ class EntryController extends Controller | |||
257 | $entries->setCurrentPage($page); | 257 | $entries->setCurrentPage($page); |
258 | } catch (OutOfRangeCurrentPageException $e) { | 258 | } catch (OutOfRangeCurrentPageException $e) { |
259 | if ($page > 1) { | 259 | if ($page > 1) { |
260 | return $this->redirect($this->generateUrl($type, array('page' => $entries->getNbPages())), 302); | 260 | return $this->redirect($this->generateUrl($type, ['page' => $entries->getNbPages()]), 302); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | return $this->render( | 264 | return $this->render( |
265 | 'WallabagCoreBundle:Entry:entries.html.twig', | 265 | 'WallabagCoreBundle:Entry:entries.html.twig', |
266 | array( | 266 | [ |
267 | 'form' => $form->createView(), | 267 | 'form' => $form->createView(), |
268 | 'entries' => $entries, | 268 | 'entries' => $entries, |
269 | 'currentPage' => $page, | 269 | 'currentPage' => $page, |
270 | ) | 270 | ] |
271 | ); | 271 | ); |
272 | } | 272 | } |
273 | 273 | ||
@@ -286,7 +286,7 @@ class EntryController extends Controller | |||
286 | 286 | ||
287 | return $this->render( | 287 | return $this->render( |
288 | 'WallabagCoreBundle:Entry:entry.html.twig', | 288 | 'WallabagCoreBundle:Entry:entry.html.twig', |
289 | array('entry' => $entry) | 289 | ['entry' => $entry] |
290 | ); | 290 | ); |
291 | } | 291 | } |
292 | 292 | ||
@@ -314,7 +314,7 @@ class EntryController extends Controller | |||
314 | $message | 314 | $message |
315 | ); | 315 | ); |
316 | 316 | ||
317 | return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); | 317 | return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); |
318 | } | 318 | } |
319 | 319 | ||
320 | /** | 320 | /** |
@@ -394,7 +394,7 @@ class EntryController extends Controller | |||
394 | // to avoid redirecting to the deleted entry. Ugh. | 394 | // to avoid redirecting to the deleted entry. Ugh. |
395 | $url = $this->generateUrl( | 395 | $url = $this->generateUrl( |
396 | 'view', | 396 | 'view', |
397 | array('id' => $entry->getId()), | 397 | ['id' => $entry->getId()], |
398 | UrlGeneratorInterface::ABSOLUTE_URL | 398 | UrlGeneratorInterface::ABSOLUTE_URL |
399 | ); | 399 | ); |
400 | 400 | ||
@@ -426,11 +426,11 @@ class EntryController extends Controller | |||
426 | /** | 426 | /** |
427 | * Check for existing entry, if it exists, redirect to it with a message. | 427 | * Check for existing entry, if it exists, redirect to it with a message. |
428 | * | 428 | * |
429 | * @param $entry | 429 | * @param Entry $entry |
430 | * | 430 | * |
431 | * @return array|bool | 431 | * @return Entry|bool |
432 | */ | 432 | */ |
433 | private function checkIfEntryAlreadyExists($entry) | 433 | private function checkIfEntryAlreadyExists(Entry $entry) |
434 | { | 434 | { |
435 | return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); | 435 | return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); |
436 | } | 436 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index c8ef49a2..944c755d 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php | |||
@@ -16,12 +16,15 @@ class ExportController extends Controller | |||
16 | /** | 16 | /** |
17 | * Gets one entry content. | 17 | * Gets one entry content. |
18 | * | 18 | * |
19 | * @param Entry $entry | 19 | * @param Entry $entry |
20 | * @param string $format | ||
20 | * | 21 | * |
21 | * @Route("/export/{id}.{format}", name="export_entry", requirements={ | 22 | * @Route("/export/{id}.{format}", name="export_entry", requirements={ |
22 | * "format": "epub|mobi|pdf|json|xml|txt|csv", | 23 | * "format": "epub|mobi|pdf|json|xml|txt|csv", |
23 | * "id": "\d+" | 24 | * "id": "\d+" |
24 | * }) | 25 | * }) |
26 | * | ||
27 | * @return \Symfony\Component\HttpFoundation\Response | ||
25 | */ | 28 | */ |
26 | public function downloadEntryAction(Entry $entry, $format) | 29 | public function downloadEntryAction(Entry $entry, $format) |
27 | { | 30 | { |
@@ -38,10 +41,15 @@ class ExportController extends Controller | |||
38 | /** | 41 | /** |
39 | * Export all entries for current user. | 42 | * Export all entries for current user. |
40 | * | 43 | * |
44 | * @param string $format | ||
45 | * @param string $category | ||
46 | * | ||
41 | * @Route("/export/{category}.{format}", name="export_entries", requirements={ | 47 | * @Route("/export/{category}.{format}", name="export_entries", requirements={ |
42 | * "format": "epub|mobi|pdf|json|xml|txt|csv", | 48 | * "format": "epub|mobi|pdf|json|xml|txt|csv", |
43 | * "category": "all|unread|starred|archive" | 49 | * "category": "all|unread|starred|archive" |
44 | * }) | 50 | * }) |
51 | * | ||
52 | * @return \Symfony\Component\HttpFoundation\Response | ||
45 | */ | 53 | */ |
46 | public function downloadEntriesAction($format, $category) | 54 | public function downloadEntriesAction($format, $category) |
47 | { | 55 | { |
diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php index a4f7a200..2118885c 100644 --- a/src/Wallabag/CoreBundle/Controller/RssController.php +++ b/src/Wallabag/CoreBundle/Controller/RssController.php | |||
@@ -87,9 +87,9 @@ class RssController extends Controller | |||
87 | $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit'); | 87 | $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit'); |
88 | $entries->setMaxPerPage($perPage); | 88 | $entries->setMaxPerPage($perPage); |
89 | 89 | ||
90 | return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array( | 90 | return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', [ |
91 | 'type' => $type, | 91 | 'type' => $type, |
92 | 'entries' => $entries, | 92 | 'entries' => $entries, |
93 | )); | 93 | ]); |
94 | } | 94 | } |
95 | } | 95 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/StaticController.php b/src/Wallabag/CoreBundle/Controller/StaticController.php index 5b7bd56e..b41302f8 100644 --- a/src/Wallabag/CoreBundle/Controller/StaticController.php +++ b/src/Wallabag/CoreBundle/Controller/StaticController.php | |||
@@ -14,7 +14,7 @@ class StaticController extends Controller | |||
14 | { | 14 | { |
15 | return $this->render( | 15 | return $this->render( |
16 | 'WallabagCoreBundle:Static:howto.html.twig', | 16 | 'WallabagCoreBundle:Static:howto.html.twig', |
17 | array() | 17 | [] |
18 | ); | 18 | ); |
19 | } | 19 | } |
20 | 20 | ||
@@ -25,10 +25,10 @@ class StaticController extends Controller | |||
25 | { | 25 | { |
26 | return $this->render( | 26 | return $this->render( |
27 | 'WallabagCoreBundle:Static:about.html.twig', | 27 | 'WallabagCoreBundle:Static:about.html.twig', |
28 | array( | 28 | [ |
29 | 'version' => $this->getParameter('wallabag_core.version'), | 29 | 'version' => $this->getParameter('wallabag_core.version'), |
30 | 'paypal_url' => $this->getParameter('wallabag_core.paypal_url'), | 30 | 'paypal_url' => $this->getParameter('wallabag_core.paypal_url'), |
31 | ) | 31 | ] |
32 | ); | 32 | ); |
33 | } | 33 | } |
34 | 34 | ||
@@ -39,7 +39,7 @@ class StaticController extends Controller | |||
39 | { | 39 | { |
40 | return $this->render( | 40 | return $this->render( |
41 | 'WallabagCoreBundle:Static:quickstart.html.twig', | 41 | 'WallabagCoreBundle:Static:quickstart.html.twig', |
42 | array() | 42 | [] |
43 | ); | 43 | ); |
44 | } | 44 | } |
45 | } | 45 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 1a1f8c3d..e8e9ecbe 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -13,6 +13,7 @@ class TagController extends Controller | |||
13 | { | 13 | { |
14 | /** | 14 | /** |
15 | * @param Request $request | 15 | * @param Request $request |
16 | * @param Entry $entry | ||
16 | * | 17 | * |
17 | * @Route("/new-tag/{entry}", requirements={"entry" = "\d+"}, name="new_tag") | 18 | * @Route("/new-tag/{entry}", requirements={"entry" = "\d+"}, name="new_tag") |
18 | * | 19 | * |
@@ -38,13 +39,13 @@ class TagController extends Controller | |||
38 | 'flashes.tag.notice.tag_added' | 39 | 'flashes.tag.notice.tag_added' |
39 | ); | 40 | ); |
40 | 41 | ||
41 | return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); | 42 | return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); |
42 | } | 43 | } |
43 | 44 | ||
44 | return $this->render('WallabagCoreBundle:Tag:new_form.html.twig', array( | 45 | return $this->render('WallabagCoreBundle:Tag:new_form.html.twig', [ |
45 | 'form' => $form->createView(), | 46 | 'form' => $form->createView(), |
46 | 'entry' => $entry, | 47 | 'entry' => $entry, |
47 | )); | 48 | ]); |
48 | } | 49 | } |
49 | 50 | ||
50 | /** | 51 | /** |
@@ -82,9 +83,9 @@ class TagController extends Controller | |||
82 | 83 | ||
83 | return $this->render( | 84 | return $this->render( |
84 | 'WallabagCoreBundle:Tag:tags.html.twig', | 85 | 'WallabagCoreBundle:Tag:tags.html.twig', |
85 | array( | 86 | [ |
86 | 'tags' => $tags, | 87 | 'tags' => $tags, |
87 | ) | 88 | ] |
88 | ); | 89 | ); |
89 | } | 90 | } |
90 | } | 91 | } |
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php index 09a08bb2..2e1cc270 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php | |||
@@ -16,14 +16,14 @@ class LoadTaggingRuleData extends AbstractFixture implements OrderedFixtureInter | |||
16 | { | 16 | { |
17 | $tr1 = new TaggingRule(); | 17 | $tr1 = new TaggingRule(); |
18 | $tr1->setRule('content matches "spurs"'); | 18 | $tr1->setRule('content matches "spurs"'); |
19 | $tr1->setTags(array('sport')); | 19 | $tr1->setTags(['sport']); |
20 | $tr1->setConfig($this->getReference('admin-config')); | 20 | $tr1->setConfig($this->getReference('admin-config')); |
21 | 21 | ||
22 | $manager->persist($tr1); | 22 | $manager->persist($tr1); |
23 | 23 | ||
24 | $tr2 = new TaggingRule(); | 24 | $tr2 = new TaggingRule(); |
25 | $tr2->setRule('content matches "basket"'); | 25 | $tr2->setRule('content matches "basket"'); |
26 | $tr2->setTags(array('sport')); | 26 | $tr2->setTags(['sport']); |
27 | $tr2->setConfig($this->getReference('admin-config')); | 27 | $tr2->setConfig($this->getReference('admin-config')); |
28 | 28 | ||
29 | $manager->persist($tr2); | 29 | $manager->persist($tr2); |
diff --git a/src/Wallabag/CoreBundle/EventListener/LocaleListener.php b/src/Wallabag/CoreBundle/EventListener/LocaleListener.php index 05deac0a..a1c7e5ab 100644 --- a/src/Wallabag/CoreBundle/EventListener/LocaleListener.php +++ b/src/Wallabag/CoreBundle/EventListener/LocaleListener.php | |||
@@ -36,9 +36,9 @@ class LocaleListener implements EventSubscriberInterface | |||
36 | 36 | ||
37 | public static function getSubscribedEvents() | 37 | public static function getSubscribedEvents() |
38 | { | 38 | { |
39 | return array( | 39 | return [ |
40 | // must be registered before the default Locale listener | 40 | // must be registered before the default Locale listener |
41 | KernelEvents::REQUEST => array(array('onKernelRequest', 17)), | 41 | KernelEvents::REQUEST => [['onKernelRequest', 17]], |
42 | ); | 42 | ]; |
43 | } | 43 | } |
44 | } | 44 | } |
diff --git a/src/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListener.php b/src/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListener.php index 1c9160d5..10586126 100644 --- a/src/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListener.php +++ b/src/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListener.php | |||
@@ -28,9 +28,9 @@ class RegistrationConfirmedListener implements EventSubscriberInterface | |||
28 | 28 | ||
29 | public static function getSubscribedEvents() | 29 | public static function getSubscribedEvents() |
30 | { | 30 | { |
31 | return array( | 31 | return [ |
32 | FOSUserEvents::REGISTRATION_CONFIRMED => 'authenticate', | 32 | FOSUserEvents::REGISTRATION_CONFIRMED => 'authenticate', |
33 | ); | 33 | ]; |
34 | } | 34 | } |
35 | 35 | ||
36 | public function authenticate(FilterUserResponseEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null) | 36 | public function authenticate(FilterUserResponseEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null) |
diff --git a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php index 841af51e..81c4a616 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php | |||
@@ -15,28 +15,28 @@ class ChangePasswordType extends AbstractType | |||
15 | public function buildForm(FormBuilderInterface $builder, array $options) | 15 | public function buildForm(FormBuilderInterface $builder, array $options) |
16 | { | 16 | { |
17 | $builder | 17 | $builder |
18 | ->add('old_password', PasswordType::class, array( | 18 | ->add('old_password', PasswordType::class, [ |
19 | 'constraints' => new UserPassword(array('message' => 'validator.password_wrong_value')), | 19 | 'constraints' => new UserPassword(['message' => 'validator.password_wrong_value']), |
20 | 'label' => 'config.form_password.old_password_label', | 20 | 'label' => 'config.form_password.old_password_label', |
21 | )) | 21 | ]) |
22 | ->add('new_password', RepeatedType::class, array( | 22 | ->add('new_password', RepeatedType::class, [ |
23 | 'type' => PasswordType::class, | 23 | 'type' => PasswordType::class, |
24 | 'invalid_message' => 'validator.password_must_match', | 24 | 'invalid_message' => 'validator.password_must_match', |
25 | 'required' => true, | 25 | 'required' => true, |
26 | 'first_options' => array('label' => 'config.form_password.new_password_label'), | 26 | 'first_options' => ['label' => 'config.form_password.new_password_label'], |
27 | 'second_options' => array('label' => 'config.form_password.repeat_new_password_label'), | 27 | 'second_options' => ['label' => 'config.form_password.repeat_new_password_label'], |
28 | 'constraints' => array( | 28 | 'constraints' => [ |
29 | new Constraints\Length(array( | 29 | new Constraints\Length([ |
30 | 'min' => 8, | 30 | 'min' => 8, |
31 | 'minMessage' => 'validator.password_too_short', | 31 | 'minMessage' => 'validator.password_too_short', |
32 | )), | 32 | ]), |
33 | new Constraints\NotBlank(), | 33 | new Constraints\NotBlank(), |
34 | ), | 34 | ], |
35 | 'label' => 'config.form_password.new_password_label', | 35 | 'label' => 'config.form_password.new_password_label', |
36 | )) | 36 | ]) |
37 | ->add('save', SubmitType::class, array( | 37 | ->add('save', SubmitType::class, [ |
38 | 'label' => 'config.form.save', | 38 | 'label' => 'config.form.save', |
39 | )) | 39 | ]) |
40 | ; | 40 | ; |
41 | } | 41 | } |
42 | 42 | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/ClientType.php b/src/Wallabag/CoreBundle/Form/Type/ClientType.php index 9f620414..8b351e60 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ClientType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ClientType.php | |||
@@ -14,8 +14,8 @@ class ClientType extends AbstractType | |||
14 | public function buildForm(FormBuilderInterface $builder, array $options) | 14 | public function buildForm(FormBuilderInterface $builder, array $options) |
15 | { | 15 | { |
16 | $builder | 16 | $builder |
17 | ->add('redirect_uris', UrlType::class, array('required' => true, 'label' => 'developer.client.form.redirect_uris_label')) | 17 | ->add('redirect_uris', UrlType::class, ['required' => true, 'label' => 'developer.client.form.redirect_uris_label']) |
18 | ->add('save', SubmitType::class, array('label' => 'developer.client.form.save_label')) | 18 | ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label']) |
19 | ; | 19 | ; |
20 | 20 | ||
21 | $builder->get('redirect_uris') | 21 | $builder->get('redirect_uris') |
@@ -24,7 +24,7 @@ class ClientType extends AbstractType | |||
24 | return $originalUri; | 24 | return $originalUri; |
25 | }, | 25 | }, |
26 | function ($submittedUri) { | 26 | function ($submittedUri) { |
27 | return array($submittedUri); | 27 | return [$submittedUri]; |
28 | } | 28 | } |
29 | )) | 29 | )) |
30 | ; | 30 | ; |
@@ -32,9 +32,9 @@ class ClientType extends AbstractType | |||
32 | 32 | ||
33 | public function configureOptions(OptionsResolver $resolver) | 33 | public function configureOptions(OptionsResolver $resolver) |
34 | { | 34 | { |
35 | $resolver->setDefaults(array( | 35 | $resolver->setDefaults([ |
36 | 'data_class' => 'Wallabag\ApiBundle\Entity\Client', | 36 | 'data_class' => 'Wallabag\ApiBundle\Entity\Client', |
37 | )); | 37 | ]); |
38 | } | 38 | } |
39 | 39 | ||
40 | public function getBlockPrefix() | 40 | public function getBlockPrefix() |
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index b30b4706..4cf22200 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php | |||
@@ -10,8 +10,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; | |||
10 | 10 | ||
11 | class ConfigType extends AbstractType | 11 | class ConfigType extends AbstractType |
12 | { | 12 | { |
13 | private $themes = array(); | 13 | private $themes = []; |
14 | private $languages = array(); | 14 | private $languages = []; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * @param array $themes Themes come from the LiipThemeBundle (liip_theme.themes) | 17 | * @param array $themes Themes come from the LiipThemeBundle (liip_theme.themes) |
@@ -30,39 +30,39 @@ class ConfigType extends AbstractType | |||
30 | public function buildForm(FormBuilderInterface $builder, array $options) | 30 | public function buildForm(FormBuilderInterface $builder, array $options) |
31 | { | 31 | { |
32 | $builder | 32 | $builder |
33 | ->add('theme', ChoiceType::class, array( | 33 | ->add('theme', ChoiceType::class, [ |
34 | 'choices' => array_flip($this->themes), | 34 | 'choices' => array_flip($this->themes), |
35 | 'choices_as_values' => true, | 35 | 'choices_as_values' => true, |
36 | 'label' => 'config.form_settings.theme_label', | 36 | 'label' => 'config.form_settings.theme_label', |
37 | )) | 37 | ]) |
38 | ->add('items_per_page', null, array( | 38 | ->add('items_per_page', null, [ |
39 | 'label' => 'config.form_settings.items_per_page_label', | 39 | 'label' => 'config.form_settings.items_per_page_label', |
40 | )) | 40 | ]) |
41 | ->add('reading_speed', ChoiceType::class, array( | 41 | ->add('reading_speed', ChoiceType::class, [ |
42 | 'label' => 'config.form_settings.reading_speed.label', | 42 | 'label' => 'config.form_settings.reading_speed.label', |
43 | 'choices' => array( | 43 | 'choices' => [ |
44 | 'config.form_settings.reading_speed.100_word' => '0.5', | 44 | 'config.form_settings.reading_speed.100_word' => '0.5', |
45 | 'config.form_settings.reading_speed.200_word' => '1', | 45 | 'config.form_settings.reading_speed.200_word' => '1', |
46 | 'config.form_settings.reading_speed.300_word' => '1.5', | 46 | 'config.form_settings.reading_speed.300_word' => '1.5', |
47 | 'config.form_settings.reading_speed.400_word' => '2', | 47 | 'config.form_settings.reading_speed.400_word' => '2', |
48 | ), | 48 | ], |
49 | )) | 49 | ]) |
50 | ->add('language', ChoiceType::class, array( | 50 | ->add('language', ChoiceType::class, [ |
51 | 'choices' => array_flip($this->languages), | 51 | 'choices' => array_flip($this->languages), |
52 | 'choices_as_values' => true, | 52 | 'choices_as_values' => true, |
53 | 'label' => 'config.form_settings.language_label', | 53 | 'label' => 'config.form_settings.language_label', |
54 | )) | 54 | ]) |
55 | ->add('save', SubmitType::class, array( | 55 | ->add('save', SubmitType::class, [ |
56 | 'label' => 'config.form.save', | 56 | 'label' => 'config.form.save', |
57 | )) | 57 | ]) |
58 | ; | 58 | ; |
59 | } | 59 | } |
60 | 60 | ||
61 | public function configureOptions(OptionsResolver $resolver) | 61 | public function configureOptions(OptionsResolver $resolver) |
62 | { | 62 | { |
63 | $resolver->setDefaults(array( | 63 | $resolver->setDefaults([ |
64 | 'data_class' => 'Wallabag\CoreBundle\Entity\Config', | 64 | 'data_class' => 'Wallabag\CoreBundle\Entity\Config', |
65 | )); | 65 | ]); |
66 | } | 66 | } |
67 | 67 | ||
68 | public function getBlockPrefix() | 68 | public function getBlockPrefix() |
diff --git a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php index 23d7b239..40e5b5b9 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php | |||
@@ -14,30 +14,30 @@ class EditEntryType extends AbstractType | |||
14 | public function buildForm(FormBuilderInterface $builder, array $options) | 14 | public function buildForm(FormBuilderInterface $builder, array $options) |
15 | { | 15 | { |
16 | $builder | 16 | $builder |
17 | ->add('title', TextType::class, array( | 17 | ->add('title', TextType::class, [ |
18 | 'required' => true, | 18 | 'required' => true, |
19 | 'label' => 'entry.edit.title_label', | 19 | 'label' => 'entry.edit.title_label', |
20 | )) | 20 | ]) |
21 | ->add('is_public', CheckboxType::class, array( | 21 | ->add('is_public', CheckboxType::class, [ |
22 | 'required' => false, | 22 | 'required' => false, |
23 | 'label' => 'entry.edit.is_public_label', | 23 | 'label' => 'entry.edit.is_public_label', |
24 | )) | 24 | ]) |
25 | ->add('url', TextType::class, array( | 25 | ->add('url', TextType::class, [ |
26 | 'disabled' => true, | 26 | 'disabled' => true, |
27 | 'required' => false, | 27 | 'required' => false, |
28 | 'label' => 'entry.edit.url_label', | 28 | 'label' => 'entry.edit.url_label', |
29 | )) | 29 | ]) |
30 | ->add('save', SubmitType::class, array( | 30 | ->add('save', SubmitType::class, [ |
31 | 'label' => 'entry.edit.save_label', | 31 | 'label' => 'entry.edit.save_label', |
32 | )) | 32 | ]) |
33 | ; | 33 | ; |
34 | } | 34 | } |
35 | 35 | ||
36 | public function configureOptions(OptionsResolver $resolver) | 36 | public function configureOptions(OptionsResolver $resolver) |
37 | { | 37 | { |
38 | $resolver->setDefaults(array( | 38 | $resolver->setDefaults([ |
39 | 'data_class' => 'Wallabag\CoreBundle\Entity\Entry', | 39 | 'data_class' => 'Wallabag\CoreBundle\Entity\Entry', |
40 | )); | 40 | ]); |
41 | } | 41 | } |
42 | 42 | ||
43 | public function getBlockPrefix() | 43 | public function getBlockPrefix() |
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index ec36503b..dcdb3ab7 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | |||
@@ -34,28 +34,28 @@ class EntryFilterType extends AbstractType | |||
34 | public function buildForm(FormBuilderInterface $builder, array $options) | 34 | public function buildForm(FormBuilderInterface $builder, array $options) |
35 | { | 35 | { |
36 | $builder | 36 | $builder |
37 | ->add('readingTime', NumberRangeFilterType::class, array( | 37 | ->add('readingTime', NumberRangeFilterType::class, [ |
38 | 'label' => 'entry.filters.reading_time.label', | 38 | 'label' => 'entry.filters.reading_time.label', |
39 | )) | 39 | ]) |
40 | ->add('createdAt', DateRangeFilterType::class, array( | 40 | ->add('createdAt', DateRangeFilterType::class, [ |
41 | 'left_date_options' => array( | 41 | 'left_date_options' => [ |
42 | 'attr' => array( | 42 | 'attr' => [ |
43 | 'placeholder' => 'dd/mm/yyyy', | 43 | 'placeholder' => 'dd/mm/yyyy', |
44 | ), | 44 | ], |
45 | 'format' => 'dd/MM/yyyy', | 45 | 'format' => 'dd/MM/yyyy', |
46 | 'widget' => 'single_text', | 46 | 'widget' => 'single_text', |
47 | ), | 47 | ], |
48 | 'right_date_options' => array( | 48 | 'right_date_options' => [ |
49 | 'attr' => array( | 49 | 'attr' => [ |
50 | 'placeholder' => 'dd/mm/yyyy', | 50 | 'placeholder' => 'dd/mm/yyyy', |
51 | ), | 51 | ], |
52 | 'format' => 'dd/MM/yyyy', | 52 | 'format' => 'dd/MM/yyyy', |
53 | 'widget' => 'single_text', | 53 | 'widget' => 'single_text', |
54 | ), | 54 | ], |
55 | 'label' => 'entry.filters.created_at.label', | 55 | 'label' => 'entry.filters.created_at.label', |
56 | ) | 56 | ] |
57 | ) | 57 | ) |
58 | ->add('domainName', TextFilterType::class, array( | 58 | ->add('domainName', TextFilterType::class, [ |
59 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | 59 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { |
60 | $value = $values['value']; | 60 | $value = $values['value']; |
61 | if (strlen($value) <= 2 || empty($value)) { | 61 | if (strlen($value) <= 2 || empty($value)) { |
@@ -66,14 +66,14 @@ class EntryFilterType extends AbstractType | |||
66 | return $filterQuery->createCondition($expression); | 66 | return $filterQuery->createCondition($expression); |
67 | }, | 67 | }, |
68 | 'label' => 'entry.filters.domain_label', | 68 | 'label' => 'entry.filters.domain_label', |
69 | )) | 69 | ]) |
70 | ->add('isArchived', CheckboxFilterType::class, array( | 70 | ->add('isArchived', CheckboxFilterType::class, [ |
71 | 'label' => 'entry.filters.archived_label', | 71 | 'label' => 'entry.filters.archived_label', |
72 | )) | 72 | ]) |
73 | ->add('isStarred', CheckboxFilterType::class, array( | 73 | ->add('isStarred', CheckboxFilterType::class, [ |
74 | 'label' => 'entry.filters.starred_label', | 74 | 'label' => 'entry.filters.starred_label', |
75 | )) | 75 | ]) |
76 | ->add('previewPicture', CheckboxFilterType::class, array( | 76 | ->add('previewPicture', CheckboxFilterType::class, [ |
77 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | 77 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { |
78 | if (false === $values['value']) { | 78 | if (false === $values['value']) { |
79 | return; | 79 | return; |
@@ -84,12 +84,12 @@ class EntryFilterType extends AbstractType | |||
84 | return $filterQuery->createCondition($expression); | 84 | return $filterQuery->createCondition($expression); |
85 | }, | 85 | }, |
86 | 'label' => 'entry.filters.preview_picture_label', | 86 | 'label' => 'entry.filters.preview_picture_label', |
87 | )) | 87 | ]) |
88 | ->add('language', ChoiceFilterType::class, array( | 88 | ->add('language', ChoiceFilterType::class, [ |
89 | 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), | 89 | 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), |
90 | 'choices_as_values' => true, | 90 | 'choices_as_values' => true, |
91 | 'label' => 'entry.filters.language_label', | 91 | 'label' => 'entry.filters.language_label', |
92 | )) | 92 | ]) |
93 | ; | 93 | ; |
94 | } | 94 | } |
95 | 95 | ||
@@ -100,9 +100,9 @@ class EntryFilterType extends AbstractType | |||
100 | 100 | ||
101 | public function configureOptions(OptionsResolver $resolver) | 101 | public function configureOptions(OptionsResolver $resolver) |
102 | { | 102 | { |
103 | $resolver->setDefaults(array( | 103 | $resolver->setDefaults([ |
104 | 'csrf_protection' => false, | 104 | 'csrf_protection' => false, |
105 | 'validation_groups' => array('filtering'), | 105 | 'validation_groups' => ['filtering'], |
106 | )); | 106 | ]); |
107 | } | 107 | } |
108 | } | 108 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php index 69fab6fb..7d74fee3 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php | |||
@@ -12,18 +12,18 @@ class NewEntryType extends AbstractType | |||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | 12 | public function buildForm(FormBuilderInterface $builder, array $options) |
13 | { | 13 | { |
14 | $builder | 14 | $builder |
15 | ->add('url', UrlType::class, array( | 15 | ->add('url', UrlType::class, [ |
16 | 'required' => true, | 16 | 'required' => true, |
17 | 'label' => 'entry.new.form_new.url_label', | 17 | 'label' => 'entry.new.form_new.url_label', |
18 | )) | 18 | ]) |
19 | ; | 19 | ; |
20 | } | 20 | } |
21 | 21 | ||
22 | public function configureOptions(OptionsResolver $resolver) | 22 | public function configureOptions(OptionsResolver $resolver) |
23 | { | 23 | { |
24 | $resolver->setDefaults(array( | 24 | $resolver->setDefaults([ |
25 | 'data_class' => 'Wallabag\CoreBundle\Entity\Entry', | 25 | 'data_class' => 'Wallabag\CoreBundle\Entity\Entry', |
26 | )); | 26 | ]); |
27 | } | 27 | } |
28 | 28 | ||
29 | public function getBlockPrefix() | 29 | public function getBlockPrefix() |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewTagType.php b/src/Wallabag/CoreBundle/Form/Type/NewTagType.php index c7568de7..3db4105f 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewTagType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewTagType.php | |||
@@ -12,15 +12,15 @@ class NewTagType extends AbstractType | |||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | 12 | public function buildForm(FormBuilderInterface $builder, array $options) |
13 | { | 13 | { |
14 | $builder | 14 | $builder |
15 | ->add('label', TextType::class, array('required' => true)) | 15 | ->add('label', TextType::class, ['required' => true]) |
16 | ; | 16 | ; |
17 | } | 17 | } |
18 | 18 | ||
19 | public function configureOptions(OptionsResolver $resolver) | 19 | public function configureOptions(OptionsResolver $resolver) |
20 | { | 20 | { |
21 | $resolver->setDefaults(array( | 21 | $resolver->setDefaults([ |
22 | 'data_class' => 'Wallabag\CoreBundle\Entity\Tag', | 22 | 'data_class' => 'Wallabag\CoreBundle\Entity\Tag', |
23 | )); | 23 | ]); |
24 | } | 24 | } |
25 | 25 | ||
26 | public function getBlockPrefix() | 26 | public function getBlockPrefix() |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php index 60fcc20c..6a6f63d1 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php | |||
@@ -17,38 +17,38 @@ class NewUserType extends AbstractType | |||
17 | public function buildForm(FormBuilderInterface $builder, array $options) | 17 | public function buildForm(FormBuilderInterface $builder, array $options) |
18 | { | 18 | { |
19 | $builder | 19 | $builder |
20 | ->add('username', TextType::class, array( | 20 | ->add('username', TextType::class, [ |
21 | 'required' => true, | 21 | 'required' => true, |
22 | 'label' => 'config.form_new_user.username_label', | 22 | 'label' => 'config.form_new_user.username_label', |
23 | )) | 23 | ]) |
24 | ->add('plainPassword', RepeatedType::class, array( | 24 | ->add('plainPassword', RepeatedType::class, [ |
25 | 'type' => PasswordType::class, | 25 | 'type' => PasswordType::class, |
26 | 'invalid_message' => 'validator.password_must_match', | 26 | 'invalid_message' => 'validator.password_must_match', |
27 | 'first_options' => array('label' => 'config.form_new_user.password_label'), | 27 | 'first_options' => ['label' => 'config.form_new_user.password_label'], |
28 | 'second_options' => array('label' => 'config.form_new_user.repeat_new_password_label'), | 28 | 'second_options' => ['label' => 'config.form_new_user.repeat_new_password_label'], |
29 | 'constraints' => array( | 29 | 'constraints' => [ |
30 | new Constraints\Length(array( | 30 | new Constraints\Length([ |
31 | 'min' => 8, | 31 | 'min' => 8, |
32 | 'minMessage' => 'validator.password_too_short', | 32 | 'minMessage' => 'validator.password_too_short', |
33 | )), | 33 | ]), |
34 | new Constraints\NotBlank(), | 34 | new Constraints\NotBlank(), |
35 | ), | 35 | ], |
36 | 'label' => 'config.form_new_user.plain_password_label', | 36 | 'label' => 'config.form_new_user.plain_password_label', |
37 | )) | 37 | ]) |
38 | ->add('email', EmailType::class, array( | 38 | ->add('email', EmailType::class, [ |
39 | 'label' => 'config.form_new_user.email_label', | 39 | 'label' => 'config.form_new_user.email_label', |
40 | )) | 40 | ]) |
41 | ->add('save', SubmitType::class, array( | 41 | ->add('save', SubmitType::class, [ |
42 | 'label' => 'config.form.save', | 42 | 'label' => 'config.form.save', |
43 | )) | 43 | ]) |
44 | ; | 44 | ; |
45 | } | 45 | } |
46 | 46 | ||
47 | public function configureOptions(OptionsResolver $resolver) | 47 | public function configureOptions(OptionsResolver $resolver) |
48 | { | 48 | { |
49 | $resolver->setDefaults(array( | 49 | $resolver->setDefaults([ |
50 | 'data_class' => 'Wallabag\UserBundle\Entity\User', | 50 | 'data_class' => 'Wallabag\UserBundle\Entity\User', |
51 | )); | 51 | ]); |
52 | } | 52 | } |
53 | 53 | ||
54 | public function getBlockPrefix() | 54 | public function getBlockPrefix() |
diff --git a/src/Wallabag/CoreBundle/Form/Type/RssType.php b/src/Wallabag/CoreBundle/Form/Type/RssType.php index a9f68e54..94324fed 100644 --- a/src/Wallabag/CoreBundle/Form/Type/RssType.php +++ b/src/Wallabag/CoreBundle/Form/Type/RssType.php | |||
@@ -12,20 +12,20 @@ class RssType extends AbstractType | |||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | 12 | public function buildForm(FormBuilderInterface $builder, array $options) |
13 | { | 13 | { |
14 | $builder | 14 | $builder |
15 | ->add('rss_limit', null, array( | 15 | ->add('rss_limit', null, [ |
16 | 'label' => 'config.form_rss.rss_limit', | 16 | 'label' => 'config.form_rss.rss_limit', |
17 | )) | 17 | ]) |
18 | ->add('save', SubmitType::class, array( | 18 | ->add('save', SubmitType::class, [ |
19 | 'label' => 'config.form.save', | 19 | 'label' => 'config.form.save', |
20 | )) | 20 | ]) |
21 | ; | 21 | ; |
22 | } | 22 | } |
23 | 23 | ||
24 | public function configureOptions(OptionsResolver $resolver) | 24 | public function configureOptions(OptionsResolver $resolver) |
25 | { | 25 | { |
26 | $resolver->setDefaults(array( | 26 | $resolver->setDefaults([ |
27 | 'data_class' => 'Wallabag\CoreBundle\Entity\Config', | 27 | 'data_class' => 'Wallabag\CoreBundle\Entity\Config', |
28 | )); | 28 | ]); |
29 | } | 29 | } |
30 | 30 | ||
31 | public function getBlockPrefix() | 31 | public function getBlockPrefix() |
diff --git a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php index cfee21f1..732606c9 100644 --- a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php +++ b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php | |||
@@ -14,19 +14,19 @@ class TaggingRuleType extends AbstractType | |||
14 | public function buildForm(FormBuilderInterface $builder, array $options) | 14 | public function buildForm(FormBuilderInterface $builder, array $options) |
15 | { | 15 | { |
16 | $builder | 16 | $builder |
17 | ->add('rule', TextType::class, array( | 17 | ->add('rule', TextType::class, [ |
18 | 'required' => true, | 18 | 'required' => true, |
19 | 'label' => 'config.form_rules.rule_label', | 19 | 'label' => 'config.form_rules.rule_label', |
20 | )) | 20 | ]) |
21 | ->add('save', SubmitType::class, array( | 21 | ->add('save', SubmitType::class, [ |
22 | 'label' => 'config.form.save', | 22 | 'label' => 'config.form.save', |
23 | )) | 23 | ]) |
24 | ; | 24 | ; |
25 | 25 | ||
26 | $tagsField = $builder | 26 | $tagsField = $builder |
27 | ->create('tags', TextType::class, array( | 27 | ->create('tags', TextType::class, [ |
28 | 'label' => 'config.form_rules.tags_label', | 28 | 'label' => 'config.form_rules.tags_label', |
29 | )) | 29 | ]) |
30 | ->addModelTransformer(new StringToListTransformer(',')); | 30 | ->addModelTransformer(new StringToListTransformer(',')); |
31 | 31 | ||
32 | $builder->add($tagsField); | 32 | $builder->add($tagsField); |
@@ -34,9 +34,9 @@ class TaggingRuleType extends AbstractType | |||
34 | 34 | ||
35 | public function configureOptions(OptionsResolver $resolver) | 35 | public function configureOptions(OptionsResolver $resolver) |
36 | { | 36 | { |
37 | $resolver->setDefaults(array( | 37 | $resolver->setDefaults([ |
38 | 'data_class' => 'Wallabag\CoreBundle\Entity\TaggingRule', | 38 | 'data_class' => 'Wallabag\CoreBundle\Entity\TaggingRule', |
39 | )); | 39 | ]); |
40 | } | 40 | } |
41 | 41 | ||
42 | public function getBlockPrefix() | 42 | public function getBlockPrefix() |
diff --git a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php index 799ea39e..07c99949 100644 --- a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php +++ b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php | |||
@@ -15,19 +15,19 @@ class UserInformationType extends AbstractType | |||
15 | public function buildForm(FormBuilderInterface $builder, array $options) | 15 | public function buildForm(FormBuilderInterface $builder, array $options) |
16 | { | 16 | { |
17 | $builder | 17 | $builder |
18 | ->add('name', TextType::class, array( | 18 | ->add('name', TextType::class, [ |
19 | 'label' => 'config.form_user.name_label', | 19 | 'label' => 'config.form_user.name_label', |
20 | )) | 20 | ]) |
21 | ->add('email', EmailType::class, array( | 21 | ->add('email', EmailType::class, [ |
22 | 'label' => 'config.form_user.email_label', | 22 | 'label' => 'config.form_user.email_label', |
23 | )) | 23 | ]) |
24 | ->add('twoFactorAuthentication', CheckboxType::class, array( | 24 | ->add('twoFactorAuthentication', CheckboxType::class, [ |
25 | 'required' => false, | 25 | 'required' => false, |
26 | 'label' => 'config.form_user.twoFactorAuthentication_label', | 26 | 'label' => 'config.form_user.twoFactorAuthentication_label', |
27 | )) | 27 | ]) |
28 | ->add('save', SubmitType::class, array( | 28 | ->add('save', SubmitType::class, [ |
29 | 'label' => 'config.form.save', | 29 | 'label' => 'config.form.save', |
30 | )) | 30 | ]) |
31 | ->remove('username') | 31 | ->remove('username') |
32 | ->remove('plainPassword') | 32 | ->remove('plainPassword') |
33 | ; | 33 | ; |
@@ -40,9 +40,9 @@ class UserInformationType extends AbstractType | |||
40 | 40 | ||
41 | public function configureOptions(OptionsResolver $resolver) | 41 | public function configureOptions(OptionsResolver $resolver) |
42 | { | 42 | { |
43 | $resolver->setDefaults(array( | 43 | $resolver->setDefaults([ |
44 | 'data_class' => 'Wallabag\UserBundle\Entity\User', | 44 | 'data_class' => 'Wallabag\UserBundle\Entity\User', |
45 | )); | 45 | ]); |
46 | } | 46 | } |
47 | 47 | ||
48 | public function getBlockPrefix() | 48 | public function getBlockPrefix() |
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index ed4a220d..5dd684f2 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -82,10 +82,10 @@ class ContentProxy | |||
82 | try { | 82 | try { |
83 | $this->tagger->tag($entry); | 83 | $this->tagger->tag($entry); |
84 | } catch (\Exception $e) { | 84 | } catch (\Exception $e) { |
85 | $this->logger->error('Error while trying to automatically tag an entry.', array( | 85 | $this->logger->error('Error while trying to automatically tag an entry.', [ |
86 | 'entry_url' => $url, | 86 | 'entry_url' => $url, |
87 | 'error_msg' => $e->getMessage(), | 87 | 'error_msg' => $e->getMessage(), |
88 | )); | 88 | ]); |
89 | } | 89 | } |
90 | 90 | ||
91 | return $entry; | 91 | return $entry; |
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index d0680c3f..0cf835b4 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php | |||
@@ -18,10 +18,10 @@ class EntriesExport | |||
18 | private $wallabagUrl; | 18 | private $wallabagUrl; |
19 | private $logoPath; | 19 | private $logoPath; |
20 | private $title = ''; | 20 | private $title = ''; |
21 | private $entries = array(); | 21 | private $entries = []; |
22 | private $authors = array('wallabag'); | 22 | private $authors = ['wallabag']; |
23 | private $language = ''; | 23 | private $language = ''; |
24 | private $tags = array(); | 24 | private $tags = []; |
25 | private $footerTemplate = '<div style="text-align:center;"> | 25 | private $footerTemplate = '<div style="text-align:center;"> |
26 | <p>Produced by wallabag with %EXPORT_METHOD%</p> | 26 | <p>Produced by wallabag with %EXPORT_METHOD%</p> |
27 | <p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p> | 27 | <p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p> |
@@ -41,12 +41,14 @@ class EntriesExport | |||
41 | * Define entries. | 41 | * Define entries. |
42 | * | 42 | * |
43 | * @param array|Entry $entries An array of entries or one entry | 43 | * @param array|Entry $entries An array of entries or one entry |
44 | * | ||
45 | * @return EntriesExport | ||
44 | */ | 46 | */ |
45 | public function setEntries($entries) | 47 | public function setEntries($entries) |
46 | { | 48 | { |
47 | if (!is_array($entries)) { | 49 | if (!is_array($entries)) { |
48 | $this->language = $entries->getLanguage(); | 50 | $this->language = $entries->getLanguage(); |
49 | $entries = array($entries); | 51 | $entries = [$entries]; |
50 | } | 52 | } |
51 | 53 | ||
52 | $this->entries = $entries; | 54 | $this->entries = $entries; |
@@ -62,6 +64,8 @@ class EntriesExport | |||
62 | * Sets the category of which we want to get articles, or just one entry. | 64 | * Sets the category of which we want to get articles, or just one entry. |
63 | * | 65 | * |
64 | * @param string $method Method to get articles | 66 | * @param string $method Method to get articles |
67 | * | ||
68 | * @return EntriesExport | ||
65 | */ | 69 | */ |
66 | public function updateTitle($method) | 70 | public function updateTitle($method) |
67 | { | 71 | { |
@@ -78,6 +82,8 @@ class EntriesExport | |||
78 | * Sets the output format. | 82 | * Sets the output format. |
79 | * | 83 | * |
80 | * @param string $format | 84 | * @param string $format |
85 | * | ||
86 | * @return Response | ||
81 | */ | 87 | */ |
82 | public function exportAs($format) | 88 | public function exportAs($format) |
83 | { | 89 | { |
@@ -91,6 +97,8 @@ class EntriesExport | |||
91 | 97 | ||
92 | /** | 98 | /** |
93 | * Use PHPePub to dump a .epub file. | 99 | * Use PHPePub to dump a .epub file. |
100 | * | ||
101 | * @return Response | ||
94 | */ | 102 | */ |
95 | private function produceEpub() | 103 | private function produceEpub() |
96 | { | 104 | { |
@@ -162,17 +170,19 @@ class EntriesExport | |||
162 | return Response::create( | 170 | return Response::create( |
163 | $book->getBook(), | 171 | $book->getBook(), |
164 | 200, | 172 | 200, |
165 | array( | 173 | [ |
166 | 'Content-Description' => 'File Transfer', | 174 | 'Content-Description' => 'File Transfer', |
167 | 'Content-type' => 'application/epub+zip', | 175 | 'Content-type' => 'application/epub+zip', |
168 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.epub"', | 176 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.epub"', |
169 | 'Content-Transfer-Encoding' => 'binary', | 177 | 'Content-Transfer-Encoding' => 'binary', |
170 | ) | 178 | ] |
171 | ); | 179 | ); |
172 | } | 180 | } |
173 | 181 | ||
174 | /** | 182 | /** |
175 | * Use PHPMobi to dump a .mobi file. | 183 | * Use PHPMobi to dump a .mobi file. |
184 | * | ||
185 | * @return Response | ||
176 | */ | 186 | */ |
177 | private function produceMobi() | 187 | private function produceMobi() |
178 | { | 188 | { |
@@ -211,18 +221,20 @@ class EntriesExport | |||
211 | return Response::create( | 221 | return Response::create( |
212 | $mobi->toString(), | 222 | $mobi->toString(), |
213 | 200, | 223 | 200, |
214 | array( | 224 | [ |
215 | 'Accept-Ranges' => 'bytes', | 225 | 'Accept-Ranges' => 'bytes', |
216 | 'Content-Description' => 'File Transfer', | 226 | 'Content-Description' => 'File Transfer', |
217 | 'Content-type' => 'application/x-mobipocket-ebook', | 227 | 'Content-type' => 'application/x-mobipocket-ebook', |
218 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.mobi"', | 228 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.mobi"', |
219 | 'Content-Transfer-Encoding' => 'binary', | 229 | 'Content-Transfer-Encoding' => 'binary', |
220 | ) | 230 | ] |
221 | ); | 231 | ); |
222 | } | 232 | } |
223 | 233 | ||
224 | /** | 234 | /** |
225 | * Use TCPDF to dump a .pdf file. | 235 | * Use TCPDF to dump a .pdf file. |
236 | * | ||
237 | * @return Response | ||
226 | */ | 238 | */ |
227 | private function producePdf() | 239 | private function producePdf() |
228 | { | 240 | { |
@@ -266,17 +278,19 @@ class EntriesExport | |||
266 | return Response::create( | 278 | return Response::create( |
267 | $pdf->Output('', 'S'), | 279 | $pdf->Output('', 'S'), |
268 | 200, | 280 | 200, |
269 | array( | 281 | [ |
270 | 'Content-Description' => 'File Transfer', | 282 | 'Content-Description' => 'File Transfer', |
271 | 'Content-type' => 'application/pdf', | 283 | 'Content-type' => 'application/pdf', |
272 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.pdf"', | 284 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.pdf"', |
273 | 'Content-Transfer-Encoding' => 'binary', | 285 | 'Content-Transfer-Encoding' => 'binary', |
274 | ) | 286 | ] |
275 | ); | 287 | ); |
276 | } | 288 | } |
277 | 289 | ||
278 | /** | 290 | /** |
279 | * Inspired from CsvFileDumper. | 291 | * Inspired from CsvFileDumper. |
292 | * | ||
293 | * @return Response | ||
280 | */ | 294 | */ |
281 | private function produceCsv() | 295 | private function produceCsv() |
282 | { | 296 | { |
@@ -284,20 +298,20 @@ class EntriesExport | |||
284 | $enclosure = '"'; | 298 | $enclosure = '"'; |
285 | $handle = fopen('php://memory', 'rb+'); | 299 | $handle = fopen('php://memory', 'rb+'); |
286 | 300 | ||
287 | fputcsv($handle, array('Title', 'URL', 'Content', 'Tags', 'MIME Type', 'Language'), $delimiter, $enclosure); | 301 | fputcsv($handle, ['Title', 'URL', 'Content', 'Tags', 'MIME Type', 'Language'], $delimiter, $enclosure); |
288 | 302 | ||
289 | foreach ($this->entries as $entry) { | 303 | foreach ($this->entries as $entry) { |
290 | fputcsv( | 304 | fputcsv( |
291 | $handle, | 305 | $handle, |
292 | array( | 306 | [ |
293 | $entry->getTitle(), | 307 | $entry->getTitle(), |
294 | $entry->getURL(), | 308 | $entry->getURL(), |
295 | // remove new line to avoid crazy results | 309 | // remove new line to avoid crazy results |
296 | str_replace(array("\r\n", "\r", "\n"), '', $entry->getContent()), | 310 | str_replace(["\r\n", "\r", "\n"], '', $entry->getContent()), |
297 | implode(', ', $entry->getTags()->toArray()), | 311 | implode(', ', $entry->getTags()->toArray()), |
298 | $entry->getMimetype(), | 312 | $entry->getMimetype(), |
299 | $entry->getLanguage(), | 313 | $entry->getLanguage(), |
300 | ), | 314 | ], |
301 | $delimiter, | 315 | $delimiter, |
302 | $enclosure | 316 | $enclosure |
303 | ); | 317 | ); |
@@ -310,40 +324,55 @@ class EntriesExport | |||
310 | return Response::create( | 324 | return Response::create( |
311 | $output, | 325 | $output, |
312 | 200, | 326 | 200, |
313 | array( | 327 | [ |
314 | 'Content-type' => 'application/csv', | 328 | 'Content-type' => 'application/csv', |
315 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.csv"', | 329 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.csv"', |
316 | 'Content-Transfer-Encoding' => 'UTF-8', | 330 | 'Content-Transfer-Encoding' => 'UTF-8', |
317 | ) | 331 | ] |
318 | ); | 332 | ); |
319 | } | 333 | } |
320 | 334 | ||
335 | /** | ||
336 | * Dump a JSON file. | ||
337 | * | ||
338 | * @return Response | ||
339 | */ | ||
321 | private function produceJson() | 340 | private function produceJson() |
322 | { | 341 | { |
323 | return Response::create( | 342 | return Response::create( |
324 | $this->prepareSerializingContent('json'), | 343 | $this->prepareSerializingContent('json'), |
325 | 200, | 344 | 200, |
326 | array( | 345 | [ |
327 | 'Content-type' => 'application/json', | 346 | 'Content-type' => 'application/json', |
328 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.json"', | 347 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.json"', |
329 | 'Content-Transfer-Encoding' => 'UTF-8', | 348 | 'Content-Transfer-Encoding' => 'UTF-8', |
330 | ) | 349 | ] |
331 | ); | 350 | ); |
332 | } | 351 | } |
333 | 352 | ||
353 | /** | ||
354 | * Dump a XML file. | ||
355 | * | ||
356 | * @return Response | ||
357 | */ | ||
334 | private function produceXml() | 358 | private function produceXml() |
335 | { | 359 | { |
336 | return Response::create( | 360 | return Response::create( |
337 | $this->prepareSerializingContent('xml'), | 361 | $this->prepareSerializingContent('xml'), |
338 | 200, | 362 | 200, |
339 | array( | 363 | [ |
340 | 'Content-type' => 'application/xml', | 364 | 'Content-type' => 'application/xml', |
341 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.xml"', | 365 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.xml"', |
342 | 'Content-Transfer-Encoding' => 'UTF-8', | 366 | 'Content-Transfer-Encoding' => 'UTF-8', |
343 | ) | 367 | ] |
344 | ); | 368 | ); |
345 | } | 369 | } |
346 | 370 | ||
371 | /** | ||
372 | * Dump a TXT file. | ||
373 | * | ||
374 | * @return Response | ||
375 | */ | ||
347 | private function produceTxt() | 376 | private function produceTxt() |
348 | { | 377 | { |
349 | $content = ''; | 378 | $content = ''; |
@@ -356,11 +385,11 @@ class EntriesExport | |||
356 | return Response::create( | 385 | return Response::create( |
357 | $content, | 386 | $content, |
358 | 200, | 387 | 200, |
359 | array( | 388 | [ |
360 | 'Content-type' => 'text/plain', | 389 | 'Content-type' => 'text/plain', |
361 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.txt"', | 390 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.txt"', |
362 | 'Content-Transfer-Encoding' => 'UTF-8', | 391 | 'Content-Transfer-Encoding' => 'UTF-8', |
363 | ) | 392 | ] |
364 | ); | 393 | ); |
365 | } | 394 | } |
366 | 395 | ||
@@ -378,7 +407,7 @@ class EntriesExport | |||
378 | return $serializer->serialize( | 407 | return $serializer->serialize( |
379 | $this->entries, | 408 | $this->entries, |
380 | $format, | 409 | $format, |
381 | SerializationContext::create()->setGroups(array('entries_for_user')) | 410 | SerializationContext::create()->setGroups(['entries_for_user']) |
382 | ); | 411 | ); |
383 | } | 412 | } |
384 | 413 | ||
diff --git a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php index 991c9a56..14ef4a64 100644 --- a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php +++ b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php | |||
@@ -54,7 +54,7 @@ class RuleBasedTagger | |||
54 | public function tagAllForUser(User $user) | 54 | public function tagAllForUser(User $user) |
55 | { | 55 | { |
56 | $rules = $this->getRulesForUser($user); | 56 | $rules = $this->getRulesForUser($user); |
57 | $entries = array(); | 57 | $entries = []; |
58 | 58 | ||
59 | foreach ($rules as $rule) { | 59 | foreach ($rules as $rule) { |
60 | $qb = $this->entryRepository->getBuilderForAllByUser($user->getId()); | 60 | $qb = $this->entryRepository->getBuilderForAllByUser($user->getId()); |
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 87e34dc9..4d45e5f5 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -157,7 +157,7 @@ class EntryRepository extends EntityRepository | |||
157 | ->getQuery() | 157 | ->getQuery() |
158 | ->getResult(); | 158 | ->getResult(); |
159 | 159 | ||
160 | $languages = array(); | 160 | $languages = []; |
161 | foreach ($results as $result) { | 161 | foreach ($results as $result) { |
162 | $languages[$result['language']] = $result['language']; | 162 | $languages[$result['language']] = $result['language']; |
163 | } | 163 | } |
@@ -233,7 +233,7 @@ class EntryRepository extends EntityRepository | |||
233 | * @param $url | 233 | * @param $url |
234 | * @param $userId | 234 | * @param $userId |
235 | * | 235 | * |
236 | * @return array|bool | 236 | * @return Entry|bool |
237 | */ | 237 | */ |
238 | public function findByUrlAndUserId($url, $userId) | 238 | public function findByUrlAndUserId($url, $userId) |
239 | { | 239 | { |
diff --git a/src/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriber.php b/src/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriber.php index 9a4b16ee..0379ad6a 100644 --- a/src/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriber.php +++ b/src/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriber.php | |||
@@ -27,7 +27,7 @@ class TablePrefixSubscriber implements EventSubscriber | |||
27 | 27 | ||
28 | public function getSubscribedEvents() | 28 | public function getSubscribedEvents() |
29 | { | 29 | { |
30 | return array('loadClassMetadata'); | 30 | return ['loadClassMetadata']; |
31 | } | 31 | } |
32 | 32 | ||
33 | public function loadClassMetadata(LoadClassMetadataEventArgs $args) | 33 | public function loadClassMetadata(LoadClassMetadataEventArgs $args) |
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php index bd61f750..0673d581 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php | |||
@@ -37,11 +37,11 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
37 | $application = new Application(static::$kernel); | 37 | $application = new Application(static::$kernel); |
38 | $application->setAutoExit(false); | 38 | $application->setAutoExit(false); |
39 | 39 | ||
40 | $code = $application->run(new ArrayInput(array( | 40 | $code = $application->run(new ArrayInput([ |
41 | 'command' => 'doctrine:fixtures:load', | 41 | 'command' => 'doctrine:fixtures:load', |
42 | '--no-interaction' => true, | 42 | '--no-interaction' => true, |
43 | '--env' => 'test', | 43 | '--env' => 'test', |
44 | )), new NullOutput()); | 44 | ]), new NullOutput()); |
45 | } | 45 | } |
46 | 46 | ||
47 | public function testRunInstallCommand() | 47 | public function testRunInstallCommand() |
@@ -63,9 +63,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
63 | $command->getHelperSet()->set($question, 'question'); | 63 | $command->getHelperSet()->set($question, 'question'); |
64 | 64 | ||
65 | $tester = new CommandTester($command); | 65 | $tester = new CommandTester($command); |
66 | $tester->execute(array( | 66 | $tester->execute([ |
67 | 'command' => $command->getName(), | 67 | 'command' => $command->getName(), |
68 | )); | 68 | ]); |
69 | 69 | ||
70 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 70 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
71 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 71 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
@@ -93,10 +93,10 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
93 | $command->getHelperSet()->set($question, 'question'); | 93 | $command->getHelperSet()->set($question, 'question'); |
94 | 94 | ||
95 | $tester = new CommandTester($command); | 95 | $tester = new CommandTester($command); |
96 | $tester->execute(array( | 96 | $tester->execute([ |
97 | 'command' => $command->getName(), | 97 | 'command' => $command->getName(), |
98 | '--reset' => true, | 98 | '--reset' => true, |
99 | )); | 99 | ]); |
100 | 100 | ||
101 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 101 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
102 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 102 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
@@ -116,10 +116,10 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
116 | 116 | ||
117 | // drop database first, so the install command won't ask to reset things | 117 | // drop database first, so the install command won't ask to reset things |
118 | $command = $application->find('doctrine:database:drop'); | 118 | $command = $application->find('doctrine:database:drop'); |
119 | $command->run(new ArrayInput(array( | 119 | $command->run(new ArrayInput([ |
120 | 'command' => 'doctrine:database:drop', | 120 | 'command' => 'doctrine:database:drop', |
121 | '--force' => true, | 121 | '--force' => true, |
122 | )), new NullOutput()); | 122 | ]), new NullOutput()); |
123 | 123 | ||
124 | // start a new application to avoid lagging connexion to pgsql | 124 | // start a new application to avoid lagging connexion to pgsql |
125 | $client = static::createClient(); | 125 | $client = static::createClient(); |
@@ -140,9 +140,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
140 | $command->getHelperSet()->set($question, 'question'); | 140 | $command->getHelperSet()->set($question, 'question'); |
141 | 141 | ||
142 | $tester = new CommandTester($command); | 142 | $tester = new CommandTester($command); |
143 | $tester->execute(array( | 143 | $tester->execute([ |
144 | 'command' => $command->getName(), | 144 | 'command' => $command->getName(), |
145 | )); | 145 | ]); |
146 | 146 | ||
147 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 147 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
148 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 148 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
@@ -178,9 +178,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
178 | $command->getHelperSet()->set($question, 'question'); | 178 | $command->getHelperSet()->set($question, 'question'); |
179 | 179 | ||
180 | $tester = new CommandTester($command); | 180 | $tester = new CommandTester($command); |
181 | $tester->execute(array( | 181 | $tester->execute([ |
182 | 'command' => $command->getName(), | 182 | 'command' => $command->getName(), |
183 | )); | 183 | ]); |
184 | 184 | ||
185 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 185 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
186 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 186 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
@@ -201,19 +201,19 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
201 | // drop database first, so the install command won't ask to reset things | 201 | // drop database first, so the install command won't ask to reset things |
202 | $command = new DropDatabaseDoctrineCommand(); | 202 | $command = new DropDatabaseDoctrineCommand(); |
203 | $command->setApplication($application); | 203 | $command->setApplication($application); |
204 | $command->run(new ArrayInput(array( | 204 | $command->run(new ArrayInput([ |
205 | 'command' => 'doctrine:database:drop', | 205 | 'command' => 'doctrine:database:drop', |
206 | '--force' => true, | 206 | '--force' => true, |
207 | )), new NullOutput()); | 207 | ]), new NullOutput()); |
208 | 208 | ||
209 | $this->getClient()->getContainer()->get('doctrine')->getConnection()->close(); | 209 | $this->getClient()->getContainer()->get('doctrine')->getConnection()->close(); |
210 | 210 | ||
211 | $command = new CreateDatabaseDoctrineCommand(); | 211 | $command = new CreateDatabaseDoctrineCommand(); |
212 | $command->setApplication($application); | 212 | $command->setApplication($application); |
213 | $command->run(new ArrayInput(array( | 213 | $command->run(new ArrayInput([ |
214 | 'command' => 'doctrine:database:create', | 214 | 'command' => 'doctrine:database:create', |
215 | '--env' => 'test', | 215 | '--env' => 'test', |
216 | )), new NullOutput()); | 216 | ]), new NullOutput()); |
217 | 217 | ||
218 | $command = $application->find('wallabag:install'); | 218 | $command = $application->find('wallabag:install'); |
219 | 219 | ||
@@ -233,9 +233,9 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
233 | $command->getHelperSet()->set($question, 'question'); | 233 | $command->getHelperSet()->set($question, 'question'); |
234 | 234 | ||
235 | $tester = new CommandTester($command); | 235 | $tester = new CommandTester($command); |
236 | $tester->execute(array( | 236 | $tester->execute([ |
237 | 'command' => $command->getName(), | 237 | 'command' => $command->getName(), |
238 | )); | 238 | ]); |
239 | 239 | ||
240 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 240 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
241 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 241 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
@@ -265,10 +265,10 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
265 | $command->getHelperSet()->set($question, 'question'); | 265 | $command->getHelperSet()->set($question, 'question'); |
266 | 266 | ||
267 | $tester = new CommandTester($command); | 267 | $tester = new CommandTester($command); |
268 | $tester->execute(array( | 268 | $tester->execute([ |
269 | 'command' => $command->getName(), | 269 | 'command' => $command->getName(), |
270 | '--no-interaction' => true, | 270 | '--no-interaction' => true, |
271 | )); | 271 | ]); |
272 | 272 | ||
273 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); | 273 | $this->assertContains('Checking system requirements.', $tester->getDisplay()); |
274 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 274 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
diff --git a/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php index 653c1a93..4f544c1d 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php | |||
@@ -21,9 +21,9 @@ class TagAllCommandTest extends WallabagCoreTestCase | |||
21 | $command = $application->find('wallabag:tag:all'); | 21 | $command = $application->find('wallabag:tag:all'); |
22 | 22 | ||
23 | $tester = new CommandTester($command); | 23 | $tester = new CommandTester($command); |
24 | $tester->execute(array( | 24 | $tester->execute([ |
25 | 'command' => $command->getName(), | 25 | 'command' => $command->getName(), |
26 | )); | 26 | ]); |
27 | } | 27 | } |
28 | 28 | ||
29 | public function testRunTagAllCommandWithBadUsername() | 29 | public function testRunTagAllCommandWithBadUsername() |
@@ -34,10 +34,10 @@ class TagAllCommandTest extends WallabagCoreTestCase | |||
34 | $command = $application->find('wallabag:tag:all'); | 34 | $command = $application->find('wallabag:tag:all'); |
35 | 35 | ||
36 | $tester = new CommandTester($command); | 36 | $tester = new CommandTester($command); |
37 | $tester->execute(array( | 37 | $tester->execute([ |
38 | 'command' => $command->getName(), | 38 | 'command' => $command->getName(), |
39 | 'username' => 'unknown', | 39 | 'username' => 'unknown', |
40 | )); | 40 | ]); |
41 | 41 | ||
42 | $this->assertContains('User "unknown" not found', $tester->getDisplay()); | 42 | $this->assertContains('User "unknown" not found', $tester->getDisplay()); |
43 | } | 43 | } |
@@ -50,10 +50,10 @@ class TagAllCommandTest extends WallabagCoreTestCase | |||
50 | $command = $application->find('wallabag:tag:all'); | 50 | $command = $application->find('wallabag:tag:all'); |
51 | 51 | ||
52 | $tester = new CommandTester($command); | 52 | $tester = new CommandTester($command); |
53 | $tester->execute(array( | 53 | $tester->execute([ |
54 | 'command' => $command->getName(), | 54 | 'command' => $command->getName(), |
55 | 'username' => 'admin', | 55 | 'username' => 'admin', |
56 | )); | 56 | ]); |
57 | 57 | ||
58 | $this->assertContains('Tagging entries for user « admin »... Done', $tester->getDisplay()); | 58 | $this->assertContains('Tagging entries for user « admin »... Done', $tester->getDisplay()); |
59 | } | 59 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index f2d26750..1aa1a7ed 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php | |||
@@ -43,12 +43,12 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
43 | 43 | ||
44 | $form = $crawler->filter('button[id=config_save]')->form(); | 44 | $form = $crawler->filter('button[id=config_save]')->form(); |
45 | 45 | ||
46 | $data = array( | 46 | $data = [ |
47 | 'config[theme]' => 'baggy', | 47 | 'config[theme]' => 'baggy', |
48 | 'config[items_per_page]' => '30', | 48 | 'config[items_per_page]' => '30', |
49 | 'config[reading_speed]' => '0.5', | 49 | 'config[reading_speed]' => '0.5', |
50 | 'config[language]' => 'en', | 50 | 'config[language]' => 'en', |
51 | ); | 51 | ]; |
52 | 52 | ||
53 | $client->submit($form, $data); | 53 | $client->submit($form, $data); |
54 | 54 | ||
@@ -56,19 +56,19 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
56 | 56 | ||
57 | $crawler = $client->followRedirect(); | 57 | $crawler = $client->followRedirect(); |
58 | 58 | ||
59 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 59 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
60 | $this->assertContains('flashes.config.notice.config_saved', $alert[0]); | 60 | $this->assertContains('flashes.config.notice.config_saved', $alert[0]); |
61 | } | 61 | } |
62 | 62 | ||
63 | public function dataForUpdateFailed() | 63 | public function dataForUpdateFailed() |
64 | { | 64 | { |
65 | return array( | 65 | return [ |
66 | array(array( | 66 | [[ |
67 | 'config[theme]' => 'baggy', | 67 | 'config[theme]' => 'baggy', |
68 | 'config[items_per_page]' => '', | 68 | 'config[items_per_page]' => '', |
69 | 'config[language]' => 'en', | 69 | 'config[language]' => 'en', |
70 | )), | 70 | ]], |
71 | ); | 71 | ]; |
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
@@ -89,46 +89,46 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
89 | 89 | ||
90 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 90 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
91 | 91 | ||
92 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 92 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
93 | $this->assertContains('This value should not be blank', $alert[0]); | 93 | $this->assertContains('This value should not be blank', $alert[0]); |
94 | } | 94 | } |
95 | 95 | ||
96 | public function dataForChangePasswordFailed() | 96 | public function dataForChangePasswordFailed() |
97 | { | 97 | { |
98 | return array( | 98 | return [ |
99 | array( | 99 | [ |
100 | array( | 100 | [ |
101 | 'change_passwd[old_password]' => 'material', | 101 | 'change_passwd[old_password]' => 'material', |
102 | 'change_passwd[new_password][first]' => '', | 102 | 'change_passwd[new_password][first]' => '', |
103 | 'change_passwd[new_password][second]' => '', | 103 | 'change_passwd[new_password][second]' => '', |
104 | ), | 104 | ], |
105 | 'validator.password_wrong_value', | 105 | 'validator.password_wrong_value', |
106 | ), | 106 | ], |
107 | array( | 107 | [ |
108 | array( | 108 | [ |
109 | 'change_passwd[old_password]' => 'mypassword', | 109 | 'change_passwd[old_password]' => 'mypassword', |
110 | 'change_passwd[new_password][first]' => '', | 110 | 'change_passwd[new_password][first]' => '', |
111 | 'change_passwd[new_password][second]' => '', | 111 | 'change_passwd[new_password][second]' => '', |
112 | ), | 112 | ], |
113 | 'This value should not be blank', | 113 | 'This value should not be blank', |
114 | ), | 114 | ], |
115 | array( | 115 | [ |
116 | array( | 116 | [ |
117 | 'change_passwd[old_password]' => 'mypassword', | 117 | 'change_passwd[old_password]' => 'mypassword', |
118 | 'change_passwd[new_password][first]' => 'hop', | 118 | 'change_passwd[new_password][first]' => 'hop', |
119 | 'change_passwd[new_password][second]' => '', | 119 | 'change_passwd[new_password][second]' => '', |
120 | ), | 120 | ], |
121 | 'validator.password_must_match', | 121 | 'validator.password_must_match', |
122 | ), | 122 | ], |
123 | array( | 123 | [ |
124 | array( | 124 | [ |
125 | 'change_passwd[old_password]' => 'mypassword', | 125 | 'change_passwd[old_password]' => 'mypassword', |
126 | 'change_passwd[new_password][first]' => 'hop', | 126 | 'change_passwd[new_password][first]' => 'hop', |
127 | 'change_passwd[new_password][second]' => 'hop', | 127 | 'change_passwd[new_password][second]' => 'hop', |
128 | ), | 128 | ], |
129 | 'validator.password_too_short', | 129 | 'validator.password_too_short', |
130 | ), | 130 | ], |
131 | ); | 131 | ]; |
132 | } | 132 | } |
133 | 133 | ||
134 | /** | 134 | /** |
@@ -149,7 +149,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
149 | 149 | ||
150 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 150 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
151 | 151 | ||
152 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 152 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
153 | $this->assertContains($expectedMessage, $alert[0]); | 153 | $this->assertContains($expectedMessage, $alert[0]); |
154 | } | 154 | } |
155 | 155 | ||
@@ -164,11 +164,11 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
164 | 164 | ||
165 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); | 165 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); |
166 | 166 | ||
167 | $data = array( | 167 | $data = [ |
168 | 'change_passwd[old_password]' => 'mypassword', | 168 | 'change_passwd[old_password]' => 'mypassword', |
169 | 'change_passwd[new_password][first]' => 'mypassword', | 169 | 'change_passwd[new_password][first]' => 'mypassword', |
170 | 'change_passwd[new_password][second]' => 'mypassword', | 170 | 'change_passwd[new_password][second]' => 'mypassword', |
171 | ); | 171 | ]; |
172 | 172 | ||
173 | $client->submit($form, $data); | 173 | $client->submit($form, $data); |
174 | 174 | ||
@@ -176,28 +176,28 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
176 | 176 | ||
177 | $crawler = $client->followRedirect(); | 177 | $crawler = $client->followRedirect(); |
178 | 178 | ||
179 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 179 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
180 | $this->assertContains('flashes.config.notice.password_updated', $alert[0]); | 180 | $this->assertContains('flashes.config.notice.password_updated', $alert[0]); |
181 | } | 181 | } |
182 | 182 | ||
183 | public function dataForUserFailed() | 183 | public function dataForUserFailed() |
184 | { | 184 | { |
185 | return array( | 185 | return [ |
186 | array( | 186 | [ |
187 | array( | 187 | [ |
188 | 'update_user[name]' => '', | 188 | 'update_user[name]' => '', |
189 | 'update_user[email]' => '', | 189 | 'update_user[email]' => '', |
190 | ), | 190 | ], |
191 | 'fos_user.email.blank', | 191 | 'fos_user.email.blank', |
192 | ), | 192 | ], |
193 | array( | 193 | [ |
194 | array( | 194 | [ |
195 | 'update_user[name]' => '', | 195 | 'update_user[name]' => '', |
196 | 'update_user[email]' => 'test', | 196 | 'update_user[email]' => 'test', |
197 | ), | 197 | ], |
198 | 'fos_user.email.invalid', | 198 | 'fos_user.email.invalid', |
199 | ), | 199 | ], |
200 | ); | 200 | ]; |
201 | } | 201 | } |
202 | 202 | ||
203 | /** | 203 | /** |
@@ -218,7 +218,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
218 | 218 | ||
219 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 219 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
220 | 220 | ||
221 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 221 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
222 | $this->assertContains($expectedMessage, $alert[0]); | 222 | $this->assertContains($expectedMessage, $alert[0]); |
223 | } | 223 | } |
224 | 224 | ||
@@ -233,10 +233,10 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
233 | 233 | ||
234 | $form = $crawler->filter('button[id=update_user_save]')->form(); | 234 | $form = $crawler->filter('button[id=update_user_save]')->form(); |
235 | 235 | ||
236 | $data = array( | 236 | $data = [ |
237 | 'update_user[name]' => 'new name', | 237 | 'update_user[name]' => 'new name', |
238 | 'update_user[email]' => 'admin@wallabag.io', | 238 | 'update_user[email]' => 'admin@wallabag.io', |
239 | ); | 239 | ]; |
240 | 240 | ||
241 | $client->submit($form, $data); | 241 | $client->submit($form, $data); |
242 | 242 | ||
@@ -244,59 +244,59 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
244 | 244 | ||
245 | $crawler = $client->followRedirect(); | 245 | $crawler = $client->followRedirect(); |
246 | 246 | ||
247 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 247 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
248 | $this->assertContains('flashes.config.notice.user_updated', $alert[0]); | 248 | $this->assertContains('flashes.config.notice.user_updated', $alert[0]); |
249 | } | 249 | } |
250 | 250 | ||
251 | public function dataForNewUserFailed() | 251 | public function dataForNewUserFailed() |
252 | { | 252 | { |
253 | return array( | 253 | return [ |
254 | array( | 254 | [ |
255 | array( | 255 | [ |
256 | 'new_user[username]' => '', | 256 | 'new_user[username]' => '', |
257 | 'new_user[plainPassword][first]' => '', | 257 | 'new_user[plainPassword][first]' => '', |
258 | 'new_user[plainPassword][second]' => '', | 258 | 'new_user[plainPassword][second]' => '', |
259 | 'new_user[email]' => '', | 259 | 'new_user[email]' => '', |
260 | ), | 260 | ], |
261 | 'fos_user.username.blank', | 261 | 'fos_user.username.blank', |
262 | ), | 262 | ], |
263 | array( | 263 | [ |
264 | array( | 264 | [ |
265 | 'new_user[username]' => 'a', | 265 | 'new_user[username]' => 'a', |
266 | 'new_user[plainPassword][first]' => 'mypassword', | 266 | 'new_user[plainPassword][first]' => 'mypassword', |
267 | 'new_user[plainPassword][second]' => 'mypassword', | 267 | 'new_user[plainPassword][second]' => 'mypassword', |
268 | 'new_user[email]' => '', | 268 | 'new_user[email]' => '', |
269 | ), | 269 | ], |
270 | 'fos_user.username.short', | 270 | 'fos_user.username.short', |
271 | ), | 271 | ], |
272 | array( | 272 | [ |
273 | array( | 273 | [ |
274 | 'new_user[username]' => 'wallace', | 274 | 'new_user[username]' => 'wallace', |
275 | 'new_user[plainPassword][first]' => 'mypassword', | 275 | 'new_user[plainPassword][first]' => 'mypassword', |
276 | 'new_user[plainPassword][second]' => 'mypassword', | 276 | 'new_user[plainPassword][second]' => 'mypassword', |
277 | 'new_user[email]' => 'test', | 277 | 'new_user[email]' => 'test', |
278 | ), | 278 | ], |
279 | 'fos_user.email.invalid', | 279 | 'fos_user.email.invalid', |
280 | ), | 280 | ], |
281 | array( | 281 | [ |
282 | array( | 282 | [ |
283 | 'new_user[username]' => 'admin', | 283 | 'new_user[username]' => 'admin', |
284 | 'new_user[plainPassword][first]' => 'wallacewallace', | 284 | 'new_user[plainPassword][first]' => 'wallacewallace', |
285 | 'new_user[plainPassword][second]' => 'wallacewallace', | 285 | 'new_user[plainPassword][second]' => 'wallacewallace', |
286 | 'new_user[email]' => 'wallace@wallace.me', | 286 | 'new_user[email]' => 'wallace@wallace.me', |
287 | ), | 287 | ], |
288 | 'fos_user.username.already_used', | 288 | 'fos_user.username.already_used', |
289 | ), | 289 | ], |
290 | array( | 290 | [ |
291 | array( | 291 | [ |
292 | 'new_user[username]' => 'wallace', | 292 | 'new_user[username]' => 'wallace', |
293 | 'new_user[plainPassword][first]' => 'mypassword1', | 293 | 'new_user[plainPassword][first]' => 'mypassword1', |
294 | 'new_user[plainPassword][second]' => 'mypassword2', | 294 | 'new_user[plainPassword][second]' => 'mypassword2', |
295 | 'new_user[email]' => 'wallace@wallace.me', | 295 | 'new_user[email]' => 'wallace@wallace.me', |
296 | ), | 296 | ], |
297 | 'validator.password_must_match', | 297 | 'validator.password_must_match', |
298 | ), | 298 | ], |
299 | ); | 299 | ]; |
300 | } | 300 | } |
301 | 301 | ||
302 | /** | 302 | /** |
@@ -317,7 +317,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
317 | 317 | ||
318 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 318 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
319 | 319 | ||
320 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 320 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
321 | $this->assertContains($expectedMessage, $alert[0]); | 321 | $this->assertContains($expectedMessage, $alert[0]); |
322 | } | 322 | } |
323 | 323 | ||
@@ -332,12 +332,12 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
332 | 332 | ||
333 | $form = $crawler->filter('button[id=new_user_save]')->form(); | 333 | $form = $crawler->filter('button[id=new_user_save]')->form(); |
334 | 334 | ||
335 | $data = array( | 335 | $data = [ |
336 | 'new_user[username]' => 'wallace', | 336 | 'new_user[username]' => 'wallace', |
337 | 'new_user[plainPassword][first]' => 'wallace1', | 337 | 'new_user[plainPassword][first]' => 'wallace1', |
338 | 'new_user[plainPassword][second]' => 'wallace1', | 338 | 'new_user[plainPassword][second]' => 'wallace1', |
339 | 'new_user[email]' => 'wallace@wallace.me', | 339 | 'new_user[email]' => 'wallace@wallace.me', |
340 | ); | 340 | ]; |
341 | 341 | ||
342 | $client->submit($form, $data); | 342 | $client->submit($form, $data); |
343 | 343 | ||
@@ -345,7 +345,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
345 | 345 | ||
346 | $crawler = $client->followRedirect(); | 346 | $crawler = $client->followRedirect(); |
347 | 347 | ||
348 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 348 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
349 | $this->assertContains('flashes.config.notice.user_added', $alert[0]); | 349 | $this->assertContains('flashes.config.notice.user_added', $alert[0]); |
350 | 350 | ||
351 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | 351 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); |
@@ -381,7 +381,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
381 | 381 | ||
382 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 382 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
383 | 383 | ||
384 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 384 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
385 | $this->assertContains('config.form_rss.no_token', $body[0]); | 385 | $this->assertContains('config.form_rss.no_token', $body[0]); |
386 | 386 | ||
387 | $client->request('GET', '/generate-token'); | 387 | $client->request('GET', '/generate-token'); |
@@ -389,7 +389,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
389 | 389 | ||
390 | $crawler = $client->followRedirect(); | 390 | $crawler = $client->followRedirect(); |
391 | 391 | ||
392 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 392 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
393 | $this->assertNotContains('config.form_rss.no_token', $body[0]); | 393 | $this->assertNotContains('config.form_rss.no_token', $body[0]); |
394 | } | 394 | } |
395 | 395 | ||
@@ -401,9 +401,9 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
401 | $client->request( | 401 | $client->request( |
402 | 'GET', | 402 | 'GET', |
403 | '/generate-token', | 403 | '/generate-token', |
404 | array(), | 404 | [], |
405 | array(), | 405 | [], |
406 | array('HTTP_X-Requested-With' => 'XMLHttpRequest') | 406 | ['HTTP_X-Requested-With' => 'XMLHttpRequest'] |
407 | ); | 407 | ); |
408 | 408 | ||
409 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 409 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
@@ -422,9 +422,9 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
422 | 422 | ||
423 | $form = $crawler->filter('button[id=rss_config_save]')->form(); | 423 | $form = $crawler->filter('button[id=rss_config_save]')->form(); |
424 | 424 | ||
425 | $data = array( | 425 | $data = [ |
426 | 'rss_config[rss_limit]' => 12, | 426 | 'rss_config[rss_limit]' => 12, |
427 | ); | 427 | ]; |
428 | 428 | ||
429 | $client->submit($form, $data); | 429 | $client->submit($form, $data); |
430 | 430 | ||
@@ -432,26 +432,26 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
432 | 432 | ||
433 | $crawler = $client->followRedirect(); | 433 | $crawler = $client->followRedirect(); |
434 | 434 | ||
435 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 435 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
436 | $this->assertContains('flashes.config.notice.rss_updated', $alert[0]); | 436 | $this->assertContains('flashes.config.notice.rss_updated', $alert[0]); |
437 | } | 437 | } |
438 | 438 | ||
439 | public function dataForRssFailed() | 439 | public function dataForRssFailed() |
440 | { | 440 | { |
441 | return array( | 441 | return [ |
442 | array( | 442 | [ |
443 | array( | 443 | [ |
444 | 'rss_config[rss_limit]' => 0, | 444 | 'rss_config[rss_limit]' => 0, |
445 | ), | 445 | ], |
446 | 'This value should be 1 or more.', | 446 | 'This value should be 1 or more.', |
447 | ), | 447 | ], |
448 | array( | 448 | [ |
449 | array( | 449 | [ |
450 | 'rss_config[rss_limit]' => 1000000000000, | 450 | 'rss_config[rss_limit]' => 1000000000000, |
451 | ), | 451 | ], |
452 | 'validator.rss_limit_too_hight', | 452 | 'validator.rss_limit_too_hight', |
453 | ), | 453 | ], |
454 | ); | 454 | ]; |
455 | } | 455 | } |
456 | 456 | ||
457 | /** | 457 | /** |
@@ -472,7 +472,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
472 | 472 | ||
473 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 473 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
474 | 474 | ||
475 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); | 475 | $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text'])); |
476 | $this->assertContains($expectedMessage, $alert[0]); | 476 | $this->assertContains($expectedMessage, $alert[0]); |
477 | } | 477 | } |
478 | 478 | ||
@@ -487,10 +487,10 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
487 | 487 | ||
488 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); | 488 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); |
489 | 489 | ||
490 | $data = array( | 490 | $data = [ |
491 | 'tagging_rule[rule]' => 'readingTime <= 3', | 491 | 'tagging_rule[rule]' => 'readingTime <= 3', |
492 | 'tagging_rule[tags]' => 'short reading', | 492 | 'tagging_rule[tags]' => 'short reading', |
493 | ); | 493 | ]; |
494 | 494 | ||
495 | $client->submit($form, $data); | 495 | $client->submit($form, $data); |
496 | 496 | ||
@@ -498,7 +498,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
498 | 498 | ||
499 | $crawler = $client->followRedirect(); | 499 | $crawler = $client->followRedirect(); |
500 | 500 | ||
501 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 501 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
502 | $this->assertContains('flashes.config.notice.tagging_rules_updated', $alert[0]); | 502 | $this->assertContains('flashes.config.notice.tagging_rules_updated', $alert[0]); |
503 | 503 | ||
504 | $deleteLink = $crawler->filter('.delete')->last()->link(); | 504 | $deleteLink = $crawler->filter('.delete')->last()->link(); |
@@ -507,34 +507,34 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
507 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 507 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
508 | 508 | ||
509 | $crawler = $client->followRedirect(); | 509 | $crawler = $client->followRedirect(); |
510 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 510 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text'])); |
511 | $this->assertContains('flashes.config.notice.tagging_rules_deleted', $alert[0]); | 511 | $this->assertContains('flashes.config.notice.tagging_rules_deleted', $alert[0]); |
512 | } | 512 | } |
513 | 513 | ||
514 | public function dataForTaggingRuleFailed() | 514 | public function dataForTaggingRuleFailed() |
515 | { | 515 | { |
516 | return array( | 516 | return [ |
517 | array( | 517 | [ |
518 | array( | 518 | [ |
519 | 'tagging_rule[rule]' => 'unknownVar <= 3', | 519 | 'tagging_rule[rule]' => 'unknownVar <= 3', |
520 | 'tagging_rule[tags]' => 'cool tag', | 520 | 'tagging_rule[tags]' => 'cool tag', |
521 | ), | 521 | ], |
522 | array( | 522 | [ |
523 | 'The variable', | 523 | 'The variable', |
524 | 'does not exist.', | 524 | 'does not exist.', |
525 | ), | 525 | ], |
526 | ), | 526 | ], |
527 | array( | 527 | [ |
528 | array( | 528 | [ |
529 | 'tagging_rule[rule]' => 'length(domainName) <= 42', | 529 | 'tagging_rule[rule]' => 'length(domainName) <= 42', |
530 | 'tagging_rule[tags]' => 'cool tag', | 530 | 'tagging_rule[tags]' => 'cool tag', |
531 | ), | 531 | ], |
532 | array( | 532 | [ |
533 | 'The operator', | 533 | 'The operator', |
534 | 'does not exist.', | 534 | 'does not exist.', |
535 | ), | 535 | ], |
536 | ), | 536 | ], |
537 | ); | 537 | ]; |
538 | } | 538 | } |
539 | 539 | ||
540 | /** | 540 | /** |
@@ -555,7 +555,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
555 | 555 | ||
556 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 556 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
557 | 557 | ||
558 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 558 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
559 | 559 | ||
560 | foreach ($messages as $message) { | 560 | foreach ($messages as $message) { |
561 | $this->assertContains($message, $body[0]); | 561 | $this->assertContains($message, $body[0]); |
@@ -574,7 +574,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
574 | $crawler = $client->request('GET', '/tagging-rule/delete/'.$rule->getId()); | 574 | $crawler = $client->request('GET', '/tagging-rule/delete/'.$rule->getId()); |
575 | 575 | ||
576 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | 576 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); |
577 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 577 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
578 | $this->assertContains('You can not access this tagging rule', $body[0]); | 578 | $this->assertContains('You can not access this tagging rule', $body[0]); |
579 | } | 579 | } |
580 | 580 | ||
@@ -593,11 +593,11 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
593 | 593 | ||
594 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); | 594 | $form = $crawler->filter('button[id=change_passwd_save]')->form(); |
595 | 595 | ||
596 | $data = array( | 596 | $data = [ |
597 | 'change_passwd[old_password]' => 'mypassword', | 597 | 'change_passwd[old_password]' => 'mypassword', |
598 | 'change_passwd[new_password][first]' => 'mypassword', | 598 | 'change_passwd[new_password][first]' => 'mypassword', |
599 | 'change_passwd[new_password][second]' => 'mypassword', | 599 | 'change_passwd[new_password][second]' => 'mypassword', |
600 | ); | 600 | ]; |
601 | 601 | ||
602 | $client->submit($form, $data); | 602 | $client->submit($form, $data); |
603 | 603 | ||
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 46fbaf91..5260ca53 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | |||
@@ -28,7 +28,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
28 | $crawler = $client->followRedirect(); | 28 | $crawler = $client->followRedirect(); |
29 | 29 | ||
30 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 30 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
31 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 31 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
32 | $this->assertContains('quickstart.intro.paragraph_1', $body[0]); | 32 | $this->assertContains('quickstart.intro.paragraph_1', $body[0]); |
33 | 33 | ||
34 | // Test if quickstart is disabled when user has 1 entry | 34 | // Test if quickstart is disabled when user has 1 entry |
@@ -38,16 +38,16 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
38 | 38 | ||
39 | $form = $crawler->filter('form[name=entry]')->form(); | 39 | $form = $crawler->filter('form[name=entry]')->form(); |
40 | 40 | ||
41 | $data = array( | 41 | $data = [ |
42 | 'entry[url]' => $this->url, | 42 | 'entry[url]' => $this->url, |
43 | ); | 43 | ]; |
44 | 44 | ||
45 | $client->submit($form, $data); | 45 | $client->submit($form, $data); |
46 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 46 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
47 | $client->followRedirect(); | 47 | $client->followRedirect(); |
48 | 48 | ||
49 | $crawler = $client->request('GET', '/unread/list'); | 49 | $crawler = $client->request('GET', '/unread/list'); |
50 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 50 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
51 | $this->assertContains('entry.list.number_on_the_page', $body[0]); | 51 | $this->assertContains('entry.list.number_on_the_page', $body[0]); |
52 | } | 52 | } |
53 | 53 | ||
@@ -74,7 +74,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
74 | $this->assertCount(4, $crawler->filter('div[class=entry]')); | 74 | $this->assertCount(4, $crawler->filter('div[class=entry]')); |
75 | 75 | ||
76 | // Good URL | 76 | // Good URL |
77 | $client->request('GET', '/bookmarklet', array('url' => $this->url)); | 77 | $client->request('GET', '/bookmarklet', ['url' => $this->url]); |
78 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 78 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
79 | $client->followRedirect(); | 79 | $client->followRedirect(); |
80 | $crawler = $client->request('GET', '/'); | 80 | $crawler = $client->request('GET', '/'); |
@@ -103,7 +103,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
103 | $crawler = $client->submit($form); | 103 | $crawler = $client->submit($form); |
104 | 104 | ||
105 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 105 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
106 | $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(array('_text'))); | 106 | $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(['_text'])); |
107 | $this->assertEquals('This value should not be blank.', $alert[0]); | 107 | $this->assertEquals('This value should not be blank.', $alert[0]); |
108 | } | 108 | } |
109 | 109 | ||
@@ -121,9 +121,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
121 | 121 | ||
122 | $form = $crawler->filter('form[name=entry]')->form(); | 122 | $form = $crawler->filter('form[name=entry]')->form(); |
123 | 123 | ||
124 | $data = array( | 124 | $data = [ |
125 | 'entry[url]' => $this->url, | 125 | 'entry[url]' => $this->url, |
126 | ); | 126 | ]; |
127 | 127 | ||
128 | $client->submit($form, $data); | 128 | $client->submit($form, $data); |
129 | 129 | ||
@@ -150,9 +150,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
150 | 150 | ||
151 | $form = $crawler->filter('form[name=entry]')->form(); | 151 | $form = $crawler->filter('form[name=entry]')->form(); |
152 | 152 | ||
153 | $data = array( | 153 | $data = [ |
154 | 'entry[url]' => $this->url, | 154 | 'entry[url]' => $this->url, |
155 | ); | 155 | ]; |
156 | 156 | ||
157 | $client->submit($form, $data); | 157 | $client->submit($form, $data); |
158 | 158 | ||
@@ -174,9 +174,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
174 | 174 | ||
175 | $form = $crawler->filter('form[name=entry]')->form(); | 175 | $form = $crawler->filter('form[name=entry]')->form(); |
176 | 176 | ||
177 | $data = array( | 177 | $data = [ |
178 | 'entry[url]' => $url = 'https://github.com/wallabag/wallabag', | 178 | 'entry[url]' => $url = 'https://github.com/wallabag/wallabag', |
179 | ); | 179 | ]; |
180 | 180 | ||
181 | $client->submit($form, $data); | 181 | $client->submit($form, $data); |
182 | 182 | ||
@@ -245,7 +245,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
245 | $crawler = $client->request('GET', '/view/'.$content->getId()); | 245 | $crawler = $client->request('GET', '/view/'.$content->getId()); |
246 | 246 | ||
247 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 247 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
248 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 248 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
249 | $this->assertContains($content->getTitle(), $body[0]); | 249 | $this->assertContains($content->getTitle(), $body[0]); |
250 | } | 250 | } |
251 | 251 | ||
@@ -315,9 +315,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
315 | 315 | ||
316 | $form = $crawler->filter('button[type=submit]')->form(); | 316 | $form = $crawler->filter('button[type=submit]')->form(); |
317 | 317 | ||
318 | $data = array( | 318 | $data = [ |
319 | 'entry[title]' => 'My updated title hehe :)', | 319 | 'entry[title]' => 'My updated title hehe :)', |
320 | ); | 320 | ]; |
321 | 321 | ||
322 | $client->submit($form, $data); | 322 | $client->submit($form, $data); |
323 | 323 | ||
@@ -325,7 +325,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
325 | 325 | ||
326 | $crawler = $client->followRedirect(); | 326 | $crawler = $client->followRedirect(); |
327 | 327 | ||
328 | $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(array('_text'))); | 328 | $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(['_text'])); |
329 | $this->assertContains('My updated title hehe :)', $alert[0]); | 329 | $this->assertContains('My updated title hehe :)', $alert[0]); |
330 | } | 330 | } |
331 | 331 | ||
@@ -461,10 +461,10 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
461 | 461 | ||
462 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 462 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
463 | 463 | ||
464 | $data = array( | 464 | $data = [ |
465 | 'entry_filter[readingTime][right_number]' => 11, | 465 | 'entry_filter[readingTime][right_number]' => 11, |
466 | 'entry_filter[readingTime][left_number]' => 11, | 466 | 'entry_filter[readingTime][left_number]' => 11, |
467 | ); | 467 | ]; |
468 | 468 | ||
469 | $crawler = $client->submit($form, $data); | 469 | $crawler = $client->submit($form, $data); |
470 | 470 | ||
@@ -480,28 +480,28 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
480 | 480 | ||
481 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 481 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
482 | 482 | ||
483 | $data = array( | 483 | $data = [ |
484 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), | 484 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), |
485 | 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime('+1 day')), | 485 | 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime('+1 day')), |
486 | ); | 486 | ]; |
487 | 487 | ||
488 | $crawler = $client->submit($form, $data); | 488 | $crawler = $client->submit($form, $data); |
489 | 489 | ||
490 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | 490 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
491 | 491 | ||
492 | $data = array( | 492 | $data = [ |
493 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), | 493 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), |
494 | 'entry_filter[createdAt][right_date]' => date('d/m/Y'), | 494 | 'entry_filter[createdAt][right_date]' => date('d/m/Y'), |
495 | ); | 495 | ]; |
496 | 496 | ||
497 | $crawler = $client->submit($form, $data); | 497 | $crawler = $client->submit($form, $data); |
498 | 498 | ||
499 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | 499 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
500 | 500 | ||
501 | $data = array( | 501 | $data = [ |
502 | 'entry_filter[createdAt][left_date]' => '01/01/1970', | 502 | 'entry_filter[createdAt][left_date]' => '01/01/1970', |
503 | 'entry_filter[createdAt][right_date]' => '01/01/1970', | 503 | 'entry_filter[createdAt][right_date]' => '01/01/1970', |
504 | ); | 504 | ]; |
505 | 505 | ||
506 | $crawler = $client->submit($form, $data); | 506 | $crawler = $client->submit($form, $data); |
507 | 507 | ||
@@ -516,9 +516,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
516 | 516 | ||
517 | $form = $crawler->filter('button[id=config_save]')->form(); | 517 | $form = $crawler->filter('button[id=config_save]')->form(); |
518 | 518 | ||
519 | $data = array( | 519 | $data = [ |
520 | 'config[items_per_page]' => '1', | 520 | 'config[items_per_page]' => '1', |
521 | ); | 521 | ]; |
522 | 522 | ||
523 | $client->submit($form, $data); | 523 | $client->submit($form, $data); |
524 | 524 | ||
@@ -531,9 +531,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
531 | // reset pagination | 531 | // reset pagination |
532 | $crawler = $client->request('GET', '/config'); | 532 | $crawler = $client->request('GET', '/config'); |
533 | $form = $crawler->filter('button[id=config_save]')->form(); | 533 | $form = $crawler->filter('button[id=config_save]')->form(); |
534 | $data = array( | 534 | $data = [ |
535 | 'config[items_per_page]' => '12', | 535 | 'config[items_per_page]' => '12', |
536 | ); | 536 | ]; |
537 | $client->submit($form, $data); | 537 | $client->submit($form, $data); |
538 | } | 538 | } |
539 | 539 | ||
@@ -544,17 +544,17 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
544 | 544 | ||
545 | $crawler = $client->request('GET', '/unread/list'); | 545 | $crawler = $client->request('GET', '/unread/list'); |
546 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 546 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
547 | $data = array( | 547 | $data = [ |
548 | 'entry_filter[domainName]' => 'domain', | 548 | 'entry_filter[domainName]' => 'domain', |
549 | ); | 549 | ]; |
550 | 550 | ||
551 | $crawler = $client->submit($form, $data); | 551 | $crawler = $client->submit($form, $data); |
552 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | 552 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
553 | 553 | ||
554 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 554 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
555 | $data = array( | 555 | $data = [ |
556 | 'entry_filter[domainName]' => 'wallabag', | 556 | 'entry_filter[domainName]' => 'wallabag', |
557 | ); | 557 | ]; |
558 | 558 | ||
559 | $crawler = $client->submit($form, $data); | 559 | $crawler = $client->submit($form, $data); |
560 | $this->assertCount(0, $crawler->filter('div[class=entry]')); | 560 | $this->assertCount(0, $crawler->filter('div[class=entry]')); |
@@ -601,17 +601,17 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
601 | 601 | ||
602 | $crawler = $client->request('GET', '/unread/list'); | 602 | $crawler = $client->request('GET', '/unread/list'); |
603 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 603 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
604 | $data = array( | 604 | $data = [ |
605 | 'entry_filter[language]' => 'fr', | 605 | 'entry_filter[language]' => 'fr', |
606 | ); | 606 | ]; |
607 | 607 | ||
608 | $crawler = $client->submit($form, $data); | 608 | $crawler = $client->submit($form, $data); |
609 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 609 | $this->assertCount(2, $crawler->filter('div[class=entry]')); |
610 | 610 | ||
611 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 611 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
612 | $data = array( | 612 | $data = [ |
613 | 'entry_filter[language]' => 'en', | 613 | 'entry_filter[language]' => 'en', |
614 | ); | 614 | ]; |
615 | 615 | ||
616 | $crawler = $client->submit($form, $data); | 616 | $crawler = $client->submit($form, $data); |
617 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 617 | $this->assertCount(2, $crawler->filter('div[class=entry]')); |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php index 45a74c43..87a01b8e 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/RssControllerTest.php | |||
@@ -34,17 +34,17 @@ class RssControllerTest extends WallabagCoreTestCase | |||
34 | 34 | ||
35 | public function dataForBadUrl() | 35 | public function dataForBadUrl() |
36 | { | 36 | { |
37 | return array( | 37 | return [ |
38 | array( | 38 | [ |
39 | '/admin/YZIOAUZIAO/unread.xml', | 39 | '/admin/YZIOAUZIAO/unread.xml', |
40 | ), | 40 | ], |
41 | array( | 41 | [ |
42 | '/wallace/YZIOAUZIAO/starred.xml', | 42 | '/wallace/YZIOAUZIAO/starred.xml', |
43 | ), | 43 | ], |
44 | array( | 44 | [ |
45 | '/wallace/YZIOAUZIAO/archives.xml', | 45 | '/wallace/YZIOAUZIAO/archives.xml', |
46 | ), | 46 | ], |
47 | ); | 47 | ]; |
48 | } | 48 | } |
49 | 49 | ||
50 | /** | 50 | /** |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php index ed292633..2910fa4f 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php | |||
@@ -13,7 +13,7 @@ class SecurityControllerTest extends WallabagCoreTestCase | |||
13 | $client->followRedirects(); | 13 | $client->followRedirects(); |
14 | 14 | ||
15 | $crawler = $client->request('GET', '/config'); | 15 | $crawler = $client->request('GET', '/config'); |
16 | $this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(array('_text'))[0]); | 16 | $this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(['_text'])[0]); |
17 | } | 17 | } |
18 | 18 | ||
19 | public function testLoginWith2Factor() | 19 | public function testLoginWith2Factor() |
@@ -38,7 +38,7 @@ class SecurityControllerTest extends WallabagCoreTestCase | |||
38 | 38 | ||
39 | $this->logInAs('admin'); | 39 | $this->logInAs('admin'); |
40 | $crawler = $client->request('GET', '/config'); | 40 | $crawler = $client->request('GET', '/config'); |
41 | $this->assertContains('scheb_two_factor.trusted', $crawler->filter('body')->extract(array('_text'))[0]); | 41 | $this->assertContains('scheb_two_factor.trusted', $crawler->filter('body')->extract(['_text'])[0]); |
42 | 42 | ||
43 | // restore user | 43 | // restore user |
44 | $user = $em | 44 | $user = $em |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php index 1457c807..8af37ea4 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php | |||
@@ -32,9 +32,9 @@ class TagControllerTest extends WallabagCoreTestCase | |||
32 | 32 | ||
33 | $form = $crawler->filter('form[name=tag]')->form(); | 33 | $form = $crawler->filter('form[name=tag]')->form(); |
34 | 34 | ||
35 | $data = array( | 35 | $data = [ |
36 | 'tag[label]' => $this->tagName, | 36 | 'tag[label]' => $this->tagName, |
37 | ); | 37 | ]; |
38 | 38 | ||
39 | $client->submit($form, $data); | 39 | $client->submit($form, $data); |
40 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 40 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
@@ -53,9 +53,9 @@ class TagControllerTest extends WallabagCoreTestCase | |||
53 | $this->assertEquals(1, count($newEntry->getTags())); | 53 | $this->assertEquals(1, count($newEntry->getTags())); |
54 | 54 | ||
55 | # tag already exists but still not assigned to this entry | 55 | # tag already exists but still not assigned to this entry |
56 | $data = array( | 56 | $data = [ |
57 | 'tag[label]' => 'foo', | 57 | 'tag[label]' => 'foo', |
58 | ); | 58 | ]; |
59 | 59 | ||
60 | $client->submit($form, $data); | 60 | $client->submit($form, $data); |
61 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 61 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
@@ -82,9 +82,9 @@ class TagControllerTest extends WallabagCoreTestCase | |||
82 | 82 | ||
83 | $form = $crawler->filter('form[name=tag]')->form(); | 83 | $form = $crawler->filter('form[name=tag]')->form(); |
84 | 84 | ||
85 | $data = array( | 85 | $data = [ |
86 | 'tag[label]' => 'foo2, bar2', | 86 | 'tag[label]' => 'foo2, bar2', |
87 | ); | 87 | ]; |
88 | 88 | ||
89 | $client->submit($form, $data); | 89 | $client->submit($form, $data); |
90 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 90 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
diff --git a/src/Wallabag/CoreBundle/Tests/Form/DataTransformer/StringToListTransformerTest.php b/src/Wallabag/CoreBundle/Tests/Form/DataTransformer/StringToListTransformerTest.php index 7105488d..6b1e8613 100644 --- a/src/Wallabag/CoreBundle/Tests/Form/DataTransformer/StringToListTransformerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Form/DataTransformer/StringToListTransformerTest.php | |||
@@ -18,12 +18,12 @@ class StringToListTransformerTest extends \PHPUnit_Framework_TestCase | |||
18 | 18 | ||
19 | public function transformProvider() | 19 | public function transformProvider() |
20 | { | 20 | { |
21 | return array( | 21 | return [ |
22 | array(null, ''), | 22 | [null, ''], |
23 | array(array(), ''), | 23 | [[], ''], |
24 | array(array('single value'), 'single value'), | 24 | [['single value'], 'single value'], |
25 | array(array('first value', 'second value'), 'first value,second value'), | 25 | [['first value', 'second value'], 'first value,second value'], |
26 | ); | 26 | ]; |
27 | } | 27 | } |
28 | 28 | ||
29 | /** | 29 | /** |
@@ -38,13 +38,13 @@ class StringToListTransformerTest extends \PHPUnit_Framework_TestCase | |||
38 | 38 | ||
39 | public function reverseTransformProvider() | 39 | public function reverseTransformProvider() |
40 | { | 40 | { |
41 | return array( | 41 | return [ |
42 | array(null, null), | 42 | [null, null], |
43 | array('', array()), | 43 | ['', []], |
44 | array('single value', array('single value')), | 44 | ['single value', ['single value']], |
45 | array('first value,second value', array('first value', 'second value')), | 45 | ['first value,second value', ['first value', 'second value']], |
46 | array('first value, second value', array('first value', 'second value')), | 46 | ['first value, second value', ['first value', 'second value']], |
47 | array('first value, , second value', array('first value', 'second value')), | 47 | ['first value, , second value', ['first value', 'second value']], |
48 | ); | 48 | ]; |
49 | } | 49 | } |
50 | } | 50 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php index 74bfb054..9d7b0f36 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php | |||
@@ -17,19 +17,19 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
17 | ->method('tag'); | 17 | ->method('tag'); |
18 | 18 | ||
19 | $graby = $this->getMockBuilder('Graby\Graby') | 19 | $graby = $this->getMockBuilder('Graby\Graby') |
20 | ->setMethods(array('fetchContent')) | 20 | ->setMethods(['fetchContent']) |
21 | ->disableOriginalConstructor() | 21 | ->disableOriginalConstructor() |
22 | ->getMock(); | 22 | ->getMock(); |
23 | 23 | ||
24 | $graby->expects($this->any()) | 24 | $graby->expects($this->any()) |
25 | ->method('fetchContent') | 25 | ->method('fetchContent') |
26 | ->willReturn(array( | 26 | ->willReturn([ |
27 | 'html' => false, | 27 | 'html' => false, |
28 | 'title' => '', | 28 | 'title' => '', |
29 | 'url' => '', | 29 | 'url' => '', |
30 | 'content_type' => '', | 30 | 'content_type' => '', |
31 | 'language' => '', | 31 | 'language' => '', |
32 | )); | 32 | ]); |
33 | 33 | ||
34 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 34 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); |
35 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); | 35 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); |
@@ -51,19 +51,19 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
51 | ->method('tag'); | 51 | ->method('tag'); |
52 | 52 | ||
53 | $graby = $this->getMockBuilder('Graby\Graby') | 53 | $graby = $this->getMockBuilder('Graby\Graby') |
54 | ->setMethods(array('fetchContent')) | 54 | ->setMethods(['fetchContent']) |
55 | ->disableOriginalConstructor() | 55 | ->disableOriginalConstructor() |
56 | ->getMock(); | 56 | ->getMock(); |
57 | 57 | ||
58 | $graby->expects($this->any()) | 58 | $graby->expects($this->any()) |
59 | ->method('fetchContent') | 59 | ->method('fetchContent') |
60 | ->willReturn(array( | 60 | ->willReturn([ |
61 | 'html' => false, | 61 | 'html' => false, |
62 | 'title' => '', | 62 | 'title' => '', |
63 | 'url' => '', | 63 | 'url' => '', |
64 | 'content_type' => '', | 64 | 'content_type' => '', |
65 | 'language' => '', | 65 | 'language' => '', |
66 | )); | 66 | ]); |
67 | 67 | ||
68 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 68 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); |
69 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); | 69 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); |
@@ -85,23 +85,23 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
85 | ->method('tag'); | 85 | ->method('tag'); |
86 | 86 | ||
87 | $graby = $this->getMockBuilder('Graby\Graby') | 87 | $graby = $this->getMockBuilder('Graby\Graby') |
88 | ->setMethods(array('fetchContent')) | 88 | ->setMethods(['fetchContent']) |
89 | ->disableOriginalConstructor() | 89 | ->disableOriginalConstructor() |
90 | ->getMock(); | 90 | ->getMock(); |
91 | 91 | ||
92 | $graby->expects($this->any()) | 92 | $graby->expects($this->any()) |
93 | ->method('fetchContent') | 93 | ->method('fetchContent') |
94 | ->willReturn(array( | 94 | ->willReturn([ |
95 | 'html' => false, | 95 | 'html' => false, |
96 | 'title' => '', | 96 | 'title' => '', |
97 | 'url' => '', | 97 | 'url' => '', |
98 | 'content_type' => '', | 98 | 'content_type' => '', |
99 | 'language' => '', | 99 | 'language' => '', |
100 | 'open_graph' => array( | 100 | 'open_graph' => [ |
101 | 'og_title' => 'my title', | 101 | 'og_title' => 'my title', |
102 | 'og_description' => 'desc', | 102 | 'og_description' => 'desc', |
103 | ), | 103 | ], |
104 | )); | 104 | ]); |
105 | 105 | ||
106 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 106 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); |
107 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); | 107 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); |
@@ -123,24 +123,24 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
123 | ->method('tag'); | 123 | ->method('tag'); |
124 | 124 | ||
125 | $graby = $this->getMockBuilder('Graby\Graby') | 125 | $graby = $this->getMockBuilder('Graby\Graby') |
126 | ->setMethods(array('fetchContent')) | 126 | ->setMethods(['fetchContent']) |
127 | ->disableOriginalConstructor() | 127 | ->disableOriginalConstructor() |
128 | ->getMock(); | 128 | ->getMock(); |
129 | 129 | ||
130 | $graby->expects($this->any()) | 130 | $graby->expects($this->any()) |
131 | ->method('fetchContent') | 131 | ->method('fetchContent') |
132 | ->willReturn(array( | 132 | ->willReturn([ |
133 | 'html' => str_repeat('this is my content', 325), | 133 | 'html' => str_repeat('this is my content', 325), |
134 | 'title' => 'this is my title', | 134 | 'title' => 'this is my title', |
135 | 'url' => 'http://1.1.1.1', | 135 | 'url' => 'http://1.1.1.1', |
136 | 'content_type' => 'text/html', | 136 | 'content_type' => 'text/html', |
137 | 'language' => 'fr', | 137 | 'language' => 'fr', |
138 | 'open_graph' => array( | 138 | 'open_graph' => [ |
139 | 'og_title' => 'my OG title', | 139 | 'og_title' => 'my OG title', |
140 | 'og_description' => 'OG desc', | 140 | 'og_description' => 'OG desc', |
141 | 'og_image' => 'http://3.3.3.3/cover.jpg', | 141 | 'og_image' => 'http://3.3.3.3/cover.jpg', |
142 | ), | 142 | ], |
143 | )); | 143 | ]); |
144 | 144 | ||
145 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 145 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); |
146 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); | 146 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); |
@@ -217,7 +217,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
217 | 217 | ||
218 | $entry = new Entry(new User()); | 218 | $entry = new Entry(new User()); |
219 | 219 | ||
220 | $proxy->assignTagsToEntry($entry, array(' tag1', 'tag2 ')); | 220 | $proxy->assignTagsToEntry($entry, [' tag1', 'tag2 ']); |
221 | 221 | ||
222 | $this->assertCount(2, $entry->getTags()); | 222 | $this->assertCount(2, $entry->getTags()); |
223 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | 223 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); |
@@ -253,7 +253,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
253 | 253 | ||
254 | $entry = new Entry(new User()); | 254 | $entry = new Entry(new User()); |
255 | 255 | ||
256 | $proxy->assignTagsToEntry($entry, array()); | 256 | $proxy->assignTagsToEntry($entry, []); |
257 | 257 | ||
258 | $this->assertCount(0, $entry->getTags()); | 258 | $this->assertCount(0, $entry->getTags()); |
259 | } | 259 | } |
@@ -299,7 +299,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
299 | private function getTaggerMock() | 299 | private function getTaggerMock() |
300 | { | 300 | { |
301 | return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') | 301 | return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') |
302 | ->setMethods(array('tag')) | 302 | ->setMethods(['tag']) |
303 | ->disableOriginalConstructor() | 303 | ->disableOriginalConstructor() |
304 | ->getMock(); | 304 | ->getMock(); |
305 | } | 305 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php index c43c62c3..e9025b45 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php | |||
@@ -36,7 +36,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
36 | 36 | ||
37 | public function testTagWithNoMatchingRule() | 37 | public function testTagWithNoMatchingRule() |
38 | { | 38 | { |
39 | $taggingRule = $this->getTaggingRule('rule as string', array('foo', 'bar')); | 39 | $taggingRule = $this->getTaggingRule('rule as string', ['foo', 'bar']); |
40 | $user = $this->getUser([$taggingRule]); | 40 | $user = $this->getUser([$taggingRule]); |
41 | $entry = new Entry($user); | 41 | $entry = new Entry($user); |
42 | 42 | ||
@@ -53,7 +53,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
53 | 53 | ||
54 | public function testTagWithAMatchingRule() | 54 | public function testTagWithAMatchingRule() |
55 | { | 55 | { |
56 | $taggingRule = $this->getTaggingRule('rule as string', array('foo', 'bar')); | 56 | $taggingRule = $this->getTaggingRule('rule as string', ['foo', 'bar']); |
57 | $user = $this->getUser([$taggingRule]); | 57 | $user = $this->getUser([$taggingRule]); |
58 | $entry = new Entry($user); | 58 | $entry = new Entry($user); |
59 | 59 | ||
@@ -74,8 +74,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
74 | 74 | ||
75 | public function testTagWithAMixOfMatchingRules() | 75 | public function testTagWithAMixOfMatchingRules() |
76 | { | 76 | { |
77 | $taggingRule = $this->getTaggingRule('bla bla', array('hey')); | 77 | $taggingRule = $this->getTaggingRule('bla bla', ['hey']); |
78 | $otherTaggingRule = $this->getTaggingRule('rule as string', array('foo')); | 78 | $otherTaggingRule = $this->getTaggingRule('rule as string', ['foo']); |
79 | 79 | ||
80 | $user = $this->getUser([$taggingRule, $otherTaggingRule]); | 80 | $user = $this->getUser([$taggingRule, $otherTaggingRule]); |
81 | $entry = new Entry($user); | 81 | $entry = new Entry($user); |
@@ -94,7 +94,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
94 | 94 | ||
95 | public function testWhenTheTagExists() | 95 | public function testWhenTheTagExists() |
96 | { | 96 | { |
97 | $taggingRule = $this->getTaggingRule('rule as string', array('foo')); | 97 | $taggingRule = $this->getTaggingRule('rule as string', ['foo']); |
98 | $user = $this->getUser([$taggingRule]); | 98 | $user = $this->getUser([$taggingRule]); |
99 | $entry = new Entry($user); | 99 | $entry = new Entry($user); |
100 | $tag = new Tag(); | 100 | $tag = new Tag(); |
@@ -122,8 +122,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
122 | 122 | ||
123 | public function testSameTagWithDifferentfMatchingRules() | 123 | public function testSameTagWithDifferentfMatchingRules() |
124 | { | 124 | { |
125 | $taggingRule = $this->getTaggingRule('bla bla', array('hey')); | 125 | $taggingRule = $this->getTaggingRule('bla bla', ['hey']); |
126 | $otherTaggingRule = $this->getTaggingRule('rule as string', array('hey')); | 126 | $otherTaggingRule = $this->getTaggingRule('rule as string', ['hey']); |
127 | 127 | ||
128 | $user = $this->getUser([$taggingRule, $otherTaggingRule]); | 128 | $user = $this->getUser([$taggingRule, $otherTaggingRule]); |
129 | $entry = new Entry($user); | 129 | $entry = new Entry($user); |
@@ -142,7 +142,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
142 | 142 | ||
143 | public function testTagAllEntriesForAUser() | 143 | public function testTagAllEntriesForAUser() |
144 | { | 144 | { |
145 | $taggingRule = $this->getTaggingRule('bla bla', array('hey')); | 145 | $taggingRule = $this->getTaggingRule('bla bla', ['hey']); |
146 | 146 | ||
147 | $user = $this->getUser([$taggingRule]); | 147 | $user = $this->getUser([$taggingRule]); |
148 | 148 | ||
@@ -152,7 +152,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase | |||
152 | 152 | ||
153 | $this->rulerz | 153 | $this->rulerz |
154 | ->method('filter') | 154 | ->method('filter') |
155 | ->willReturn(array(new Entry($user), new Entry($user))); | 155 | ->willReturn([new Entry($user), new Entry($user)]); |
156 | 156 | ||
157 | $entries = $this->tagger->tagAllForUser($user); | 157 | $entries = $this->tagger->tagAllForUser($user); |
158 | 158 | ||
diff --git a/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php b/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php index 69bc48e0..ff9cdafd 100644 --- a/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php +++ b/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php | |||
@@ -15,7 +15,7 @@ use Wallabag\CoreBundle\Command\InstallCommand; | |||
15 | */ | 15 | */ |
16 | class InstallCommandMock extends InstallCommand | 16 | class InstallCommandMock extends InstallCommand |
17 | { | 17 | { |
18 | protected function runCommand($command, $parameters = array()) | 18 | protected function runCommand($command, $parameters = []) |
19 | { | 19 | { |
20 | return $this; | 20 | return $this; |
21 | } | 21 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php b/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php index b95be133..ee10938a 100644 --- a/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php +++ b/src/Wallabag/CoreBundle/Tests/ParamConverter/UsernameRssTokenConverterTest.php | |||
@@ -11,7 +11,7 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
11 | { | 11 | { |
12 | public function testSupportsWithNoRegistry() | 12 | public function testSupportsWithNoRegistry() |
13 | { | 13 | { |
14 | $params = new ParamConverter(array()); | 14 | $params = new ParamConverter([]); |
15 | $converter = new UsernameRssTokenConverter(); | 15 | $converter = new UsernameRssTokenConverter(); |
16 | 16 | ||
17 | $this->assertFalse($converter->supports($params)); | 17 | $this->assertFalse($converter->supports($params)); |
@@ -25,9 +25,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
25 | 25 | ||
26 | $registry->expects($this->once()) | 26 | $registry->expects($this->once()) |
27 | ->method('getManagers') | 27 | ->method('getManagers') |
28 | ->will($this->returnValue(array())); | 28 | ->will($this->returnValue([])); |
29 | 29 | ||
30 | $params = new ParamConverter(array()); | 30 | $params = new ParamConverter([]); |
31 | $converter = new UsernameRssTokenConverter($registry); | 31 | $converter = new UsernameRssTokenConverter($registry); |
32 | 32 | ||
33 | $this->assertFalse($converter->supports($params)); | 33 | $this->assertFalse($converter->supports($params)); |
@@ -41,9 +41,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
41 | 41 | ||
42 | $registry->expects($this->once()) | 42 | $registry->expects($this->once()) |
43 | ->method('getManagers') | 43 | ->method('getManagers') |
44 | ->will($this->returnValue(array('default' => null))); | 44 | ->will($this->returnValue(['default' => null])); |
45 | 45 | ||
46 | $params = new ParamConverter(array()); | 46 | $params = new ParamConverter([]); |
47 | $converter = new UsernameRssTokenConverter($registry); | 47 | $converter = new UsernameRssTokenConverter($registry); |
48 | 48 | ||
49 | $this->assertFalse($converter->supports($params)); | 49 | $this->assertFalse($converter->supports($params)); |
@@ -74,14 +74,14 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
74 | 74 | ||
75 | $registry->expects($this->once()) | 75 | $registry->expects($this->once()) |
76 | ->method('getManagers') | 76 | ->method('getManagers') |
77 | ->will($this->returnValue(array('default' => null))); | 77 | ->will($this->returnValue(['default' => null])); |
78 | 78 | ||
79 | $registry->expects($this->once()) | 79 | $registry->expects($this->once()) |
80 | ->method('getManagerForClass') | 80 | ->method('getManagerForClass') |
81 | ->with('superclass') | 81 | ->with('superclass') |
82 | ->will($this->returnValue($em)); | 82 | ->will($this->returnValue($em)); |
83 | 83 | ||
84 | $params = new ParamConverter(array('class' => 'superclass')); | 84 | $params = new ParamConverter(['class' => 'superclass']); |
85 | $converter = new UsernameRssTokenConverter($registry); | 85 | $converter = new UsernameRssTokenConverter($registry); |
86 | 86 | ||
87 | $this->assertFalse($converter->supports($params)); | 87 | $this->assertFalse($converter->supports($params)); |
@@ -112,14 +112,14 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
112 | 112 | ||
113 | $registry->expects($this->once()) | 113 | $registry->expects($this->once()) |
114 | ->method('getManagers') | 114 | ->method('getManagers') |
115 | ->will($this->returnValue(array('default' => null))); | 115 | ->will($this->returnValue(['default' => null])); |
116 | 116 | ||
117 | $registry->expects($this->once()) | 117 | $registry->expects($this->once()) |
118 | ->method('getManagerForClass') | 118 | ->method('getManagerForClass') |
119 | ->with('WallabagUserBundle:User') | 119 | ->with('WallabagUserBundle:User') |
120 | ->will($this->returnValue($em)); | 120 | ->will($this->returnValue($em)); |
121 | 121 | ||
122 | $params = new ParamConverter(array('class' => 'WallabagUserBundle:User')); | 122 | $params = new ParamConverter(['class' => 'WallabagUserBundle:User']); |
123 | $converter = new UsernameRssTokenConverter($registry); | 123 | $converter = new UsernameRssTokenConverter($registry); |
124 | 124 | ||
125 | $this->assertTrue($converter->supports($params)); | 125 | $this->assertTrue($converter->supports($params)); |
@@ -131,7 +131,7 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
131 | */ | 131 | */ |
132 | public function testApplyEmptyRequest() | 132 | public function testApplyEmptyRequest() |
133 | { | 133 | { |
134 | $params = new ParamConverter(array()); | 134 | $params = new ParamConverter([]); |
135 | $converter = new UsernameRssTokenConverter(); | 135 | $converter = new UsernameRssTokenConverter(); |
136 | 136 | ||
137 | $converter->apply(new Request(), $params); | 137 | $converter->apply(new Request(), $params); |
@@ -170,9 +170,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
170 | ->with('WallabagUserBundle:User') | 170 | ->with('WallabagUserBundle:User') |
171 | ->will($this->returnValue($em)); | 171 | ->will($this->returnValue($em)); |
172 | 172 | ||
173 | $params = new ParamConverter(array('class' => 'WallabagUserBundle:User')); | 173 | $params = new ParamConverter(['class' => 'WallabagUserBundle:User']); |
174 | $converter = new UsernameRssTokenConverter($registry); | 174 | $converter = new UsernameRssTokenConverter($registry); |
175 | $request = new Request(array(), array(), array('username' => 'test', 'token' => 'test')); | 175 | $request = new Request([], [], ['username' => 'test', 'token' => 'test']); |
176 | 176 | ||
177 | $converter->apply($request, $params); | 177 | $converter->apply($request, $params); |
178 | } | 178 | } |
@@ -208,9 +208,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
208 | ->with('WallabagUserBundle:User') | 208 | ->with('WallabagUserBundle:User') |
209 | ->will($this->returnValue($em)); | 209 | ->will($this->returnValue($em)); |
210 | 210 | ||
211 | $params = new ParamConverter(array('class' => 'WallabagUserBundle:User', 'name' => 'user')); | 211 | $params = new ParamConverter(['class' => 'WallabagUserBundle:User', 'name' => 'user']); |
212 | $converter = new UsernameRssTokenConverter($registry); | 212 | $converter = new UsernameRssTokenConverter($registry); |
213 | $request = new Request(array(), array(), array('username' => 'test', 'token' => 'test')); | 213 | $request = new Request([], [], ['username' => 'test', 'token' => 'test']); |
214 | 214 | ||
215 | $converter->apply($request, $params); | 215 | $converter->apply($request, $params); |
216 | 216 | ||
diff --git a/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php b/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php index 49dbb316..e5eafab1 100644 --- a/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php +++ b/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php | |||
@@ -11,23 +11,23 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
11 | { | 11 | { |
12 | public function dataForPrefix() | 12 | public function dataForPrefix() |
13 | { | 13 | { |
14 | return array( | 14 | return [ |
15 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), | 15 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], |
16 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()), | 16 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()], |
17 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()), | 17 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()], |
18 | 18 | ||
19 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), | 19 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], |
20 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()), | 20 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()], |
21 | array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()), | 21 | ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()], |
22 | 22 | ||
23 | array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), | 23 | ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], |
24 | array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()), | 24 | ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()], |
25 | array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()), | 25 | ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()], |
26 | 26 | ||
27 | array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), | 27 | ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], |
28 | array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()), | 28 | ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()], |
29 | array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()), | 29 | ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()], |
30 | ); | 30 | ]; |
31 | } | 31 | } |
32 | 32 | ||
33 | /** | 33 | /** |
@@ -42,7 +42,7 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
42 | $subscriber = new TablePrefixSubscriber($prefix); | 42 | $subscriber = new TablePrefixSubscriber($prefix); |
43 | 43 | ||
44 | $metaClass = new ClassMetadata($entityName); | 44 | $metaClass = new ClassMetadata($entityName); |
45 | $metaClass->setPrimaryTable(array('name' => $tableName)); | 45 | $metaClass->setPrimaryTable(['name' => $tableName]); |
46 | 46 | ||
47 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); | 47 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); |
48 | 48 | ||
@@ -64,7 +64,7 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
64 | ->getMock(); | 64 | ->getMock(); |
65 | 65 | ||
66 | $metaClass = new ClassMetadata($entityName); | 66 | $metaClass = new ClassMetadata($entityName); |
67 | $metaClass->setPrimaryTable(array('name' => $tableName)); | 67 | $metaClass->setPrimaryTable(['name' => $tableName]); |
68 | 68 | ||
69 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); | 69 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); |
70 | 70 | ||
@@ -88,18 +88,18 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | |||
88 | $subscriber = new TablePrefixSubscriber('yo_'); | 88 | $subscriber = new TablePrefixSubscriber('yo_'); |
89 | 89 | ||
90 | $metaClass = new ClassMetadata('Wallabag\UserBundle\Entity\Entry'); | 90 | $metaClass = new ClassMetadata('Wallabag\UserBundle\Entity\Entry'); |
91 | $metaClass->setPrimaryTable(array('name' => 'entry')); | 91 | $metaClass->setPrimaryTable(['name' => 'entry']); |
92 | $metaClass->mapManyToMany(array( | 92 | $metaClass->mapManyToMany([ |
93 | 'fieldName' => 'tags', | 93 | 'fieldName' => 'tags', |
94 | 'joinTable' => array('name' => null, 'schema' => null), | 94 | 'joinTable' => ['name' => null, 'schema' => null], |
95 | 'targetEntity' => 'Tag', | 95 | 'targetEntity' => 'Tag', |
96 | 'mappedBy' => null, | 96 | 'mappedBy' => null, |
97 | 'inversedBy' => 'entries', | 97 | 'inversedBy' => 'entries', |
98 | 'cascade' => array('persist'), | 98 | 'cascade' => ['persist'], |
99 | 'indexBy' => null, | 99 | 'indexBy' => null, |
100 | 'orphanRemoval' => false, | 100 | 'orphanRemoval' => false, |
101 | 'fetch' => 2, | 101 | 'fetch' => 2, |
102 | )); | 102 | ]); |
103 | 103 | ||
104 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); | 104 | $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); |
105 | 105 | ||
diff --git a/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php b/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php index c4905478..05450c0b 100644 --- a/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php +++ b/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php | |||
@@ -24,10 +24,10 @@ abstract class WallabagCoreTestCase extends WebTestCase | |||
24 | { | 24 | { |
25 | $crawler = $this->client->request('GET', '/login'); | 25 | $crawler = $this->client->request('GET', '/login'); |
26 | $form = $crawler->filter('button[type=submit]')->form(); | 26 | $form = $crawler->filter('button[type=submit]')->form(); |
27 | $data = array( | 27 | $data = [ |
28 | '_username' => $username, | 28 | '_username' => $username, |
29 | '_password' => 'mypassword', | 29 | '_password' => 'mypassword', |
30 | ); | 30 | ]; |
31 | 31 | ||
32 | $this->client->submit($form, $data); | 32 | $this->client->submit($form, $data); |
33 | } | 33 | } |
diff --git a/src/Wallabag/CoreBundle/Tools/Utils.php b/src/Wallabag/CoreBundle/Tools/Utils.php index 0c783110..4561f39f 100644 --- a/src/Wallabag/CoreBundle/Tools/Utils.php +++ b/src/Wallabag/CoreBundle/Tools/Utils.php | |||
@@ -16,7 +16,7 @@ class Utils | |||
16 | $token = substr(base64_encode(random_bytes($length)), 0, $length); | 16 | $token = substr(base64_encode(random_bytes($length)), 0, $length); |
17 | 17 | ||
18 | // remove character which can broken the url | 18 | // remove character which can broken the url |
19 | return str_replace(array('+', '/'), '', $token); | 19 | return str_replace(['+', '/'], '', $token); |
20 | } | 20 | } |
21 | 21 | ||
22 | /** | 22 | /** |
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php index 6b860c96..1a308070 100644 --- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php +++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php | |||
@@ -6,9 +6,9 @@ class WallabagExtension extends \Twig_Extension | |||
6 | { | 6 | { |
7 | public function getFilters() | 7 | public function getFilters() |
8 | { | 8 | { |
9 | return array( | 9 | return [ |
10 | new \Twig_SimpleFilter('removeWww', array($this, 'removeWww')), | 10 | new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']), |
11 | ); | 11 | ]; |
12 | } | 12 | } |
13 | 13 | ||
14 | public function removeWww($url) | 14 | public function removeWww($url) |
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php index 11ce649d..36ee25bf 100644 --- a/src/Wallabag/ImportBundle/Controller/PocketController.php +++ b/src/Wallabag/ImportBundle/Controller/PocketController.php | |||
@@ -17,10 +17,10 @@ class PocketController extends Controller | |||
17 | { | 17 | { |
18 | $pocket = $this->get('wallabag_import.pocket.import'); | 18 | $pocket = $this->get('wallabag_import.pocket.import'); |
19 | $form = $this->createFormBuilder($pocket) | 19 | $form = $this->createFormBuilder($pocket) |
20 | ->add('mark_as_read', CheckboxType::class, array( | 20 | ->add('mark_as_read', CheckboxType::class, [ |
21 | 'label' => 'import.form.mark_as_read_label', | 21 | 'label' => 'import.form.mark_as_read_label', |
22 | 'required' => false, | 22 | 'required' => false, |
23 | )) | 23 | ]) |
24 | ->getForm(); | 24 | ->getForm(); |
25 | 25 | ||
26 | return $this->render('WallabagImportBundle:Pocket:index.html.twig', [ | 26 | return $this->render('WallabagImportBundle:Pocket:index.html.twig', [ |
@@ -36,7 +36,7 @@ class PocketController extends Controller | |||
36 | public function authAction(Request $request) | 36 | public function authAction(Request $request) |
37 | { | 37 | { |
38 | $requestToken = $this->get('wallabag_import.pocket.import') | 38 | $requestToken = $this->get('wallabag_import.pocket.import') |
39 | ->getRequestToken($this->generateUrl('import', array(), UrlGeneratorInterface::ABSOLUTE_URL)); | 39 | ->getRequestToken($this->generateUrl('import', [], UrlGeneratorInterface::ABSOLUTE_URL)); |
40 | 40 | ||
41 | if (false === $requestToken) { | 41 | if (false === $requestToken) { |
42 | $this->get('session')->getFlashBag()->add( | 42 | $this->get('session')->getFlashBag()->add( |
@@ -51,7 +51,7 @@ class PocketController extends Controller | |||
51 | $this->get('session')->set('mark_as_read', $request->request->get('form')['mark_as_read']); | 51 | $this->get('session')->set('mark_as_read', $request->request->get('form')['mark_as_read']); |
52 | 52 | ||
53 | return $this->redirect( | 53 | return $this->redirect( |
54 | 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL), | 54 | 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', [], UrlGeneratorInterface::ABSOLUTE_URL), |
55 | 301 | 55 | 301 |
56 | ); | 56 | ); |
57 | } | 57 | } |
@@ -79,10 +79,10 @@ class PocketController extends Controller | |||
79 | 79 | ||
80 | if (true === $pocket->setMarkAsRead($markAsRead)->import()) { | 80 | if (true === $pocket->setMarkAsRead($markAsRead)->import()) { |
81 | $summary = $pocket->getSummary(); | 81 | $summary = $pocket->getSummary(); |
82 | $message = $this->get('translator')->trans('flashes.import.notice.summary', array( | 82 | $message = $this->get('translator')->trans('flashes.import.notice.summary', [ |
83 | '%imported%' => $summary['imported'], | 83 | '%imported%' => $summary['imported'], |
84 | '%skipped%' => $summary['skipped'], | 84 | '%skipped%' => $summary['skipped'], |
85 | )); | 85 | ]); |
86 | } | 86 | } |
87 | 87 | ||
88 | $this->get('session')->getFlashBag()->add( | 88 | $this->get('session')->getFlashBag()->add( |
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagController.php b/src/Wallabag/ImportBundle/Controller/WallabagController.php index 01883d4a..76ced0d2 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagController.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagController.php | |||
@@ -55,10 +55,10 @@ abstract class WallabagController extends Controller | |||
55 | 55 | ||
56 | if (true === $res) { | 56 | if (true === $res) { |
57 | $summary = $wallabag->getSummary(); | 57 | $summary = $wallabag->getSummary(); |
58 | $message = $this->get('translator')->trans('flashes.import.notice.summary', array( | 58 | $message = $this->get('translator')->trans('flashes.import.notice.summary', [ |
59 | '%imported%' => $summary['imported'], | 59 | '%imported%' => $summary['imported'], |
60 | '%skipped%' => $summary['skipped'], | 60 | '%skipped%' => $summary['skipped'], |
61 | )); | 61 | ]); |
62 | 62 | ||
63 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); | 63 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); |
64 | } | 64 | } |
diff --git a/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php b/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php index e0a44c36..92a167d9 100644 --- a/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php +++ b/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php | |||
@@ -13,16 +13,16 @@ class UploadImportType extends AbstractType | |||
13 | public function buildForm(FormBuilderInterface $builder, array $options) | 13 | public function buildForm(FormBuilderInterface $builder, array $options) |
14 | { | 14 | { |
15 | $builder | 15 | $builder |
16 | ->add('file', FileType::class, array( | 16 | ->add('file', FileType::class, [ |
17 | 'label' => 'import.form.file_label', | 17 | 'label' => 'import.form.file_label', |
18 | )) | 18 | ]) |
19 | ->add('mark_as_read', CheckboxType::class, array( | 19 | ->add('mark_as_read', CheckboxType::class, [ |
20 | 'label' => 'import.form.mark_as_read_label', | 20 | 'label' => 'import.form.mark_as_read_label', |
21 | 'required' => false, | 21 | 'required' => false, |
22 | )) | 22 | ]) |
23 | ->add('save', SubmitType::class, array( | 23 | ->add('save', SubmitType::class, [ |
24 | 'label' => 'import.form.save_label', | 24 | 'label' => 'import.form.save_label', |
25 | )) | 25 | ]) |
26 | ; | 26 | ; |
27 | } | 27 | } |
28 | 28 | ||
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php index 8d353a71..f7de3fef 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php | |||
@@ -29,9 +29,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
29 | 29 | ||
30 | $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1.json', 'wallabag-v1.json'); | 30 | $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1.json', 'wallabag-v1.json'); |
31 | 31 | ||
32 | $data = array( | 32 | $data = [ |
33 | 'upload_import_file[file]' => $file, | 33 | 'upload_import_file[file]' => $file, |
34 | ); | 34 | ]; |
35 | 35 | ||
36 | $client->submit($form, $data); | 36 | $client->submit($form, $data); |
37 | 37 | ||
@@ -54,7 +54,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
54 | 54 | ||
55 | $this->assertTrue($content->getTags()->contains($tag)); | 55 | $this->assertTrue($content->getTags()->contains($tag)); |
56 | 56 | ||
57 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 57 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
58 | $this->assertContains('flashes.import.notice.summary', $body[0]); | 58 | $this->assertContains('flashes.import.notice.summary', $body[0]); |
59 | } | 59 | } |
60 | 60 | ||
@@ -68,10 +68,10 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
68 | 68 | ||
69 | $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json'); | 69 | $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json'); |
70 | 70 | ||
71 | $data = array( | 71 | $data = [ |
72 | 'upload_import_file[file]' => $file, | 72 | 'upload_import_file[file]' => $file, |
73 | 'upload_import_file[mark_as_read]' => 1, | 73 | 'upload_import_file[mark_as_read]' => 1, |
74 | ); | 74 | ]; |
75 | 75 | ||
76 | $client->submit($form, $data); | 76 | $client->submit($form, $data); |
77 | 77 | ||
@@ -99,7 +99,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
99 | 99 | ||
100 | $this->assertTrue($content2->isArchived()); | 100 | $this->assertTrue($content2->isArchived()); |
101 | 101 | ||
102 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 102 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
103 | $this->assertContains('flashes.import.notice.summary', $body[0]); | 103 | $this->assertContains('flashes.import.notice.summary', $body[0]); |
104 | } | 104 | } |
105 | 105 | ||
@@ -113,9 +113,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
113 | 113 | ||
114 | $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); | 114 | $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); |
115 | 115 | ||
116 | $data = array( | 116 | $data = [ |
117 | 'upload_import_file[file]' => $file, | 117 | 'upload_import_file[file]' => $file, |
118 | ); | 118 | ]; |
119 | 119 | ||
120 | $client->submit($form, $data); | 120 | $client->submit($form, $data); |
121 | 121 | ||
@@ -123,7 +123,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
123 | 123 | ||
124 | $crawler = $client->followRedirect(); | 124 | $crawler = $client->followRedirect(); |
125 | 125 | ||
126 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 126 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
127 | $this->assertContains('flashes.import.notice.failed', $body[0]); | 127 | $this->assertContains('flashes.import.notice.failed', $body[0]); |
128 | } | 128 | } |
129 | } | 129 | } |
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php index 490f9ede..15251ae7 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php | |||
@@ -29,9 +29,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase | |||
29 | 29 | ||
30 | $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); | 30 | $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); |
31 | 31 | ||
32 | $data = array( | 32 | $data = [ |
33 | 'upload_import_file[file]' => $file, | 33 | 'upload_import_file[file]' => $file, |
34 | ); | 34 | ]; |
35 | 35 | ||
36 | $client->submit($form, $data); | 36 | $client->submit($form, $data); |
37 | 37 | ||
@@ -39,7 +39,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase | |||
39 | 39 | ||
40 | $crawler = $client->followRedirect(); | 40 | $crawler = $client->followRedirect(); |
41 | 41 | ||
42 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 42 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
43 | $this->assertContains('flashes.import.notice.summary', $body[0]); | 43 | $this->assertContains('flashes.import.notice.summary', $body[0]); |
44 | 44 | ||
45 | $content = $client->getContainer() | 45 | $content = $client->getContainer() |
@@ -79,9 +79,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase | |||
79 | 79 | ||
80 | $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); | 80 | $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); |
81 | 81 | ||
82 | $data = array( | 82 | $data = [ |
83 | 'upload_import_file[file]' => $file, | 83 | 'upload_import_file[file]' => $file, |
84 | ); | 84 | ]; |
85 | 85 | ||
86 | $client->submit($form, $data); | 86 | $client->submit($form, $data); |
87 | 87 | ||
@@ -89,7 +89,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase | |||
89 | 89 | ||
90 | $crawler = $client->followRedirect(); | 90 | $crawler = $client->followRedirect(); |
91 | 91 | ||
92 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); | 92 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
93 | $this->assertContains('flashes.import.notice.failed', $body[0]); | 93 | $this->assertContains('flashes.import.notice.failed', $body[0]); |
94 | } | 94 | } |
95 | } | 95 | } |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/ImportCompilerPassTest.php b/src/Wallabag/ImportBundle/Tests/Import/ImportCompilerPassTest.php index bd62ab3b..b22fcfbc 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/ImportCompilerPassTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/ImportCompilerPassTest.php | |||
@@ -25,7 +25,7 @@ class ImportCompilerPassTest extends \PHPUnit_Framework_TestCase | |||
25 | 25 | ||
26 | $container | 26 | $container |
27 | ->register('foo') | 27 | ->register('foo') |
28 | ->addTag('wallabag_import.import', array('alias' => 'pocket')) | 28 | ->addTag('wallabag_import.import', ['alias' => 'pocket']) |
29 | ; | 29 | ; |
30 | 30 | ||
31 | $this->process($container); | 31 | $this->process($container); |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php index 43b60ec3..cb171572 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php | |||
@@ -73,7 +73,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
73 | ); | 73 | ); |
74 | 74 | ||
75 | $this->logHandler = new TestHandler(); | 75 | $this->logHandler = new TestHandler(); |
76 | $logger = new Logger('test', array($this->logHandler)); | 76 | $logger = new Logger('test', [$this->logHandler]); |
77 | $pocket->setLogger($logger); | 77 | $pocket->setLogger($logger); |
78 | 78 | ||
79 | return $pocket; | 79 | return $pocket; |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php index 3ef852e5..8c967e1b 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php | |||
@@ -30,7 +30,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
30 | $wallabag = new WallabagV1Import($this->em, $this->contentProxy); | 30 | $wallabag = new WallabagV1Import($this->em, $this->contentProxy); |
31 | 31 | ||
32 | $this->logHandler = new TestHandler(); | 32 | $this->logHandler = new TestHandler(); |
33 | $logger = new Logger('test', array($this->logHandler)); | 33 | $logger = new Logger('test', [$this->logHandler]); |
34 | $wallabag->setLogger($logger); | 34 | $wallabag->setLogger($logger); |
35 | 35 | ||
36 | if (false === $unsetUser) { | 36 | if (false === $unsetUser) { |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php index dbefdee3..b0667c9a 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php | |||
@@ -30,7 +30,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
30 | $wallabag = new WallabagV2Import($this->em, $this->contentProxy); | 30 | $wallabag = new WallabagV2Import($this->em, $this->contentProxy); |
31 | 31 | ||
32 | $this->logHandler = new TestHandler(); | 32 | $this->logHandler = new TestHandler(); |
33 | $logger = new Logger('test', array($this->logHandler)); | 33 | $logger = new Logger('test', [$this->logHandler]); |
34 | $wallabag->setLogger($logger); | 34 | $wallabag->setLogger($logger); |
35 | 35 | ||
36 | if (false === $unsetUser) { | 36 | if (false === $unsetUser) { |
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php index 4bbb68dc..dfed8e47 100644 --- a/src/Wallabag/UserBundle/Entity/User.php +++ b/src/Wallabag/UserBundle/Entity/User.php | |||
@@ -88,7 +88,7 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf | |||
88 | { | 88 | { |
89 | parent::__construct(); | 89 | parent::__construct(); |
90 | $this->entries = new ArrayCollection(); | 90 | $this->entries = new ArrayCollection(); |
91 | $this->roles = array('ROLE_USER'); | 91 | $this->roles = ['ROLE_USER']; |
92 | } | 92 | } |
93 | 93 | ||
94 | /** | 94 | /** |
diff --git a/src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php b/src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php index 128e85a4..3a7f2637 100644 --- a/src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php +++ b/src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php | |||
@@ -27,9 +27,9 @@ class PasswordResettingListener implements EventSubscriberInterface | |||
27 | */ | 27 | */ |
28 | public static function getSubscribedEvents() | 28 | public static function getSubscribedEvents() |
29 | { | 29 | { |
30 | return array( | 30 | return [ |
31 | FOSUserEvents::RESETTING_RESET_SUCCESS => 'onPasswordResettingSuccess', | 31 | FOSUserEvents::RESETTING_RESET_SUCCESS => 'onPasswordResettingSuccess', |
32 | ); | 32 | ]; |
33 | } | 33 | } |
34 | 34 | ||
35 | public function onPasswordResettingSuccess(FormEvent $event) | 35 | public function onPasswordResettingSuccess(FormEvent $event) |
diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index d8403491..ca9d18f1 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | |||
@@ -82,7 +82,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface | |||
82 | { | 82 | { |
83 | $template = $this->twig->loadTemplate('WallabagUserBundle:TwoFactor:email_auth_code.html.twig'); | 83 | $template = $this->twig->loadTemplate('WallabagUserBundle:TwoFactor:email_auth_code.html.twig'); |
84 | 84 | ||
85 | $subject = $template->renderBlock('subject', array()); | 85 | $subject = $template->renderBlock('subject', []); |
86 | $bodyHtml = $template->renderBlock('body_html', [ | 86 | $bodyHtml = $template->renderBlock('body_html', [ |
87 | 'user' => $user->getName(), | 87 | 'user' => $user->getName(), |
88 | 'code' => $user->getEmailAuthCode(), | 88 | 'code' => $user->getEmailAuthCode(), |
diff --git a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php index b95e195e..00967051 100644 --- a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php +++ b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php | |||
@@ -43,7 +43,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase | |||
43 | {% block body_text %}text body {{ support_url }}{% endblock %} | 43 | {% block body_text %}text body {{ support_url }}{% endblock %} |
44 | TWIG; | 44 | TWIG; |
45 | 45 | ||
46 | $this->twig = new \Twig_Environment(new \Twig_Loader_Array(array('WallabagUserBundle:TwoFactor:email_auth_code.html.twig' => $twigTemplate))); | 46 | $this->twig = new \Twig_Environment(new \Twig_Loader_Array(['WallabagUserBundle:TwoFactor:email_auth_code.html.twig' => $twigTemplate])); |
47 | 47 | ||
48 | $this->config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config') | 48 | $this->config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config') |
49 | ->disableOriginalConstructor() | 49 | ->disableOriginalConstructor() |
@@ -76,7 +76,7 @@ TWIG; | |||
76 | 76 | ||
77 | $msg = $this->spool->getMessages()[0]; | 77 | $msg = $this->spool->getMessages()[0]; |
78 | $this->assertArrayHasKey('test@wallabag.io', $msg->getTo()); | 78 | $this->assertArrayHasKey('test@wallabag.io', $msg->getTo()); |
79 | $this->assertEquals(array('nobody@test.io' => 'wallabag test'), $msg->getFrom()); | 79 | $this->assertEquals(['nobody@test.io' => 'wallabag test'], $msg->getFrom()); |
80 | $this->assertEquals('subject', $msg->getSubject()); | 80 | $this->assertEquals('subject', $msg->getSubject()); |
81 | $this->assertContains('text body http://0.0.0.0/support', $msg->toString()); | 81 | $this->assertContains('text body http://0.0.0.0/support', $msg->toString()); |
82 | $this->assertContains('html body 666666', $msg->toString()); | 82 | $this->assertContains('html body 666666', $msg->toString()); |