From 4094ea47712efbe58624ff74daeb1f77c9b0edcf Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 12 Apr 2016 11:36:01 +0200 Subject: Convert array + phpDoc Thanks for https://github.com/thomasbachem/php-short-array-syntax-converter --- .../ImportBundle/Controller/PocketController.php | 12 ++++++------ .../ImportBundle/Controller/WallabagController.php | 4 ++-- .../ImportBundle/Form/Type/UploadImportType.php | 12 ++++++------ .../Tests/Controller/WallabagV1ControllerTest.php | 18 +++++++++--------- .../Tests/Controller/WallabagV2ControllerTest.php | 12 ++++++------ .../Tests/Import/ImportCompilerPassTest.php | 2 +- .../ImportBundle/Tests/Import/PocketImportTest.php | 2 +- .../ImportBundle/Tests/Import/WallabagV1ImportTest.php | 2 +- .../ImportBundle/Tests/Import/WallabagV2ImportTest.php | 2 +- 9 files changed, 33 insertions(+), 33 deletions(-) (limited to 'src/Wallabag/ImportBundle') 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 { $pocket = $this->get('wallabag_import.pocket.import'); $form = $this->createFormBuilder($pocket) - ->add('mark_as_read', CheckboxType::class, array( + ->add('mark_as_read', CheckboxType::class, [ 'label' => 'import.form.mark_as_read_label', 'required' => false, - )) + ]) ->getForm(); return $this->render('WallabagImportBundle:Pocket:index.html.twig', [ @@ -36,7 +36,7 @@ class PocketController extends Controller public function authAction(Request $request) { $requestToken = $this->get('wallabag_import.pocket.import') - ->getRequestToken($this->generateUrl('import', array(), UrlGeneratorInterface::ABSOLUTE_URL)); + ->getRequestToken($this->generateUrl('import', [], UrlGeneratorInterface::ABSOLUTE_URL)); if (false === $requestToken) { $this->get('session')->getFlashBag()->add( @@ -51,7 +51,7 @@ class PocketController extends Controller $this->get('session')->set('mark_as_read', $request->request->get('form')['mark_as_read']); return $this->redirect( - 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL), + 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', [], UrlGeneratorInterface::ABSOLUTE_URL), 301 ); } @@ -79,10 +79,10 @@ class PocketController extends Controller if (true === $pocket->setMarkAsRead($markAsRead)->import()) { $summary = $pocket->getSummary(); - $message = $this->get('translator')->trans('flashes.import.notice.summary', array( + $message = $this->get('translator')->trans('flashes.import.notice.summary', [ '%imported%' => $summary['imported'], '%skipped%' => $summary['skipped'], - )); + ]); } $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 if (true === $res) { $summary = $wallabag->getSummary(); - $message = $this->get('translator')->trans('flashes.import.notice.summary', array( + $message = $this->get('translator')->trans('flashes.import.notice.summary', [ '%imported%' => $summary['imported'], '%skipped%' => $summary['skipped'], - )); + ]); unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); } 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 public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('file', FileType::class, array( + ->add('file', FileType::class, [ 'label' => 'import.form.file_label', - )) - ->add('mark_as_read', CheckboxType::class, array( + ]) + ->add('mark_as_read', CheckboxType::class, [ 'label' => 'import.form.mark_as_read_label', 'required' => false, - )) - ->add('save', SubmitType::class, array( + ]) + ->add('save', SubmitType::class, [ 'label' => 'import.form.save_label', - )) + ]) ; } 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 $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1.json', 'wallabag-v1.json'); - $data = array( + $data = [ 'upload_import_file[file]' => $file, - ); + ]; $client->submit($form, $data); @@ -54,7 +54,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $this->assertTrue($content->getTags()->contains($tag)); - $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains('flashes.import.notice.summary', $body[0]); } @@ -68,10 +68,10 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json'); - $data = array( + $data = [ 'upload_import_file[file]' => $file, 'upload_import_file[mark_as_read]' => 1, - ); + ]; $client->submit($form, $data); @@ -99,7 +99,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $this->assertTrue($content2->isArchived()); - $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains('flashes.import.notice.summary', $body[0]); } @@ -113,9 +113,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); - $data = array( + $data = [ 'upload_import_file[file]' => $file, - ); + ]; $client->submit($form, $data); @@ -123,7 +123,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains('flashes.import.notice.failed', $body[0]); } } 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 $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); - $data = array( + $data = [ 'upload_import_file[file]' => $file, - ); + ]; $client->submit($form, $data); @@ -39,7 +39,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains('flashes.import.notice.summary', $body[0]); $content = $client->getContainer() @@ -79,9 +79,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); - $data = array( + $data = [ 'upload_import_file[file]' => $file, - ); + ]; $client->submit($form, $data); @@ -89,7 +89,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains('flashes.import.notice.failed', $body[0]); } } 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 $container ->register('foo') - ->addTag('wallabag_import.import', array('alias' => 'pocket')) + ->addTag('wallabag_import.import', ['alias' => 'pocket']) ; $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 ); $this->logHandler = new TestHandler(); - $logger = new Logger('test', array($this->logHandler)); + $logger = new Logger('test', [$this->logHandler]); $pocket->setLogger($logger); 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 $wallabag = new WallabagV1Import($this->em, $this->contentProxy); $this->logHandler = new TestHandler(); - $logger = new Logger('test', array($this->logHandler)); + $logger = new Logger('test', [$this->logHandler]); $wallabag->setLogger($logger); 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 $wallabag = new WallabagV2Import($this->em, $this->contentProxy); $this->logHandler = new TestHandler(); - $logger = new Logger('test', array($this->logHandler)); + $logger = new Logger('test', [$this->logHandler]); $wallabag->setLogger($logger); if (false === $unsetUser) { -- cgit v1.2.3