Skip to content

Commit 51a2bbf

Browse files
authored
Merge pull request #226 from phpcr/cs
cs fixer for php 8.3
2 parents df25fda + 36c0654 commit 51a2bbf

10 files changed

+36
-36
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class AbstractParser
3131
* If the data is not provided (equal to null) then only the token type is checked.
3232
* Return false otherwise.
3333
*/
34-
protected function checkToken(int $type, string $data = null, bool $ignoreCase = false): bool
34+
protected function checkToken(int $type, ?string $data = null, bool $ignoreCase = false): bool
3535
{
3636
if ($this->tokenQueue->isEof()) {
3737
return false;
@@ -79,7 +79,7 @@ protected function checkTokenIn(int $type, array $data, bool $ignoreCase = false
7979
*
8080
* @throws ParserException
8181
*/
82-
protected function expectToken(int $type, string $data = null): Token
82+
protected function expectToken(int $type, ?string $data = null): Token
8383
{
8484
$token = $this->tokenQueue->peek();
8585

@@ -99,7 +99,7 @@ protected function expectToken(int $type, string $data = null): Token
9999
* @param int $type The expected token type
100100
* @param string|null $data The expected token data or null
101101
*/
102-
protected function checkAndExpectToken(int $type, string $data = null): false|Token
102+
protected function checkAndExpectToken(int $type, ?string $data = null): false|Token
103103
{
104104
if ($this->checkToken($type, $data)) {
105105
$token = $this->tokenQueue->peek();

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function peek($offset = 0): Token|false
5454
return $this->tokens[key($this->tokens) + $offset];
5555
}
5656

57-
public function get($count = 1): Token|null
57+
public function get($count = 1): ?Token
5858
{
5959
$item = null;
6060
for ($i = 1; $i <= $count; ++$i) {

src/PHPCR/Util/NodeHelper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static function isSystemItem(ItemInterface $item): bool
137137
* $nameHint which does not exist and this implementation performs
138138
* this validation immediately
139139
*/
140-
public static function generateAutoNodeName(array $usedNames, array $namespaces, string $defaultNamespace, string $nameHint = null): string
140+
public static function generateAutoNodeName(array $usedNames, array $namespaces, string $defaultNamespace, ?string $nameHint = null): string
141141
{
142142
$usedNames = array_flip($usedNames);
143143

src/PHPCR/Util/QOM/BaseQomToSqlQueryConverter.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ protected function convertFullTextSearch(QOM\FullTextSearchInterface $constraint
130130
/**
131131
* FullTextSearchExpression ::= BindVariable | ''' FullTextSearchLiteral '''.
132132
*
133-
* @param string|QOM\StaticOperandInterface $expr
133+
* @param string|StaticOperandInterface $expr
134134
*/
135135
protected function convertFullTextSearchExpression($expr): string
136136
{
@@ -169,7 +169,7 @@ protected function convertFullTextSearchExpression($expr): string
169169
*
170170
* @throws \InvalidArgumentException
171171
*/
172-
protected function convertStaticOperand(QOM\StaticOperandInterface $operand): string
172+
protected function convertStaticOperand(StaticOperandInterface $operand): string
173173
{
174174
if ($operand instanceof QOM\BindVariableValueInterface) {
175175
return $this->convertBindVariable($operand->getBindVariableName());

src/PHPCR/Util/QOM/BaseSqlGenerator.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ abstract public function evalCastLiteral(string $literal, string $type): string;
228228
* @param string|null $selectorName The selector name. If it is different than the nodeTypeName, the alias is
229229
* declared if supported by the SQL dialect.
230230
*/
231-
abstract public function evalSelector(string $nodeTypeName, string $selectorName = null): string;
231+
abstract public function evalSelector(string $nodeTypeName, ?string $selectorName = null): string;
232232

233233
/**
234234
* Evaluate a path. This is different between SQL1 and SQL2.
@@ -244,15 +244,15 @@ abstract public function evalPath(string $path): string;
244244
*/
245245
abstract public function evalColumns(iterable $columns): string;
246246

247-
abstract public function evalColumn(string $selectorName, string $propertyName = null, string $colname = null): string;
247+
abstract public function evalColumn(string $selectorName, ?string $propertyName = null, ?string $colname = null): string;
248248

249249
abstract public function evalPropertyExistence(?string $selectorName, string $propertyName): string;
250250

251-
abstract public function evalPropertyValue(string $propertyName, string $selectorName = null);
251+
abstract public function evalPropertyValue(string $propertyName, ?string $selectorName = null);
252252

253-
abstract public function evalChildNode(string $path, string $selectorName = null);
253+
abstract public function evalChildNode(string $path, ?string $selectorName = null);
254254

255-
abstract public function evalDescendantNode(string $path, string $selectorName = null): string;
255+
abstract public function evalDescendantNode(string $path, ?string $selectorName = null): string;
256256

257-
abstract public function evalFullTextSearch(string $selectorName, string $searchExpression, string $propertyName = null): string;
257+
abstract public function evalFullTextSearch(string $selectorName, string $searchExpression, ?string $propertyName = null): string;
258258
}

src/PHPCR/Util/QOM/QueryBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public function setColumns(array $columns): static
296296
* Identifies a property in the specified or default selector to include in the tabular view of query results.
297297
* Replaces any previously specified columns to be selected if any.
298298
*/
299-
public function select(string $selectorName, string $propertyName, string $columnName = null): static
299+
public function select(string $selectorName, string $propertyName, ?string $columnName = null): static
300300
{
301301
$this->state = self::STATE_DIRTY;
302302
$this->columns = [$this->qomFactory->column($selectorName, $propertyName, $columnName)];
@@ -307,7 +307,7 @@ public function select(string $selectorName, string $propertyName, string $colum
307307
/**
308308
* Adds a property in the specified or default selector to include in the tabular view of query results.
309309
*/
310-
public function addSelect(string $selectorName, string $propertyName, string $columnName = null): static
310+
public function addSelect(string $selectorName, string $propertyName, ?string $columnName = null): static
311311
{
312312
$this->state = self::STATE_DIRTY;
313313

src/PHPCR/Util/QOM/Sql1Generator.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Sql1Generator extends BaseSqlGenerator
1919
* @param string $nodeTypeName The node type of the selector. If it does not contain starting and ending brackets ([]) they will be added automatically
2020
* @param string|null $selectorName (unused)
2121
*/
22-
public function evalSelector(string $nodeTypeName, string $selectorName = null): string
22+
public function evalSelector(string $nodeTypeName, ?string $selectorName = null): string
2323
{
2424
return $nodeTypeName;
2525
}
@@ -43,7 +43,7 @@ protected function getPathForDescendantQuery(string $path): string
4343
/**
4444
* SameNode ::= 'jcr:path like Path/% and not jcr:path like Path/%/%'.
4545
*/
46-
public function evalChildNode(string $path, string $selectorName = null): string
46+
public function evalChildNode(string $path, ?string $selectorName = null): string
4747
{
4848
$path = $this->getPathForDescendantQuery($path);
4949
$sql1 = "jcr:path LIKE '".$path."'";
@@ -57,7 +57,7 @@ public function evalChildNode(string $path, string $selectorName = null): string
5757
*
5858
* @param string|null $selectorName Unused
5959
*/
60-
public function evalDescendantNode(string $path, string $selectorName = null): string
60+
public function evalDescendantNode(string $path, ?string $selectorName = null): string
6161
{
6262
$path = $this->getPathForDescendantQuery($path);
6363

@@ -84,7 +84,7 @@ public function evalPropertyExistence(?string $selectorName, string $propertyNam
8484
*
8585
* @param string $selectorName unusued
8686
*/
87-
public function evalFullTextSearch(string $selectorName, string $searchExpression, string $propertyName = null): string
87+
public function evalFullTextSearch(string $selectorName, string $searchExpression, ?string $propertyName = null): string
8888
{
8989
$propertyName = $propertyName ?: '*';
9090

@@ -123,7 +123,7 @@ public function evalColumns(iterable $columns): string
123123
*
124124
* @param string|null $selectorName unused in SQL1
125125
*/
126-
public function evalPropertyValue(string $propertyName, string $selectorName = null): string
126+
public function evalPropertyValue(string $propertyName, ?string $selectorName = null): string
127127
{
128128
return $propertyName;
129129
}
@@ -137,7 +137,7 @@ public function evalPropertyValue(string $propertyName, string $selectorName = n
137137
* @param string $selectorName unused in SQL1
138138
* @param string|null $colname unused in SQL1
139139
*/
140-
public function evalColumn(string $selectorName, string $propertyName = null, string $colname = null): string
140+
public function evalColumn(string $selectorName, ?string $propertyName = null, ?string $colname = null): string
141141
{
142142
return $propertyName;
143143
}

src/PHPCR/Util/QOM/Sql2Generator.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Sql2Generator extends BaseSqlGenerator
2424
* @param string|null $selectorName The selector name. If it is different than
2525
* the nodeTypeName, the alias is declared.
2626
*/
27-
public function evalSelector(string $nodeTypeName, string $selectorName = null): string
27+
public function evalSelector(string $nodeTypeName, ?string $selectorName = null): string
2828
{
2929
$sql2 = $this->addBracketsIfNeeded($nodeTypeName);
3030

@@ -83,7 +83,7 @@ public function evalEquiJoinCondition(string $sel1Name, string $prop1Name, strin
8383
* [',' selector2Path] ')'
8484
* selector2Path ::= Path.
8585
*/
86-
public function evalSameNodeJoinCondition(string $sel1Name, string $sel2Name, string $sel2Path = null): string
86+
public function evalSameNodeJoinCondition(string $sel1Name, string $sel2Name, ?string $sel2Path = null): string
8787
{
8888
$sql2 = 'ISSAMENODE('
8989
.$this->addBracketsIfNeeded($sel1Name).', '
@@ -127,7 +127,7 @@ public function evalDescendantNodeJoinCondition(string $descendantSelectorName,
127127
/**
128128
* SameNode ::= 'ISSAMENODE(' [selectorName ','] Path ')'.
129129
*/
130-
public function evalSameNode(string $path, string $selectorName = null): string
130+
public function evalSameNode(string $path, ?string $selectorName = null): string
131131
{
132132
$sql2 = 'ISSAMENODE(';
133133
$sql2 .= null === $selectorName ? $path : $this->addBracketsIfNeeded($selectorName).', '.$path;
@@ -139,7 +139,7 @@ public function evalSameNode(string $path, string $selectorName = null): string
139139
/**
140140
* SameNode ::= 'ISCHILDNODE(' [selectorName ','] Path ')'.
141141
*/
142-
public function evalChildNode(string $path, string $selectorName = null): string
142+
public function evalChildNode(string $path, ?string $selectorName = null): string
143143
{
144144
$sql2 = 'ISCHILDNODE(';
145145
$sql2 .= null === $selectorName ? $path : $this->addBracketsIfNeeded($selectorName).', '.$path;
@@ -151,7 +151,7 @@ public function evalChildNode(string $path, string $selectorName = null): string
151151
/**
152152
* SameNode ::= 'ISDESCENDANTNODE(' [selectorName ','] Path ')'.
153153
*/
154-
public function evalDescendantNode(string $path, string $selectorName = null): string
154+
public function evalDescendantNode(string $path, ?string $selectorName = null): string
155155
{
156156
$sql2 = 'ISDESCENDANTNODE(';
157157
$sql2 .= null === $selectorName ? $path : $this->addBracketsIfNeeded($selectorName).', '.$path;
@@ -179,7 +179,7 @@ public function evalPropertyExistence(?string $selectorName, string $propertyNam
179179
* FullTextSearchExpression ')'
180180
* FullTextSearchExpression ::= BindVariable | ''' FullTextSearchLiteral '''.
181181
*/
182-
public function evalFullTextSearch(string $selectorName, string $searchExpression, string $propertyName = null): string
182+
public function evalFullTextSearch(string $selectorName, string $searchExpression, ?string $propertyName = null): string
183183
{
184184
$propertyName = $propertyName ?: '*';
185185

@@ -201,31 +201,31 @@ public function evalLength(string $propertyValue): string
201201
/**
202202
* NodeName ::= 'NAME(' [selectorName] ')'.
203203
*/
204-
public function evalNodeName(string $selectorValue = null): string
204+
public function evalNodeName(?string $selectorValue = null): string
205205
{
206206
return "NAME($selectorValue)";
207207
}
208208

209209
/**
210210
* NodeLocalName ::= 'LOCALNAME(' [selectorName] ')'.
211211
*/
212-
public function evalNodeLocalName(string $selectorValue = null): string
212+
public function evalNodeLocalName(?string $selectorValue = null): string
213213
{
214214
return "LOCALNAME($selectorValue)";
215215
}
216216

217217
/**
218218
* FullTextSearchScore ::= 'SCORE(' [selectorName] ')'.
219219
*/
220-
public function evalFullTextSearchScore(string $selectorValue = null): string
220+
public function evalFullTextSearchScore(?string $selectorValue = null): string
221221
{
222222
return "SCORE($selectorValue)";
223223
}
224224

225225
/**
226226
* PropertyValue ::= [selectorName'.'] propertyName // If only one selector exists.
227227
*/
228-
public function evalPropertyValue(string $propertyName, string $selectorName = null): string
228+
public function evalPropertyValue(string $propertyName, ?string $selectorName = null): string
229229
{
230230
$sql2 = null !== $selectorName ? $this->addBracketsIfNeeded($selectorName).'.' : '';
231231
if ('*' !== $propertyName && !str_starts_with($propertyName, '[')) {
@@ -267,7 +267,7 @@ public function evalColumns(iterable $columns): string
267267
* propertyName ::= Name
268268
* columnName ::= Name.
269269
*/
270-
public function evalColumn(string $selectorName, string $propertyName = null, string $colname = null): string
270+
public function evalColumn(string $selectorName, ?string $propertyName = null, ?string $colname = null): string
271271
{
272272
$sql2 = '';
273273
if (null !== $selectorName && null === $propertyName && null === $colname) {

src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Sql2ToQomQueryConverter
6161
/**
6262
* @param ValueConverter|null $valueConverter to override default converter
6363
*/
64-
public function __construct(QueryObjectModelFactoryInterface $factory, ValueConverter $valueConverter = null)
64+
public function __construct(QueryObjectModelFactoryInterface $factory, ?ValueConverter $valueConverter = null)
6565
{
6666
$this->factory = $factory;
6767
$this->valueConverter = $valueConverter ?: new ValueConverter();
@@ -313,7 +313,7 @@ protected function parseDescendantNodeJoinCondition(): DescendantNodeJoinConditi
313313
*
314314
* @throws \Exception
315315
*/
316-
protected function parseConstraint(ConstraintInterface $lhs = null, int $minprec = 0): ConstraintInterface|null
316+
protected function parseConstraint(?ConstraintInterface $lhs = null, int $minprec = 0): ?ConstraintInterface
317317
{
318318
if (null === $lhs) {
319319
$lhs = $this->parsePrimaryConstraint();
@@ -924,7 +924,7 @@ protected function updateImplicitSelectorName(string $selectorName): void
924924
* @throws InvalidQueryException if there was no explicit selector and
925925
* there is more than one selector available
926926
*/
927-
protected function ensureSelectorName(?string $parsedName): string|null
927+
protected function ensureSelectorName(?string $parsedName): ?string
928928
{
929929
if (null !== $parsedName) {
930930
if ((is_array($this->implicitSelectorName) && !isset($this->implicitSelectorName[$parsedName]))

src/PHPCR/Util/TreeWalker.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TreeWalker
3939
* @param ItemVisitorInterface $nodeVisitor The visitor for the nodes
4040
* @param ItemVisitorInterface|null $propertyVisitor The visitor for the nodes properties
4141
*/
42-
public function __construct(ItemVisitorInterface $nodeVisitor, ItemVisitorInterface $propertyVisitor = null)
42+
public function __construct(ItemVisitorInterface $nodeVisitor, ?ItemVisitorInterface $propertyVisitor = null)
4343
{
4444
$this->nodeVisitor = $nodeVisitor;
4545
$this->propertyVisitor = $propertyVisitor;

0 commit comments

Comments
 (0)