From 7e52120c8ac638c3c690d582d1c63c6cc3d87449 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Wed, 27 Sep 2017 08:19:51 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/PHPCR/Util/CND/Parser/CndParser.php | 54 +++++++++---------- .../Scanner/Context/DefaultScannerContext.php | 4 +- .../CND/Scanner/Context/ScannerContext.php | 12 ++--- src/PHPCR/Util/CND/Scanner/TokenQueue.php | 2 +- src/PHPCR/Util/CND/Writer/CndWriter.php | 2 +- .../Util/Console/Command/NodeDumpCommand.php | 4 +- .../Util/Console/Command/NodeTouchCommand.php | 4 +- .../Console/Command/NodesUpdateCommand.php | 4 +- .../Helper/PhpcrConsoleDumperHelper.php | 4 +- src/PHPCR/Util/Console/Helper/PhpcrHelper.php | 14 ++--- .../ConsoleDumperPropertyVisitor.php | 16 +++--- src/PHPCR/Util/NodeHelper.php | 8 +-- src/PHPCR/Util/PathHelper.php | 4 +- .../Util/QOM/BaseQomToSqlQueryConverter.php | 2 +- src/PHPCR/Util/QOM/QueryBuilder.php | 2 +- .../Util/QOM/Sql2ToQomQueryConverter.php | 24 ++++----- src/PHPCR/Util/ValueConverter.php | 2 +- .../Tests/Util/CND/Scanner/TokenQueueTest.php | 2 +- .../Console/Command/NodeDumpCommandTest.php | 2 +- .../Console/Command/NodeRemoveCommandTest.php | 8 +-- .../Command/NodesUpdateCommandTest.php | 8 +-- .../Command/WorkspaceDeleteCommandTest.php | 4 +- .../Command/WorkspaceListCommandTest.php | 4 +- tests/PHPCR/Tests/Util/PathHelperTest.php | 10 ++-- .../PHPCR/Tests/Util/QOM/QueryBuilderTest.php | 2 +- .../Tests/Util/QOM/Sql2GeneratorTest.php | 2 +- 26 files changed, 102 insertions(+), 102 deletions(-) diff --git a/src/PHPCR/Util/CND/Parser/CndParser.php b/src/PHPCR/Util/CND/Parser/CndParser.php index a912ff5..7dc5b48 100644 --- a/src/PHPCR/Util/CND/Parser/CndParser.php +++ b/src/PHPCR/Util/CND/Parser/CndParser.php @@ -36,30 +36,30 @@ class CndParser extends AbstractParser { // node type attributes - private $ORDERABLE = array('o', 'ord', 'orderable');//, 'variant' => true); - private $MIXIN = array('m', 'mix', 'mixin');//, 'variant' => true); - private $ABSTRACT = array('a', 'abs', 'abstract');//, 'variant' => true); - private $NOQUERY = array('noquery', 'nq');//, 'variant' => false); - private $QUERY = array('query', 'q');//, 'variant' => false); - private $PRIMARYITEM = array('primaryitem', '!');//, 'variant' => false); + private $ORDERABLE = ['o', 'ord', 'orderable'];//, 'variant' => true); + private $MIXIN = ['m', 'mix', 'mixin'];//, 'variant' => true); + private $ABSTRACT = ['a', 'abs', 'abstract'];//, 'variant' => true); + private $NOQUERY = ['noquery', 'nq'];//, 'variant' => false); + private $QUERY = ['query', 'q'];//, 'variant' => false); + private $PRIMARYITEM = ['primaryitem', '!'];//, 'variant' => false); // common for properties and child definitions - private $PRIMARY = array('!', 'pri', 'primary'); //, 'variant' => true), - private $AUTOCREATED = array('a', 'aut', 'autocreated'); //, 'variant' => true), - private $MANDATORY = array('m', 'man', 'mandatory'); //, 'variant' => true), - private $PROTECTED = array('p', 'pro', 'protected'); //, 'variant' => true), - private $OPV = array('COPY', 'VERSION', 'INITIALIZE', 'COMPUTE', 'IGNORE', 'ABORT'); + private $PRIMARY = ['!', 'pri', 'primary']; //, 'variant' => true), + private $AUTOCREATED = ['a', 'aut', 'autocreated']; //, 'variant' => true), + private $MANDATORY = ['m', 'man', 'mandatory']; //, 'variant' => true), + private $PROTECTED = ['p', 'pro', 'protected']; //, 'variant' => true), + private $OPV = ['COPY', 'VERSION', 'INITIALIZE', 'COMPUTE', 'IGNORE', 'ABORT']; // property type attributes - private $MULTIPLE = array('*', 'mul', 'multiple'); //, 'variant' => true), - private $QUERYOPS = array('qop', 'queryops'); //, 'variant' => true), // Needs special handling ! - private $NOFULLTEXT = array('nof', 'nofulltext'); //, 'variant' => true), - private $NOQUERYORDER = array('nqord', 'noqueryorder'); //, 'variant' => true), + private $MULTIPLE = ['*', 'mul', 'multiple']; //, 'variant' => true), + private $QUERYOPS = ['qop', 'queryops']; //, 'variant' => true), // Needs special handling ! + private $NOFULLTEXT = ['nof', 'nofulltext']; //, 'variant' => true), + private $NOQUERYORDER = ['nqord', 'noqueryorder']; //, 'variant' => true), // child node attributes // multiple is actually a jackrabbit specific synonym for sns // http://www.mail-archive.com/users@jackrabbit.apache.org/msg19268.html - private $SNS = array('*', 'sns', 'multiple'); //, 'variant' => true), + private $SNS = ['*', 'sns', 'multiple']; //, 'variant' => true), /** * @var NodeTypeManagerInterface @@ -69,12 +69,12 @@ class CndParser extends AbstractParser /** * @var array */ - protected $namespaces = array(); + protected $namespaces = []; /** * @var array */ - protected $nodeTypes = array(); + protected $nodeTypes = []; /** * @param NodeTypeManagerInterface $ntm @@ -129,10 +129,10 @@ private function parse(ReaderInterface $reader) } } - return array( + return [ 'namespaces' => $this->namespaces, 'nodeTypes' => $this->nodeTypes, - ); + ]; } /** @@ -208,7 +208,7 @@ protected function parseSupertypes(NodeTypeTemplateInterface $nodeType) $this->expectToken(Token::TK_SYMBOL, '>'); if ($this->checkAndExpectToken(Token::TK_SYMBOL, '?')) { - $nodeType->setDeclaredSuperTypeNames(array('?')); + $nodeType->setDeclaredSuperTypeNames(['?']); } else { $nodeType->setDeclaredSuperTypeNames($this->parseCndStringList()); } @@ -369,8 +369,8 @@ protected function parsePropDef(NodeTypeTemplateInterface $nodeType) */ protected function parsePropertyType(PropertyDefinitionTemplateInterface $property) { - $types = array("STRING", "BINARY", "LONG", "DOUBLE", "BOOLEAN", "DATE", "NAME", "PATH", - "REFERENCE", "WEAKREFERENCE", "DECIMAL", "URI", "UNDEFINED", "*", "?"); + $types = ["STRING", "BINARY", "LONG", "DOUBLE", "BOOLEAN", "DATE", "NAME", "PATH", + "REFERENCE", "WEAKREFERENCE", "DECIMAL", "URI", "UNDEFINED", "*", "?"]; if (! $this->checkTokenIn(Token::TK_IDENTIFIER, $types, true)) { throw new ParserException($this->tokenQueue, sprintf("Invalid property type: %s", $this->tokenQueue->get()->getData())); @@ -394,7 +394,7 @@ protected function parsePropertyType(PropertyDefinitionTemplateInterface $proper protected function parseDefaultValue(PropertyDefinitionTemplateInterface $property) { if ($this->checkAndExpectToken(Token::TK_SYMBOL, '?')) { - $list = array('?'); + $list = ['?']; } else { $list = $this->parseCndStringList(); } @@ -414,7 +414,7 @@ protected function parseValueConstraints(PropertyDefinitionTemplateInterface $pr $this->expectToken(Token::TK_SYMBOL, '<'); if ($this->checkAndExpectToken(Token::TK_SYMBOL, '?')) { - $list = array('?'); + $list = ['?']; } else { $list = $this->parseCndStringList(); } @@ -632,7 +632,7 @@ protected function parseChildNodeAttributes( */ protected function parseCndStringList() { - $strings = array(); + $strings = []; $strings[] = $this->parseCndString(); while ($this->checkAndExpectToken(Token::TK_SYMBOL, ',')) { @@ -728,7 +728,7 @@ protected function parseQueryOpsAttribute() throw new ParserException($this->tokenQueue, 'TODO: understand what "variant" means'); } - $ops = array(); + $ops = []; do { $op = $this->parseQueryOperator(); $ops[] = $op; diff --git a/src/PHPCR/Util/CND/Scanner/Context/DefaultScannerContext.php b/src/PHPCR/Util/CND/Scanner/Context/DefaultScannerContext.php index 1242664..c80705c 100644 --- a/src/PHPCR/Util/CND/Scanner/Context/DefaultScannerContext.php +++ b/src/PHPCR/Util/CND/Scanner/Context/DefaultScannerContext.php @@ -22,10 +22,10 @@ public function __construct() $this->addBlockCommentDelimiter('/*', '*/'); - $symbols = array( + $symbols = [ '<', '>', '+', '*', '%', '&', '/', '(', ')', '=', '?', '#', '|', '!', '~', '[', ']', '{', '}', '$', ',', ';', ':', '.', '-', '_', '\\', - ); + ]; foreach ($symbols as $symbol) { $this->addSymbol($symbol); } diff --git a/src/PHPCR/Util/CND/Scanner/Context/ScannerContext.php b/src/PHPCR/Util/CND/Scanner/Context/ScannerContext.php index 42be844..7a72915 100644 --- a/src/PHPCR/Util/CND/Scanner/Context/ScannerContext.php +++ b/src/PHPCR/Util/CND/Scanner/Context/ScannerContext.php @@ -16,7 +16,7 @@ class ScannerContext * Characters to be considered as white spaces * @var array */ - protected $whitespaces = array(); + protected $whitespaces = []; /** * Characters to be considered as paired string delimiters. @@ -26,21 +26,21 @@ class ScannerContext * * @var array */ - protected $stringDelimiters = array(); + protected $stringDelimiters = []; /** * Line comments start * * @var array */ - protected $lineCommentDelimiters = array(); + protected $lineCommentDelimiters = []; /** * Block comments delimiters * * @var array */ - protected $blockCommentDelimiters = array(); + protected $blockCommentDelimiters = []; /** * Characters to be considered as symbols. @@ -49,12 +49,12 @@ class ScannerContext * * @var array */ - protected $symbols = array(); + protected $symbols = []; /** * @var TokenFilterInterface[] */ - protected $tokenFilters = array(); + protected $tokenFilters = []; /** * @param string $startDelim diff --git a/src/PHPCR/Util/CND/Scanner/TokenQueue.php b/src/PHPCR/Util/CND/Scanner/TokenQueue.php index eff51b4..ae141e1 100644 --- a/src/PHPCR/Util/CND/Scanner/TokenQueue.php +++ b/src/PHPCR/Util/CND/Scanner/TokenQueue.php @@ -15,7 +15,7 @@ class TokenQueue implements \IteratorAggregate */ protected $tokens; - public function __construct($tokens = array()) + public function __construct($tokens = []) { $this->tokens = $tokens; } diff --git a/src/PHPCR/Util/CND/Writer/CndWriter.php b/src/PHPCR/Util/CND/Writer/CndWriter.php index ef8ce79..046d01f 100644 --- a/src/PHPCR/Util/CND/Writer/CndWriter.php +++ b/src/PHPCR/Util/CND/Writer/CndWriter.php @@ -33,7 +33,7 @@ class CndWriter private $ns; /** @var array hashmap of prefix => namespace uri */ - private $namespaces = array(); + private $namespaces = []; /** * @param NodeTypeManagerInterface $ntm diff --git a/src/PHPCR/Util/Console/Command/NodeDumpCommand.php b/src/PHPCR/Util/Console/Command/NodeDumpCommand.php index dbc3bcf..ee22d95 100644 --- a/src/PHPCR/Util/Console/Command/NodeDumpCommand.php +++ b/src/PHPCR/Util/Console/Command/NodeDumpCommand.php @@ -72,14 +72,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $identifier = $input->getArgument('identifier'); // whether to dump node uuid - $options = array(); + $options = []; $options['dump_uuids'] = $input->hasParameterOption('--identifiers'); $options['ref_format'] = $input->getOption('ref-format'); $options['show_props'] = $input->hasParameterOption('--props'); $options['show_sys_nodes'] = $input->hasParameterOption('--sys-nodes'); $options['max_line_length'] = $input->getOption('max_line_length'); - if (null !== $options['ref_format'] && !in_array($options['ref_format'], array('uuid', 'path'))) { + if (null !== $options['ref_format'] && !in_array($options['ref_format'], ['uuid', 'path'])) { throw new Exception('The ref-format option must be set to either "path" or "uuid"'); } diff --git a/src/PHPCR/Util/Console/Command/NodeTouchCommand.php b/src/PHPCR/Util/Console/Command/NodeTouchCommand.php index b856db8..9e8d72e 100644 --- a/src/PHPCR/Util/Console/Command/NodeTouchCommand.php +++ b/src/PHPCR/Util/Console/Command/NodeTouchCommand.php @@ -132,13 +132,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $node = $parentNode->addNode($nodeName, $type); } - $helper->processNode($output, $node, array( + $helper->processNode($output, $node, [ 'setProp' => $setProp, 'removeProp' => $removeProp, 'addMixins' => $addMixins, 'removeMixins' => $removeMixins, 'dump' => $dump, - )); + ]); $session->save(); diff --git a/src/PHPCR/Util/Console/Command/NodesUpdateCommand.php b/src/PHPCR/Util/Console/Command/NodesUpdateCommand.php index 881406e..ff793ff 100644 --- a/src/PHPCR/Util/Console/Command/NodesUpdateCommand.php +++ b/src/PHPCR/Util/Console/Command/NodesUpdateCommand.php @@ -132,13 +132,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $node = $row->getNode(); - $helper->processNode($output, $node, array( + $helper->processNode($output, $node, [ 'setProp' => $setProp, 'removeProp' => $removeProp, 'addMixins' => $addMixins, 'removeMixins' => $removeMixins, 'applyClosures' => $applyClosures, - )); + ]); $persistIn--; if (0 === $persistIn) { diff --git a/src/PHPCR/Util/Console/Helper/PhpcrConsoleDumperHelper.php b/src/PHPCR/Util/Console/Helper/PhpcrConsoleDumperHelper.php index 35b96ce..9e3a779 100644 --- a/src/PHPCR/Util/Console/Helper/PhpcrConsoleDumperHelper.php +++ b/src/PHPCR/Util/Console/Helper/PhpcrConsoleDumperHelper.php @@ -20,12 +20,12 @@ class PhpcrConsoleDumperHelper extends Helper { public function getTreeWalker(OutputInterface $output, $options) { - $options = array_merge(array( + $options = array_merge([ 'dump_uuids' => false, 'ref_format' => 'uuid', 'show_props' => false, 'show_sys_nodes' => false, - ), $options); + ], $options); $propVisitor = null; $nodeVisitor = new ConsoleDumperNodeVisitor($output, $options['dump_uuids']); diff --git a/src/PHPCR/Util/Console/Helper/PhpcrHelper.php b/src/PHPCR/Util/Console/Helper/PhpcrHelper.php index 889b7f2..d0aea35 100644 --- a/src/PHPCR/Util/Console/Helper/PhpcrHelper.php +++ b/src/PHPCR/Util/Console/Helper/PhpcrHelper.php @@ -64,14 +64,14 @@ public function getName() */ public function processNode(OutputInterface $output, NodeInterface $node, array $operations) { - $operations = array_merge(array( - 'setProp' => array(), - 'removeProp' => array(), - 'addMixins' => array(), - 'removeMixins' => array(), - 'applyClosures' => array(), + $operations = array_merge([ + 'setProp' => [], + 'removeProp' => [], + 'addMixins' => [], + 'removeMixins' => [], + 'applyClosures' => [], 'dump' => false, - ), $operations); + ], $operations); foreach ($operations['setProp'] as $set) { $parts = explode('=', $set); diff --git a/src/PHPCR/Util/Console/Helper/TreeDumper/ConsoleDumperPropertyVisitor.php b/src/PHPCR/Util/Console/Helper/TreeDumper/ConsoleDumperPropertyVisitor.php index 350b8b3..b2e896f 100644 --- a/src/PHPCR/Util/Console/Helper/TreeDumper/ConsoleDumperPropertyVisitor.php +++ b/src/PHPCR/Util/Console/Helper/TreeDumper/ConsoleDumperPropertyVisitor.php @@ -33,12 +33,12 @@ class ConsoleDumperPropertyVisitor extends ConsoleDumperItemVisitor * @param OutputInterface $output * @param array $options */ - public function __construct(OutputInterface $output, $options = array()) + public function __construct(OutputInterface $output, $options = []) { - $options = array_merge(array( + $options = array_merge([ 'max_line_length' => 120, 'ref_format' => 'uuid', - ), $options); + ], $options); parent::__construct($output); @@ -69,13 +69,13 @@ public function visit(ItemInterface $item) $value = substr($value, 0, $this->maxLineLength) . '...'; } - $referrers = array(); + $referrers = []; - if (in_array($item->getType(), array( + if (in_array($item->getType(), [ PropertyType::WEAKREFERENCE, PropertyType::REFERENCE - ))) { - $referenceStrings = array(); + ])) { + $referenceStrings = []; if ('path' == $this->refFormat) { $references = (array) $item->getValue(); @@ -90,7 +90,7 @@ public function visit(ItemInterface $item) $value = ''; } - $value = str_replace(array("\n", "\t"), '', $value); + $value = str_replace(["\n", "\t"], '', $value); $this->output->writeln(str_repeat(' ', $this->level + 1) . '- ' . $item->getName() . ' = ' . $value); diff --git a/src/PHPCR/Util/NodeHelper.php b/src/PHPCR/Util/NodeHelper.php index dcc28c1..087068c 100644 --- a/src/PHPCR/Util/NodeHelper.php +++ b/src/PHPCR/Util/NodeHelper.php @@ -176,10 +176,10 @@ public static function generateAutoNodeName($usedNames, $namespaces, $defaultNam return self::generateWithPrefix($usedNames, ''); } - /* - * "somePrefix:" where somePrefix is a syntactically - * valid namespace prefix - */ + /* + * "somePrefix:" where somePrefix is a syntactically + * valid namespace prefix + */ if (':' === $nameHint[strlen($nameHint)-1] && substr_count($nameHint, ':') === 1 && preg_match('#^[a-zA-Z][a-zA-Z0-9]*:$#', $nameHint) diff --git a/src/PHPCR/Util/PathHelper.php b/src/PHPCR/Util/PathHelper.php index c82d9b1..d922b4a 100644 --- a/src/PHPCR/Util/PathHelper.php +++ b/src/PHPCR/Util/PathHelper.php @@ -58,7 +58,7 @@ public static function assertValidAbsolutePath($path, $destination = false, $thr return self::error("Destination path may not end with index: '$path'", $throw); } if ($namespacePrefixes) { - $matches = array(); + $matches = []; preg_match_all('#/(?P[^/:]+):#', $path, $matches); $unknown = array_diff(array_unique($matches['prefixes']), $namespacePrefixes); if (count($unknown)) { @@ -144,7 +144,7 @@ public static function normalizePath($path, $destination = false, $throw = true) return self::error("Not an absolute path '$path'", $throw); } - $finalParts= array(); + $finalParts= []; $parts = explode('/', $path); foreach ($parts as $pathPart) { diff --git a/src/PHPCR/Util/QOM/BaseQomToSqlQueryConverter.php b/src/PHPCR/Util/QOM/BaseQomToSqlQueryConverter.php index 67e7bca..09fef6d 100644 --- a/src/PHPCR/Util/QOM/BaseQomToSqlQueryConverter.php +++ b/src/PHPCR/Util/QOM/BaseQomToSqlQueryConverter.php @@ -237,7 +237,7 @@ protected function convertPropertyValue(QOM\PropertyValueInterface $value) */ protected function convertOrderings(array $orderings) { - $list = array(); + $list = []; /** @var $ordering QOM\OrderingInterface */ foreach ($orderings as $ordering) { $order = $this->generator->evalOrder($ordering->getOrder()); diff --git a/src/PHPCR/Util/QOM/QueryBuilder.php b/src/PHPCR/Util/QOM/QueryBuilder.php index 5626ca4..7597190 100644 --- a/src/PHPCR/Util/QOM/QueryBuilder.php +++ b/src/PHPCR/Util/QOM/QueryBuilder.php @@ -243,7 +243,7 @@ public function addOrderBy(DynamicOperandInterface $sort, $order = 'ASC') */ public function orderBy(DynamicOperandInterface $sort, $order = 'ASC') { - $this->orderings = array(); + $this->orderings = []; $this->addOrderBy($sort, $order); return $this; diff --git a/src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php b/src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php index f08ecf9..80eccd0 100644 --- a/src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php +++ b/src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php @@ -99,9 +99,9 @@ public function parse($sql2) $this->sql2 = $sql2; $this->scanner = new Sql2Scanner($sql2); $source = null; - $columnData = array(); + $columnData = []; $constraint = null; - $orderings = array(); + $orderings = []; while ($this->scanner->lookupNextToken() !== '') { switch (strtoupper($this->scanner->lookupNextToken())) { @@ -119,7 +119,7 @@ public function parse($sql2) break; case 'ORDER': // Ordering, check there is a BY - $this->scanner->expectTokens(array('ORDER', 'BY')); + $this->scanner->expectTokens(['ORDER', 'BY']); $orderings = $this->parseOrderings(); break; default: @@ -229,11 +229,11 @@ protected function parseJoinType() $this->scanner->fetchNextToken(); break; case 'LEFT': - $this->scanner->expectTokens(array('OUTER', 'JOIN')); + $this->scanner->expectTokens(['OUTER', 'JOIN']); $joinType = Constants::JCR_JOIN_TYPE_LEFT_OUTER; break; case 'RIGHT': - $this->scanner->expectTokens(array('OUTER', 'JOIN')); + $this->scanner->expectTokens(['OUTER', 'JOIN']); $joinType = Constants::JCR_JOIN_TYPE_RIGHT_OUTER; break; default: @@ -292,7 +292,7 @@ protected function parseEquiJoin() */ protected function parseSameNodeJoinCondition() { - $this->scanner->expectTokens(array('ISSAMENODE', '(')); + $this->scanner->expectTokens(['ISSAMENODE', '(']); $selectorName1 = $this->fetchTokenWithoutBrackets(); $this->scanner->expectToken(','); $selectorName2 = $this->fetchTokenWithoutBrackets(); @@ -335,7 +335,7 @@ protected function parseChildNodeJoinCondition() */ protected function parseDescendantNodeJoinCondition() { - $this->scanner->expectTokens(array('ISDESCENDANTNODE', '(')); + $this->scanner->expectTokens(['ISDESCENDANTNODE', '(']); $descendant = $this->fetchTokenWithoutBrackets(); $this->scanner->expectToken(','); $parent = $this->fetchTokenWithoutBrackets(); @@ -361,10 +361,10 @@ protected function parseConstraint($lhs = null, $minprec = 0) $lhs = $this->parsePrimaryConstraint(); } - $opprec = array( + $opprec = [ 'OR' => 1, 'AND' => 2, - ); + ]; $op = strtoupper($this->scanner->lookupNextToken()); while (isset($opprec[$op]) && $opprec[$op] >= $minprec) { @@ -994,7 +994,7 @@ private function parseIdentifier($checkSelector = true) $selectorName = $this->ensureSelectorName($selectorName); } - return array($selectorName, $propertyName); + return [$selectorName, $propertyName]; } /** @@ -1010,7 +1010,7 @@ protected function updateImplicitSelectorName($selectorName) $this->implicitSelectorName = $selectorName; } else { if (!is_array($this->implicitSelectorName)) { - $this->implicitSelectorName = array($this->implicitSelectorName => $this->implicitSelectorName); + $this->implicitSelectorName = [$this->implicitSelectorName => $this->implicitSelectorName]; } if (isset($this->implicitSelectorName[$selectorName])) { throw new InvalidQueryException("Selector $selectorName is already in use"); @@ -1065,7 +1065,7 @@ protected function scanColumn() $columnName = $propertyName; } - return array($selectorName, $propertyName, $columnName); + return [$selectorName, $propertyName, $columnName]; } /** diff --git a/src/PHPCR/Util/ValueConverter.php b/src/PHPCR/Util/ValueConverter.php index 155d068..c39d16d 100644 --- a/src/PHPCR/Util/ValueConverter.php +++ b/src/PHPCR/Util/ValueConverter.php @@ -119,7 +119,7 @@ public function determineType($value, $weak = false) public function convertType($value, $type, $srcType = PropertyType::UNDEFINED) { if (is_array($value)) { - $ret = array(); + $ret = []; foreach ($value as $v) { $ret[] = self::convertType($v, $type, $srcType); } diff --git a/tests/PHPCR/Tests/Util/CND/Scanner/TokenQueueTest.php b/tests/PHPCR/Tests/Util/CND/Scanner/TokenQueueTest.php index 30501f7..db91a14 100644 --- a/tests/PHPCR/Tests/Util/CND/Scanner/TokenQueueTest.php +++ b/tests/PHPCR/Tests/Util/CND/Scanner/TokenQueueTest.php @@ -108,7 +108,7 @@ public function testGet() public function testGetIterator() { $this->assertEquals( - array($this->token0, $this->token1, $this->token2, $this->token3), + [$this->token0, $this->token1, $this->token2, $this->token3], iterator_to_array($this->queue->getIterator()) ); } diff --git a/tests/PHPCR/Tests/Util/Console/Command/NodeDumpCommandTest.php b/tests/PHPCR/Tests/Util/Console/Command/NodeDumpCommandTest.php index 84727e3..46cfc57 100644 --- a/tests/PHPCR/Tests/Util/Console/Command/NodeDumpCommandTest.php +++ b/tests/PHPCR/Tests/Util/Console/Command/NodeDumpCommandTest.php @@ -46,7 +46,7 @@ public function testCommand() ->with($this->node1) ; - $this->executeCommand('phpcr:node:dump', array()); + $this->executeCommand('phpcr:node:dump', []); } public function testCommandIdentifier() diff --git a/tests/PHPCR/Tests/Util/Console/Command/NodeRemoveCommandTest.php b/tests/PHPCR/Tests/Util/Console/Command/NodeRemoveCommandTest.php index ac5e100..822fe4a 100644 --- a/tests/PHPCR/Tests/Util/Console/Command/NodeRemoveCommandTest.php +++ b/tests/PHPCR/Tests/Util/Console/Command/NodeRemoveCommandTest.php @@ -20,19 +20,19 @@ public function testRemove() ->method('removeItem') ->with('/cms'); - $this->executeCommand('phpcr:node:remove', array( + $this->executeCommand('phpcr:node:remove', [ '--force' => true, 'path' => '/cms', - )); + ]); } public function testRemoveRoot() { $this->expectException(LogicException::class); - $this->executeCommand('phpcr:node:remove', array( + $this->executeCommand('phpcr:node:remove', [ '--force' => true, 'path' => '/', - )); + ]); } } diff --git a/tests/PHPCR/Tests/Util/Console/Command/NodesUpdateCommandTest.php b/tests/PHPCR/Tests/Util/Console/Command/NodesUpdateCommandTest.php index db97551..b07b67e 100644 --- a/tests/PHPCR/Tests/Util/Console/Command/NodesUpdateCommandTest.php +++ b/tests/PHPCR/Tests/Util/Console/Command/NodesUpdateCommandTest.php @@ -140,16 +140,16 @@ public function testNodeUpdate($options) public function testApplyClosure() { - $args = array( + $args = [ '--query' => "SELECT foo FROM bar", '--no-interaction' => true, - '--apply-closure' => array( + '--apply-closure' => [ '$session->getNodeByIdentifier("/foo"); $node->setProperty("foo", "bar");', function ($session, $node) { $node->setProperty('foo', 'bar'); } - ), - ); + ], + ]; $this->setupQueryManager(['query' => 'SELECT foo FROM bar']); diff --git a/tests/PHPCR/Tests/Util/Console/Command/WorkspaceDeleteCommandTest.php b/tests/PHPCR/Tests/Util/Console/Command/WorkspaceDeleteCommandTest.php index 5b1f16e..d17c40e 100644 --- a/tests/PHPCR/Tests/Util/Console/Command/WorkspaceDeleteCommandTest.php +++ b/tests/PHPCR/Tests/Util/Console/Command/WorkspaceDeleteCommandTest.php @@ -42,10 +42,10 @@ public function testDelete() ->with('test_workspace') ; - $ct = $this->executeCommand('phpcr:workspace:delete', array( + $ct = $this->executeCommand('phpcr:workspace:delete', [ 'name' => 'test_workspace', '--force' => 'true', - )); + ]); $this->assertContains("Deleted workspace 'test_workspace'.", $ct->getDisplay()); } diff --git a/tests/PHPCR/Tests/Util/Console/Command/WorkspaceListCommandTest.php b/tests/PHPCR/Tests/Util/Console/Command/WorkspaceListCommandTest.php index ecbc36d..36c6c00 100644 --- a/tests/PHPCR/Tests/Util/Console/Command/WorkspaceListCommandTest.php +++ b/tests/PHPCR/Tests/Util/Console/Command/WorkspaceListCommandTest.php @@ -25,8 +25,8 @@ public function testNodeTypeList() 'foo', 'bar' ])); - $ct = $this->executeCommand('phpcr:workspace:list', array( - )); + $ct = $this->executeCommand('phpcr:workspace:list', [ + ]); $expected = <<qf->expects($this->once()) ->method('createQuery') - ->with($source, $constraint, array(), array()) + ->with($source, $constraint, [], []) ->will($this->returnValue($query)); $qb = new QueryBuilder($this->qf); diff --git a/tests/PHPCR/Tests/Util/QOM/Sql2GeneratorTest.php b/tests/PHPCR/Tests/Util/QOM/Sql2GeneratorTest.php index 7ea45fd..bf3d0f0 100644 --- a/tests/PHPCR/Tests/Util/QOM/Sql2GeneratorTest.php +++ b/tests/PHPCR/Tests/Util/QOM/Sql2GeneratorTest.php @@ -78,7 +78,7 @@ public function testColumns() { $literal = $this->generator->evalColumns(null); $this->assertSame('*', $literal); - $literal = $this->generator->evalColumns(array('bar', 'foo')); + $literal = $this->generator->evalColumns(['bar', 'foo']); $this->assertSame('bar, foo', $literal); }