Skip to content

Commit 70d7470

Browse files
dbuStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 481851e commit 70d7470

File tree

84 files changed

+908
-996
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+908
-996
lines changed

src/PHPCR/Util/CND/Exception/ParserException.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
namespace PHPCR\Util\CND\Exception;
44

5-
use PHPCR\Util\CND\Scanner\TokenQueue;
65
use PHPCR\Util\CND\Scanner\GenericToken;
6+
use PHPCR\Util\CND\Scanner\TokenQueue;
77

88
/**
99
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
10-
*
1110
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
1211
* @license http://opensource.org/licenses/MIT MIT License
13-
*
1412
*/
1513
class ParserException extends \Exception
1614
{
@@ -26,7 +24,7 @@ public function __construct(TokenQueue $queue, $msg)
2624
break;
2725
}
2826
$token = $queue->get();
29-
$lookup .= $token->getData() . ' ';
27+
$lookup .= $token->getData().' ';
3028
}
3129
$msg .= "\nBuffer lookup: \"$lookup\"";
3230

src/PHPCR/Util/CND/Exception/ScannerException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
/**
88
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
99
* @license http://opensource.org/licenses/MIT MIT License
10-
*
1110
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
1211
*/
1312
class ScannerException extends \Exception

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace PHPCR\Util\CND\Parser;
44

5+
use PHPCR\Util\CND\Exception\ParserException;
56
use PHPCR\Util\CND\Scanner\GenericToken as Token;
67
use PHPCR\Util\CND\Scanner\TokenQueue;
7-
use PHPCR\Util\CND\Exception\ParserException;
88

