Skip to content

Apply fixes from StyleCI #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions src/PHPCR/Util/CND/Parser/CndParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]/msg19268.html
private $SNS = array('*', 'sns', 'multiple'); //, 'variant' => true),
private $SNS = ['*', 'sns', 'multiple']; //, 'variant' => true),

/**
* @var NodeTypeManagerInterface
Expand All @@ -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
Expand Down Expand Up @@ -129,10 +129,10 @@ private function parse(ReaderInterface $reader)
}
}

return array(
return [
'namespaces' => $this->namespaces,
'nodeTypes' => $this->nodeTypes,
);
];
}

/**
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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()));
Expand All @@ -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();
}
Expand All @@ -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();
}
Expand Down Expand Up @@ -632,7 +632,7 @@ protected function parseChildNodeAttributes(
*/
protected function parseCndStringList()
{
$strings = array();
$strings = [];

$strings[] = $this->parseCndString();
while ($this->checkAndExpectToken(Token::TK_SYMBOL, ',')) {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/PHPCR/Util/CND/Scanner/Context/DefaultScannerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public function __construct()

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

$symbols = array(
$symbols = [
'<', '>', '+', '*', '%', '&', '/', '(', ')', '=', '?', '#', '|', '!', '~',
'[', ']', '{', '}', '$', ',', ';', ':', '.', '-', '_', '\\',
);
];
foreach ($symbols as $symbol) {
$this->addSymbol($symbol);
}
Expand Down
12 changes: 6 additions & 6 deletions src/PHPCR/Util/CND/Scanner/Context/ScannerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -49,12 +49,12 @@ class ScannerContext
*
* @var array
*/
protected $symbols = array();
protected $symbols = [];

/**
* @var TokenFilterInterface[]
*/
protected $tokenFilters = array();
protected $tokenFilters = [];

/**
* @param string $startDelim
Expand Down
2 changes: 1 addition & 1 deletion src/PHPCR/Util/CND/Scanner/TokenQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TokenQueue implements \IteratorAggregate
*/
protected $tokens;

public function __construct($tokens = array())
public function __construct($tokens = [])
{
$this->tokens = $tokens;
}
Expand Down
2 changes: 1 addition & 1 deletion src/PHPCR/Util/CND/Writer/CndWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CndWriter
private $ns;

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

/**
* @param NodeTypeManagerInterface $ntm
Expand Down
4 changes: 2 additions & 2 deletions src/PHPCR/Util/Console/Command/NodeDumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"');
}

Expand Down
4 changes: 2 additions & 2 deletions src/PHPCR/Util/Console/Command/NodeTouchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions src/PHPCR/Util/Console/Command/NodesUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/PHPCR/Util/Console/Helper/PhpcrConsoleDumperHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
14 changes: 7 additions & 7 deletions src/PHPCR/Util/Console/Helper/PhpcrHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand All @@ -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) . '- <info>' . $item->getName() . '</info> = ' . $value);

Expand Down
8 changes: 4 additions & 4 deletions src/PHPCR/Util/NodeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ public static function generateAutoNodeName($usedNames, $namespaces, $defaultNam
return self::generateWithPrefix($usedNames, '');
}

/*
* "<i>somePrefix</i>:" where <i>somePrefix</i> is a syntactically
* valid namespace prefix
*/
/*
* "<i>somePrefix</i>:" where <i>somePrefix</i> 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)
Expand Down
4 changes: 2 additions & 2 deletions src/PHPCR/Util/PathHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<prefixes>[^/:]+):#', $path, $matches);
$unknown = array_diff(array_unique($matches['prefixes']), $namespacePrefixes);
if (count($unknown)) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/PHPCR/Util/QOM/BaseQomToSqlQueryConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/PHPCR/Util/QOM/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading