From 7a3b7388d96569eef4aa63ad94ca706a74f09e2a Mon Sep 17 00:00:00 2001 From: JBlond Date: Wed, 12 Feb 2020 10:20:41 +0100 Subject: [PATCH] replace old array with [] --- README.md | 4 ++-- example/example.php | 4 ++-- src/jblond/TwigTrans/TransNode.php | 12 ++++++------ src/jblond/TwigTrans/TransTag.php | 10 +++++----- src/jblond/TwigTrans/Translation.php | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index d4c5260..94242d8 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,11 @@ bindtextdomain("Web_Content", "./locale"); // choose Domain textdomain("Web_Content"); -$twigConfig = array( +$twigConfig = [ 'cache' => false, 'debug' => true, 'auto_reload' => true -); +]; $twigLoader = new FilesystemLoader('./tpl/'); $twig = new Environment($twigLoader, $twigConfig); diff --git a/example/example.php b/example/example.php index 4235e40..61ceddc 100644 --- a/example/example.php +++ b/example/example.php @@ -22,11 +22,11 @@ // choose Domain textdomain("Web_Content"); -$twigConfig = array( +$twigConfig = [ 'cache' => false, 'debug' => true, 'auto_reload' => true -); +]; $twigLoader = new FilesystemLoader('./tpl/'); $twig = new Environment($twigLoader, $twigConfig); diff --git a/src/jblond/TwigTrans/TransNode.php b/src/jblond/TwigTrans/TransNode.php index 5b4b927..d29ed01 100644 --- a/src/jblond/TwigTrans/TransNode.php +++ b/src/jblond/TwigTrans/TransNode.php @@ -34,7 +34,7 @@ public function __construct( $lineno = 0, $tag = null ) { - $nodes = array('body' => $body); + $nodes = ['body' => $body]; if (null !== $count) { $nodes['count'] = $count; } @@ -45,7 +45,7 @@ public function __construct( $nodes['notes'] = $notes; } - parent::__construct($nodes, array(), $lineno, $tag); + parent::__construct($nodes, [], $lineno, $tag); } /** @@ -70,7 +70,7 @@ public function compile(Compiler $compiler) $message = trim($this->getNode('notes')->getAttribute('data')); // line breaks are not allowed cause we want a single line comment - $message = str_replace(array("\n", "\r"), ' ', $message); + $message = str_replace(["\n", "\r"], ' ', $message); $compiler->write("// notes: {$message}\n"); } @@ -143,10 +143,10 @@ protected function compileString(Node $body) $body instanceof ConstantExpression || $body instanceof TempNameExpression ) { - return array($body, array()); + return [$body, []]; } - $vars = array(); + $vars = []; if (count($body)) { $msg = ''; @@ -171,7 +171,7 @@ protected function compileString(Node $body) $msg = $body->getAttribute('data'); } - return array(new Node(array(new ConstantExpression(trim($msg), $body->getTemplateLine()))), $vars); + return [new Node([new ConstantExpression(trim($msg), $body->getTemplateLine())]), $vars]; } /** diff --git a/src/jblond/TwigTrans/TransTag.php b/src/jblond/TwigTrans/TransTag.php index 7b66580..19a98fc 100644 --- a/src/jblond/TwigTrans/TransTag.php +++ b/src/jblond/TwigTrans/TransTag.php @@ -27,21 +27,21 @@ public function parse(Token $token) $body = $this->parser->getExpressionParser()->parseExpression(); } else { $stream->expect(Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideForFork')); + $body = $this->parser->subparse([$this, 'decideForFork']); $next = $stream->next()->getValue(); if ('plural' === $next) { $count = $this->parser->getExpressionParser()->parseExpression(); $stream->expect(Token::BLOCK_END_TYPE); - $plural = $this->parser->subparse(array($this, 'decideForFork')); + $plural = $this->parser->subparse([$this, 'decideForFork']); if ('notes' === $stream->next()->getValue()) { $stream->expect(Token::BLOCK_END_TYPE); - $notes = $this->parser->subparse(array($this, 'decideForEnd'), true); + $notes = $this->parser->subparse([$this, 'decideForEnd'], true); } } elseif ('notes' === $next) { $stream->expect(Token::BLOCK_END_TYPE); - $notes = $this->parser->subparse(array($this, 'decideForEnd'), true); + $notes = $this->parser->subparse([$this, 'decideForEnd'], true); } } @@ -57,7 +57,7 @@ public function parse(Token $token) */ public function decideForFork(Token $token) { - return $token->test(array('plural', 'notes', 'endtrans')); + return $token->test(['plural', 'notes', 'endtrans']); } /** diff --git a/src/jblond/TwigTrans/Translation.php b/src/jblond/TwigTrans/Translation.php index 1bcad14..6dcae67 100644 --- a/src/jblond/TwigTrans/Translation.php +++ b/src/jblond/TwigTrans/Translation.php @@ -72,9 +72,9 @@ public function getFunctions() */ public function getTests() { - return array( + return [ new TwigTest('Translation', 'test') - ); + ]; } /** @@ -82,9 +82,9 @@ public function getTests() */ public function getTokenParsers() { - return array( + return [ new TransTag() - ); + ]; } /**