99
/**
10-
* Abstract base class for parsers
10+
* Abstract base class for parsers.
1111
*
1212
* It implements helper functions for parsers:
1313
*
@@ -17,13 +17,12 @@
1717
*
1818
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
1919
* @license http://opensource.org/licenses/MIT MIT License
20-
*
2120
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
2221
*/
2322
abstract class AbstractParser
2423
{
2524
/**
26-
* The token queue
25+
* The token queue.
2726
*
2827
* @var TokenQueue
2928
*/
@@ -38,7 +37,7 @@ abstract class AbstractParser
3837
* @param null|string $data The expected data or null
3938
* @param bool $ignoreCase whether to do string comparisons case insensitive or sensitive
4039
*
41-
* @return boolean
40+
* @return bool
4241
*/
4342
protected function checkToken($type, $data = null, $ignoreCase = false)
4443
{
@@ -69,7 +68,7 @@ protected function checkToken($type, $data = null, $ignoreCase = false)
6968
* @param int $type
7069
* @param array $data
7170
*
72-
* @return boolean
71+
* @return bool
7372
*/
7473
protected function checkTokenIn($type, array $data, $ignoreCase = false)
7574
{
@@ -89,9 +88,9 @@ protected function checkTokenIn($type, array $data, $ignoreCase = false)
8988
* @param int $type The expected token type
9089
* @param null|string $data The expected token data or null
9190
*
92-
* @return Token
93-
*
9491
* @throws ParserException
92+
*
93+
* @return Token
9594
*/
9695
protected function expectToken($type, $data = null)
9796
{
@@ -113,7 +112,7 @@ protected function expectToken($type, $data = null)
113112
* @param int $type The expected token type
114113
* @param null|string $data The expected token data or null
115114
*
116-
* @return boolean|Token
115+
* @return bool|Token
117116
*/
118117
protected function checkAndExpectToken($type, $data = null)
119118
{

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

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
use PHPCR\NodeType\NodeTypeTemplateInterface;
88
use PHPCR\NodeType\PropertyDefinitionTemplateInterface;
99
use PHPCR\PropertyType;
10+
use PHPCR\Util\CND\Exception\ParserException;
1011
use PHPCR\Util\CND\Reader\BufferReader;
1112
use PHPCR\Util\CND\Reader\FileReader;
1213
use PHPCR\Util\CND\Reader\ReaderInterface;
1314
use PHPCR\Util\CND\Scanner\Context\DefaultScannerContextWithoutSpacesAndComments;
1415
use PHPCR\Util\CND\Scanner\GenericScanner;
1516
use PHPCR\Util\CND\Scanner\GenericToken as Token;
16-
use PHPCR\Util\CND\Exception\ParserException;
1717
use PHPCR\Version\OnParentVersionAction;
1818

1919
/**
@@ -29,19 +29,18 @@
2929
*
3030
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
3131
* @license http://opensource.org/licenses/MIT MIT License
32-
*
3332
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
3433
* @author David Buchmann <mail@davidbu.ch>
3534
*/
3635
class CndParser extends AbstractParser
3736
{
3837
// node type attributes
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);
38+
private $ORDERABLE = ['o', 'ord', 'orderable']; //, 'variant' => true);
39+
private $MIXIN = ['m', 'mix', 'mixin']; //, 'variant' => true);
40+
private $ABSTRACT = ['a', 'abs', 'abstract']; //, 'variant' => true);
41+
private $NOQUERY = ['noquery', 'nq']; //, 'variant' => false);
42+
private $QUERY = ['query', 'q']; //, 'variant' => false);
43+
private $PRIMARYITEM = ['primaryitem', '!']; //, 'variant' => false);
4544

4645
// common for properties and child definitions
4746
private $PRIMARY = ['!', 'pri', 'primary']; //, 'variant' => true),
@@ -90,7 +89,7 @@ public function __construct(NodeTypeManagerInterface $ntm)
9089
* @param string $filename absolute path to the CND file to read
9190
*
9291
* @return array with the namespaces map and the nodeTypes which is a
93-
* hashmap of typename = > NodeTypeDefinitionInterface
92+
* hashmap of typename = > NodeTypeDefinitionInterface
9493
*/
9594
public function parseFile($filename)
9695
{
@@ -105,7 +104,7 @@ public function parseFile($filename)
105104
* @param string $cnd string with CND content
106105
*
107106
* @return array with the namespaces map and the nodeTypes which is a
108-
* hashmap of typename = > NodeTypeDefinitionInterface
107+
* hashmap of typename = > NodeTypeDefinitionInterface
109108
*/
110109
public function parseString($cnd)
111110
{
@@ -131,7 +130,7 @@ private function parse(ReaderInterface $reader)
131130

132131
return [
133132
'namespaces' => $this->namespaces,
134-
'nodeTypes' => $this->nodeTypes,
133+
'nodeTypes' => $this->nodeTypes,
135134
];
136135
}
137136

@@ -283,7 +282,7 @@ protected function parseNodeTypeAttributes(NodeTypeTemplateInterface $nodeType)
283282
}
284283

285284
/**
286-
* Parse both the children propery and nodes definitions
285+
* Parse both the children propery and nodes definitions.
287286
*
288287
* {PropertyDef | ChildNodeDef}
289288
*/
@@ -369,11 +368,11 @@ protected function parsePropDef(NodeTypeTemplateInterface $nodeType)
369368
*/
370369
protected function parsePropertyType(PropertyDefinitionTemplateInterface $property)
371370
{
372-
$types = ["STRING", "BINARY", "LONG", "DOUBLE", "BOOLEAN", "DATE", "NAME", "PATH",
373-
"REFERENCE", "WEAKREFERENCE", "DECIMAL", "URI", "UNDEFINED", "*", "?"];
371+
$types = ['STRING', 'BINARY', 'LONG', 'DOUBLE', 'BOOLEAN', 'DATE', 'NAME', 'PATH',
372+
'REFERENCE', 'WEAKREFERENCE', 'DECIMAL', 'URI', 'UNDEFINED', '*', '?', ];
374373

375-
if (! $this->checkTokenIn(Token::TK_IDENTIFIER, $types, true)) {
376-
throw new ParserException($this->tokenQueue, sprintf("Invalid property type: %s", $this->tokenQueue->get()->getData()));
374+
if (!$this->checkTokenIn(Token::TK_IDENTIFIER, $types, true)) {
375+
throw new ParserException($this->tokenQueue, sprintf('Invalid property type: %s', $this->tokenQueue->get()->getData()));
377376
}
378377

379378
$data = $this->tokenQueue->get()->getData();
@@ -387,7 +386,7 @@ protected function parsePropertyType(PropertyDefinitionTemplateInterface $proper
387386
* The default values, if any, are listed after a '='. The attribute is a
388387
* list in order to accommodate multi-value properties. The absence of this
389388
* element indicates that there is no static default value reportable. A '?'
390-
* indicates that this attribute is a variant
389+
* indicates that this attribute is a variant.
391390
*
392391
* DefaultValues ::= '=' (StringList | '?')
393392
*/
@@ -405,7 +404,7 @@ protected function parseDefaultValue(PropertyDefinitionTemplateInterface $proper
405404
/**
406405
* The value constraints, if any, are listed after a '<'. The absence of
407406
* this element indicates that no value constraints reportable within the
408-
* value constraint syntax. A '?' indicates that this attribute is a variant
407+
* value constraint syntax. A '?' indicates that this attribute is a variant.
409408
*
410409
* ValueConstraints ::= '<' (StringList | '?')
411410
*/
@@ -500,7 +499,7 @@ protected function parsePropertyAttributes(NodeTypeTemplateInterface $parentType
500499
$property->setQueryOrderable(false);
501500
} elseif ($this->checkTokenIn(Token::TK_IDENTIFIER, $this->OPV)) {
502501
if ($opvSeen) {
503-
throw new ParserException($this->tokenQueue, 'More than one on parent version action specified on property ' . $property->getName());
502+
throw new ParserException($this->tokenQueue, 'More than one on parent version action specified on property '.$property->getName());
504503
}
505504
$token = $this->tokenQueue->get();
506505
$property->setOnParentVersion(OnParentVersionAction::valueFromName($token->getData()));
@@ -624,7 +623,7 @@ protected function parseChildNodeAttributes(
624623
}
625624

626625
/**
627-
* Parse a string list
626+
* Parse a string list.
628627
*
629628
* StringList ::= String {',' String}
630629
*
@@ -643,7 +642,7 @@ protected function parseCndStringList()
643642
}
644643

645644
/**
646-
* Parse a string
645+
* Parse a string.
647646
*
648647
* String ::= QuotedString | UnquotedString
649648
* QuotedString ::= SingleQuotedString | DoubleQuotedString

src/PHPCR/Util/CND/Reader/BufferReader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
/**
66
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
77
* @license http://opensource.org/licenses/MIT MIT License
8-
*
98
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
109
* @author Nikola Petkanski <nikola@petkanski.com>
1110
*/
@@ -57,7 +56,7 @@ class BufferReader implements ReaderInterface
5756
public function __construct($buffer)
5857
{
5958
$this->eofMarker = chr(1);
60-
$this->buffer = str_replace("\r\n", "\n", $buffer) . $this->eofMarker;
59+
$this->buffer = str_replace("\r\n", "\n", $buffer).$this->eofMarker;
6160

6261
$this->reset();
6362
}
@@ -96,7 +95,8 @@ public function getCurrentColumn()
9695
}
9796

9897
/**
99-
* Return the literal delimited by start and end position
98+
* Return the literal delimited by start and end position.
99+
*
100100
* @return string
101101
*/
102102
public function current()
@@ -110,7 +110,7 @@ public function currentChar()
110110
}
111111

112112
/**
113-
* @return boolean
113+
* @return bool
114114
*/
115115
public function isEof()
116116
{
@@ -121,7 +121,7 @@ public function isEof()
121121
}
122122

123123
/**
124-
* Advance the forward position and return the literal delimited by start and end position
124+
* Advance the forward position and return the literal delimited by start and end position.
125125
*
126126
* @return string
127127
*/

src/PHPCR/Util/CND/Reader/FileReader.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
/**
66
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
77
* @license http://opensource.org/licenses/MIT MIT License
8-
*
98
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
109
* @author Nikola Petkanski <nikola@petkanski.com>
1110
*/

src/PHPCR/Util/CND/Reader/ReaderInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
/**
66
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
77
* @license http://opensource.org/licenses/MIT MIT License
8-
*
98
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
109
*/
1110
interface ReaderInterface
@@ -21,7 +20,7 @@ public function getEofMarker();
2120
public function currentChar();
2221

2322
/**
24-
* @return boolean
23+
* @return bool
2524
*/
2625
public function isEof();
2726

@@ -36,28 +35,29 @@ public function getCurrentLine();
3635
public function getCurrentColumn();
3736

3837
/**
39-
* Return the literal delimited by start and end position
38+
* Return the literal delimited by start and end position.
4039
*
4140
* @return string
4241
*/
4342
public function current();
4443

4544
/**
46-
* Advance the forward position and return the literal delimited by start and end position
45+
* Advance the forward position and return the literal delimited by start and end position.
46+
*
4747
* @return string
4848
*/
4949
public function forward();
5050

5151
public function forwardChar();
5252

5353
/**
54-
* Rewind the forward position to the start position
54+
* Rewind the forward position to the start position.
5555
*/
5656
public function rewind();
5757

5858
/**
5959
* Return the literal delimited by start and end position, then set the
60-
* start position to the end position
60+
* start position to the end position.
6161
*
6262
* @return string
6363
*/

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
/**
88
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
99
* @license http://opensource.org/licenses/MIT MIT License
10-
*
1110
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
1211
*/
1312
abstract class AbstractScanner

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
/**
66
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
77
* @license http://opensource.org/licenses/MIT MIT License
8-
*
98
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
109
*/
1110
class DefaultScannerContext extends ScannerContext
1211
{
1312
public function __construct()
1413
{
15-
$this->addWhitespace(" ");
14+
$this->addWhitespace(' ');
1615
$this->addWhitespace("\t");
1716

1817
$this->addStringDelimiter('\'');

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
/**
88
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
99
* @license http://opensource.org/licenses/MIT MIT License
10-
*
1110
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
1211
*/
1312
class DefaultScannerContextWithoutSpacesAndComments extends DefaultScannerContext

0 commit comments

Comments
 (0)