Skip to content

Commit 7a3b738

Browse files
committed
replace old array with []
1 parent 090b2d8 commit 7a3b738

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ bindtextdomain("Web_Content", "./locale");
4141
// choose Domain
4242
textdomain("Web_Content");
4343

44-
$twigConfig = array(
44+
$twigConfig = [
4545
'cache' => false,
4646
'debug' => true,
4747
'auto_reload' => true
48-
);
48+
];
4949

5050
$twigLoader = new FilesystemLoader('./tpl/');
5151
$twig = new Environment($twigLoader, $twigConfig);

example/example.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
// choose Domain
2323
textdomain("Web_Content");
2424

25-
$twigConfig = array(
25+
$twigConfig = [
2626
'cache' => false,
2727
'debug' => true,
2828
'auto_reload' => true
29-
);
29+
];
3030

3131
$twigLoader = new FilesystemLoader('./tpl/');
3232
$twig = new Environment($twigLoader, $twigConfig);

src/jblond/TwigTrans/TransNode.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(
3434
$lineno = 0,
3535
$tag = null
3636
) {
37-
$nodes = array('body' => $body);
37+
$nodes = ['body' => $body];
3838
if (null !== $count) {
3939
$nodes['count'] = $count;
4040
}
@@ -45,7 +45,7 @@ public function __construct(
4545
$nodes['notes'] = $notes;
4646
}
4747

48-
parent::__construct($nodes, array(), $lineno, $tag);
48+
parent::__construct($nodes, [], $lineno, $tag);
4949
}
5050

5151
/**
@@ -70,7 +70,7 @@ public function compile(Compiler $compiler)
7070
$message = trim($this->getNode('notes')->getAttribute('data'));
7171

7272
// line breaks are not allowed cause we want a single line comment
73-
$message = str_replace(array("\n", "\r"), ' ', $message);
73+
$message = str_replace(["\n", "\r"], ' ', $message);
7474
$compiler->write("// notes: {$message}\n");
7575
}
7676

@@ -143,10 +143,10 @@ protected function compileString(Node $body)
143143
$body instanceof ConstantExpression ||
144144
$body instanceof TempNameExpression
145145
) {
146-
return array($body, array());
146+
return [$body, []];
147147
}
148148

149-
$vars = array();
149+
$vars = [];
150150
if (count($body)) {
151151
$msg = '';
152152

@@ -171,7 +171,7 @@ protected function compileString(Node $body)
171171
$msg = $body->getAttribute('data');
172172
}
173173

174-
return array(new Node(array(new ConstantExpression(trim($msg), $body->getTemplateLine()))), $vars);
174+
return [new Node([new ConstantExpression(trim($msg), $body->getTemplateLine())]), $vars];
175175
}
176176

177177
/**

src/jblond/TwigTrans/TransTag.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ public function parse(Token $token)
2727
$body = $this->parser->getExpressionParser()->parseExpression();
2828
} else {
2929
$stream->expect(Token::BLOCK_END_TYPE);
30-
$body = $this->parser->subparse(array($this, 'decideForFork'));
30+
$body = $this->parser->subparse([$this, 'decideForFork']);
3131
$next = $stream->next()->getValue();
3232

3333
if ('plural' === $next) {
3434
$count = $this->parser->getExpressionParser()->parseExpression();
3535
$stream->expect(Token::BLOCK_END_TYPE);
36-
$plural = $this->parser->subparse(array($this, 'decideForFork'));
36+
$plural = $this->parser->subparse([$this, 'decideForFork']);
3737

3838
if ('notes' === $stream->next()->getValue()) {
3939
$stream->expect(Token::BLOCK_END_TYPE);
40-
$notes = $this->parser->subparse(array($this, 'decideForEnd'), true);
40+
$notes = $this->parser->subparse([$this, 'decideForEnd'], true);
4141
}
4242
} elseif ('notes' === $next) {
4343
$stream->expect(Token::BLOCK_END_TYPE);
44-
$notes = $this->parser->subparse(array($this, 'decideForEnd'), true);
44+
$notes = $this->parser->subparse([$this, 'decideForEnd'], true);
4545
}
4646
}
4747

@@ -57,7 +57,7 @@ public function parse(Token $token)
5757
*/
5858
public function decideForFork(Token $token)
5959
{
60-
return $token->test(array('plural', 'notes', 'endtrans'));
60+
return $token->test(['plural', 'notes', 'endtrans']);
6161
}
6262

6363
/**

src/jblond/TwigTrans/Translation.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,19 @@ public function getFunctions()
7272
*/
7373
public function getTests()
7474
{
75-
return array(
75+
return [
7676
new TwigTest('Translation', 'test')
77-
);
77+
];
7878
}
7979

8080
/**
8181
* @inheritDoc
8282
*/
8383
public function getTokenParsers()
8484
{
85-
return array(
85+
return [
8686
new TransTag()
87-
);
87+
];
8888
}
8989

9090
/**

0 commit comments

Comments
 (0)