Skip to content

Commit 026a8e2

Browse files
authored
Merge pull request #175 from phpcr/analysis-XWGyLE
Apply fixes from StyleCI
2 parents 63f65eb + 7e52120 commit 026a8e2

26 files changed

+102
-102
lines changed

src/PHPCR/Util/CND/Parser/CndParser.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,30 @@
3636
class CndParser extends AbstractParser
3737
{
3838
// node type attributes
39-
private $ORDERABLE = array('o', 'ord', 'orderable');//, 'variant' => true);
40-
private $MIXIN = array('m', 'mix', 'mixin');//, 'variant' => true);
41-
private $ABSTRACT = array('a', 'abs', 'abstract');//, 'variant' => true);
42-
private $NOQUERY = array('noquery', 'nq');//, 'variant' => false);
43-
private $QUERY = array('query', 'q');//, 'variant' => false);
44-
private $PRIMARYITEM = array('primaryitem', '!');//, 'variant' => false);
39+
private $ORDERABLE = ['o', 'ord', 'orderable'];//, 'variant' => true);
40+
private $MIXIN = ['m', 'mix', 'mixin'];//, 'variant' => true);
41+
private $ABSTRACT = ['a', 'abs', 'abstract'];//, 'variant' => true);
42+
private $NOQUERY = ['noquery', 'nq'];//, 'variant' => false);
43+
private $QUERY = ['query', 'q'];//, 'variant' => false);
44+
private $PRIMARYITEM = ['primaryitem', '!'];//, 'variant' => false);
4545

4646
// common for properties and child definitions
47-
private $PRIMARY = array('!', 'pri', 'primary'); //, 'variant' => true),
48-
private $AUTOCREATED = array('a', 'aut', 'autocreated'); //, 'variant' => true),
49-
private $MANDATORY = array('m', 'man', 'mandatory'); //, 'variant' => true),
50-
private $PROTECTED = array('p', 'pro', 'protected'); //, 'variant' => true),
51-
private $OPV = array('COPY', 'VERSION', 'INITIALIZE', 'COMPUTE', 'IGNORE', 'ABORT');
47+
private $PRIMARY = ['!', 'pri', 'primary']; //, 'variant' => true),
48+
private $AUTOCREATED = ['a', 'aut', 'autocreated']; //, 'variant' => true),
49+
private $MANDATORY = ['m', 'man', 'mandatory']; //, 'variant' => true),
50+
private $PROTECTED = ['p', 'pro', 'protected']; //, 'variant' => true),
51+
private $OPV = ['COPY', 'VERSION', 'INITIALIZE', 'COMPUTE', 'IGNORE', 'ABORT'];
5252

5353
// property type attributes
54-
private $MULTIPLE = array('*', 'mul', 'multiple'); //, 'variant' => true),
55-
private $QUERYOPS = array('qop', 'queryops'); //, 'variant' => true), // Needs special handling !
56-
private $NOFULLTEXT = array('nof', 'nofulltext'); //, 'variant' => true),
57-
private $NOQUERYORDER = array('nqord', 'noqueryorder'); //, 'variant' => true),
54+
private $MULTIPLE = ['*', 'mul', 'multiple']; //, 'variant' => true),
55+
private $QUERYOPS = ['qop', 'queryops']; //, 'variant' => true), // Needs special handling !
56+
private $NOFULLTEXT = ['nof', 'nofulltext']; //, 'variant' => true),
57+
private $NOQUERYORDER = ['nqord', 'noqueryorder']; //, 'variant' => true),
5858

5959
// child node attributes
6060
// multiple is actually a jackrabbit specific synonym for sns
6161
// http://www.mail-archive.com/[email protected]/msg19268.html
62-
private $SNS = array('*', 'sns', 'multiple'); //, 'variant' => true),
62+
private $SNS = ['*', 'sns', 'multiple']; //, 'variant' => true),
6363

6464
/**
6565
* @var NodeTypeManagerInterface
@@ -69,12 +69,12 @@ class CndParser extends AbstractParser
6969
/**
7070
* @var array
7171
*/
72-
protected $namespaces = array();
72+
protected $namespaces = [];
7373

7474
/**
7575
* @var array
7676
*/
77-
protected $nodeTypes = array();
77+
protected $nodeTypes = [];
7878

7979
/**
8080
* @param NodeTypeManagerInterface $ntm
@@ -129,10 +129,10 @@ private function parse(ReaderInterface $reader)
129129
}
130130
}
131131

132-
return array(
132+
return [
133133
'namespaces' => $this->namespaces,
134134
'nodeTypes' => $this->nodeTypes,
135-
);
135+
];
136136
}
137137

138138
/**
@@ -208,7 +208,7 @@ protected function parseSupertypes(NodeTypeTemplateInterface $nodeType)
208208
$this->expectToken(Token::TK_SYMBOL, '>');
209209

210210
if ($this->checkAndExpectToken(Token::TK_SYMBOL, '?')) {
211-
$nodeType->setDeclaredSuperTypeNames(array('?'));
211+
$nodeType->setDeclaredSuperTypeNames(['?']);
212212
} else {
213213
$nodeType->setDeclaredSuperTypeNames($this->parseCndStringList());
214214
}
@@ -369,8 +369,8 @@ protected function parsePropDef(NodeTypeTemplateInterface $nodeType)
369369
*/
370370
protected function parsePropertyType(PropertyDefinitionTemplateInterface $property)
371371
{
372-
$types = array("STRING", "BINARY", "LONG", "DOUBLE", "BOOLEAN", "DATE", "NAME", "PATH",
373-
"REFERENCE", "WEAKREFERENCE", "DECIMAL", "URI", "UNDEFINED", "*", "?");
372+
$types = ["STRING", "BINARY", "LONG", "DOUBLE", "BOOLEAN", "DATE", "NAME", "PATH",
373+
"REFERENCE", "WEAKREFERENCE", "DECIMAL", "URI", "UNDEFINED", "*", "?"];
374374

375375
if (! $this->checkTokenIn(Token::TK_IDENTIFIER, $types, true)) {
376376
throw new ParserException($this->tokenQueue, sprintf("Invalid property type: %s", $this->tokenQueue->get()->getData()));
@@ -394,7 +394,7 @@ protected function parsePropertyType(PropertyDefinitionTemplateInterface $proper
394394
protected function parseDefaultValue(PropertyDefinitionTemplateInterface $property)
395395
{
396396
if ($this->checkAndExpectToken(Token::TK_SYMBOL, '?')) {
397-
$list = array('?');
397+
$list = ['?'];
398398
} else {
399399
$list = $this->parseCndStringList();
400400
}
@@ -414,7 +414,7 @@ protected function parseValueConstraints(PropertyDefinitionTemplateInterface $pr
414414
$this->expectToken(Token::TK_SYMBOL, '<');
415415

416416
if ($this->checkAndExpectToken(Token::TK_SYMBOL, '?')) {
417-
$list = array('?');
417+
$list = ['?'];
418418
} else {
419419
$list = $this->parseCndStringList();
420420
}
@@ -632,7 +632,7 @@ protected function parseChildNodeAttributes(
632632
*/
633633
protected function parseCndStringList()
634634
{
635-
$strings = array();
635+
$strings = [];
636636

637637
$strings[] = $this->parseCndString();
638638
while ($this->checkAndExpectToken(Token::TK_SYMBOL, ',')) {
@@ -728,7 +728,7 @@ protected function parseQueryOpsAttribute()
728728
throw new ParserException($this->tokenQueue, 'TODO: understand what "variant" means');
729729
}
730730

731-
$ops = array();
731+
$ops = [];
732732
do {
733733
$op = $this->parseQueryOperator();
734734
$ops[] = $op;

src/PHPCR/Util/CND/Scanner/Context/DefaultScannerContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ public function __construct()
2222

2323
$this->addBlockCommentDelimiter('/*', '*/');
2424

25-
$symbols = array(
25+
$symbols = [
2626
'<', '>', '+', '*', '%', '&', '/', '(', ')', '=', '?', '#', '|', '!', '~',
2727
'[', ']', '{', '}', '$', ',', ';', ':', '.', '-', '_', '\\',
28-
);
28+
];
2929
foreach ($symbols as $symbol) {
3030
$this->addSymbol($symbol);
3131
}

src/PHPCR/Util/CND/Scanner/Context/ScannerContext.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ScannerContext
1616
* Characters to be considered as white spaces
1717
* @var array
1818
*/
19-
protected $whitespaces = array();
19+
protected $whitespaces = [];
2020

2121
/**
2222
* Characters to be considered as paired string delimiters.
@@ -26,21 +26,21 @@ class ScannerContext
2626
*
2727
* @var array
2828
*/
29-
protected $stringDelimiters = array();
29+
protected $stringDelimiters = [];
3030

3131
/**
3232
* Line comments start
3333
*
3434
* @var array
3535
*/
36-
protected $lineCommentDelimiters = array();
36+
protected $lineCommentDelimiters = [];
3737

3838
/**
3939
* Block comments delimiters
4040
*
4141
* @var array
4242
*/
43-
protected $blockCommentDelimiters = array();
43+
protected $blockCommentDelimiters = [];
4444

4545
/**
4646
* Characters to be considered as symbols.
@@ -49,12 +49,12 @@ class ScannerContext
4949
*
5050
* @var array
5151
*/
52-
protected $symbols = array();
52+
protected $symbols = [];
5353

5454
/**
5555
* @var TokenFilterInterface[]
5656
*/
57-
protected $tokenFilters = array();
57+
protected $tokenFilters = [];
5858

5959
/**
6060
* @param string $startDelim

src/PHPCR/Util/CND/Scanner/TokenQueue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TokenQueue implements \IteratorAggregate
1515
*/
1616
protected $tokens;
1717

18-
public function __construct($tokens = array())
18+
public function __construct($tokens = [])
1919
{
2020
$this->tokens = $tokens;
2121
}

src/PHPCR/Util/CND/Writer/CndWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CndWriter
3333
private $ns;
3434

3535
/** @var array hashmap of prefix => namespace uri */
36-
private $namespaces = array();
36+
private $namespaces = [];
3737

3838
/**
3939
* @param NodeTypeManagerInterface $ntm

src/PHPCR/Util/Console/Command/NodeDumpCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
7272
$identifier = $input->getArgument('identifier');
7373

7474
// whether to dump node uuid
75-
$options = array();
75+
$options = [];
7676
$options['dump_uuids'] = $input->hasParameterOption('--identifiers');
7777
$options['ref_format'] = $input->getOption('ref-format');
7878
$options['show_props'] = $input->hasParameterOption('--props');
7979
$options['show_sys_nodes'] = $input->hasParameterOption('--sys-nodes');
8080
$options['max_line_length'] = $input->getOption('max_line_length');
8181

82-
if (null !== $options['ref_format'] && !in_array($options['ref_format'], array('uuid', 'path'))) {
82+
if (null !== $options['ref_format'] && !in_array($options['ref_format'], ['uuid', 'path'])) {
8383
throw new Exception('The ref-format option must be set to either "path" or "uuid"');
8484
}
8585

src/PHPCR/Util/Console/Command/NodeTouchCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
132132
$node = $parentNode->addNode($nodeName, $type);
133133
}
134134

135-
$helper->processNode($output, $node, array(
135+
$helper->processNode($output, $node, [
136136
'setProp' => $setProp,
137137
'removeProp' => $removeProp,
138138
'addMixins' => $addMixins,
139139
'removeMixins' => $removeMixins,
140140
'dump' => $dump,
141-
));
141+
]);
142142

143143
$session->save();
144144

src/PHPCR/Util/Console/Command/NodesUpdateCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
132132

133133
$node = $row->getNode();
134134

135-
$helper->processNode($output, $node, array(
135+
$helper->processNode($output, $node, [
136136
'setProp' => $setProp,
137137
'removeProp' => $removeProp,
138138
'addMixins' => $addMixins,
139139
'removeMixins' => $removeMixins,
140140
'applyClosures' => $applyClosures,
141-
));
141+
]);
142142

143143
$persistIn--;
144144
if (0 === $persistIn) {

src/PHPCR/Util/Console/Helper/PhpcrConsoleDumperHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ class PhpcrConsoleDumperHelper extends Helper
2020
{
2121
public function getTreeWalker(OutputInterface $output, $options)
2222
{
23-
$options = array_merge(array(
23+
$options = array_merge([
2424
'dump_uuids' => false,
2525
'ref_format' => 'uuid',
2626
'show_props' => false,
2727
'show_sys_nodes' => false,
28-
), $options);
28+
], $options);
2929

3030
$propVisitor = null;
3131
$nodeVisitor = new ConsoleDumperNodeVisitor($output, $options['dump_uuids']);

src/PHPCR/Util/Console/Helper/PhpcrHelper.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ public function getName()
6464
*/
6565
public function processNode(OutputInterface $output, NodeInterface $node, array $operations)
6666
{
67-
$operations = array_merge(array(
68-
'setProp' => array(),
69-
'removeProp' => array(),
70-
'addMixins' => array(),
71-
'removeMixins' => array(),
72-
'applyClosures' => array(),
67+
$operations = array_merge([
68+
'setProp' => [],
69+
'removeProp' => [],
70+
'addMixins' => [],
71+
'removeMixins' => [],
72+
'applyClosures' => [],
7373
'dump' => false,
74-
), $operations);
74+
], $operations);
7575

7676
foreach ($operations['setProp'] as $set) {
7777
$parts = explode('=', $set);

0 commit comments

Comments
 (0)