Skip to content

Commit 7e52120

Browse files
dbuStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 63f65eb commit 7e52120

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/users@jackrabbit.apache.org/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);

src/PHPCR/Util/Console/Helper/TreeDumper/ConsoleDumperPropertyVisitor.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ class ConsoleDumperPropertyVisitor extends ConsoleDumperItemVisitor
3333
* @param OutputInterface $output
3434
* @param array $options
3535
*/
36-
public function __construct(OutputInterface $output, $options = array())
36+
public function __construct(OutputInterface $output, $options = [])
3737
{
38-
$options = array_merge(array(
38+
$options = array_merge([
3939
'max_line_length' => 120,
4040
'ref_format' => 'uuid',
41-
), $options);
41+
], $options);
4242

4343
parent::__construct($output);
4444

@@ -69,13 +69,13 @@ public function visit(ItemInterface $item)
6969
$value = substr($value, 0, $this->maxLineLength) . '...';
7070
}
7171

72-
$referrers = array();
72+
$referrers = [];
7373

74-
if (in_array($item->getType(), array(
74+
if (in_array($item->getType(), [
7575
PropertyType::WEAKREFERENCE,
7676
PropertyType::REFERENCE
77-
))) {
78-
$referenceStrings = array();
77+
])) {
78+
$referenceStrings = [];
7979

8080
if ('path' == $this->refFormat) {
8181
$references = (array) $item->getValue();
@@ -90,7 +90,7 @@ public function visit(ItemInterface $item)
9090
$value = '';
9191
}
9292

93-
$value = str_replace(array("\n", "\t"), '', $value);
93+
$value = str_replace(["\n", "\t"], '', $value);
9494

9595
$this->output->writeln(str_repeat(' ', $this->level + 1) . '- <info>' . $item->getName() . '</info> = ' . $value);
9696

src/PHPCR/Util/NodeHelper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ public static function generateAutoNodeName($usedNames, $namespaces, $defaultNam
176176
return self::generateWithPrefix($usedNames, '');
177177
}
178178

179-
/*
180-
* "<i>somePrefix</i>:" where <i>somePrefix</i> is a syntactically
181-
* valid namespace prefix
182-
*/
179+
/*
180+
* "<i>somePrefix</i>:" where <i>somePrefix</i> is a syntactically
181+
* valid namespace prefix
182+
*/
183183
if (':' === $nameHint[strlen($nameHint)-1]
184184
&& substr_count($nameHint, ':') === 1
185185
&& preg_match('#^[a-zA-Z][a-zA-Z0-9]*:$#', $nameHint)

src/PHPCR/Util/PathHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function assertValidAbsolutePath($path, $destination = false, $thr
5858
return self::error("Destination path may not end with index: '$path'", $throw);
5959
}
6060
if ($namespacePrefixes) {
61-
$matches = array();
61+
$matches = [];
6262
preg_match_all('#/(?P<prefixes>[^/:]+):#', $path, $matches);
6363
$unknown = array_diff(array_unique($matches['prefixes']), $namespacePrefixes);
6464
if (count($unknown)) {
@@ -144,7 +144,7 @@ public static function normalizePath($path, $destination = false, $throw = true)
144144
return self::error("Not an absolute path '$path'", $throw);
145145
}
146146

147-
$finalParts= array();
147+
$finalParts= [];
148148
$parts = explode('/', $path);
149149

150150
foreach ($parts as $pathPart) {

src/PHPCR/Util/QOM/BaseQomToSqlQueryConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ protected function convertPropertyValue(QOM\PropertyValueInterface $value)
237237
*/
238238
protected function convertOrderings(array $orderings)
239239
{
240-
$list = array();
240+
$list = [];
241241
/** @var $ordering QOM\OrderingInterface */
242242
foreach ($orderings as $ordering) {
243243
$order = $this->generator->evalOrder($ordering->getOrder());

src/PHPCR/Util/QOM/QueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public function addOrderBy(DynamicOperandInterface $sort, $order = 'ASC')
243243
*/
244244
public function orderBy(DynamicOperandInterface $sort, $order = 'ASC')
245245
{
246-
$this->orderings = array();
246+
$this->orderings = [];
247247
$this->addOrderBy($sort, $order);
248248

249249
return $this;

0 commit comments

Comments
 (0)