Skip to content

cs fixer for php 8.3 #226

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
Apr 8, 2024
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
6 changes: 3 additions & 3 deletions src/PHPCR/Util/CND/Parser/AbstractParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class AbstractParser
* If the data is not provided (equal to null) then only the token type is checked.
* Return false otherwise.
*/
protected function checkToken(int $type, string $data = null, bool $ignoreCase = false): bool
protected function checkToken(int $type, ?string $data = null, bool $ignoreCase = false): bool
{
if ($this->tokenQueue->isEof()) {
return false;
Expand Down Expand Up @@ -79,7 +79,7 @@ protected function checkTokenIn(int $type, array $data, bool $ignoreCase = false
*
* @throws ParserException
*/
protected function expectToken(int $type, string $data = null): Token
protected function expectToken(int $type, ?string $data = null): Token
{
$token = $this->tokenQueue->peek();

Expand All @@ -99,7 +99,7 @@ protected function expectToken(int $type, string $data = null): Token
* @param int $type The expected token type
* @param string|null $data The expected token data or null
*/
protected function checkAndExpectToken(int $type, string $data = null): false|Token
protected function checkAndExpectToken(int $type, ?string $data = null): false|Token
{
if ($this->checkToken($type, $data)) {
$token = $this->tokenQueue->peek();
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 @@ -54,7 +54,7 @@ public function peek($offset = 0): Token|false
return $this->tokens[key($this->tokens) + $offset];
}

public function get($count = 1): Token|null
public function get($count = 1): ?Token
{
$item = null;
for ($i = 1; $i <= $count; ++$i) {
Expand Down
2 changes: 1 addition & 1 deletion src/PHPCR/Util/NodeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public static function isSystemItem(ItemInterface $item): bool
* $nameHint which does not exist and this implementation performs
* this validation immediately
*/
public static function generateAutoNodeName(array $usedNames, array $namespaces, string $defaultNamespace, string $nameHint = null): string
public static function generateAutoNodeName(array $usedNames, array $namespaces, string $defaultNamespace, ?string $nameHint = null): string
{
$usedNames = array_flip($usedNames);

Expand Down
4 changes: 2 additions & 2 deletions src/PHPCR/Util/QOM/BaseQomToSqlQueryConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected function convertFullTextSearch(QOM\FullTextSearchInterface $constraint
/**
* FullTextSearchExpression ::= BindVariable | ''' FullTextSearchLiteral '''.
*
* @param string|QOM\StaticOperandInterface $expr
* @param string|StaticOperandInterface $expr
*/
protected function convertFullTextSearchExpression($expr): string
{
Expand Down Expand Up @@ -169,7 +169,7 @@ protected function convertFullTextSearchExpression($expr): string
*
* @throws \InvalidArgumentException
*/
protected function convertStaticOperand(QOM\StaticOperandInterface $operand): string
protected function convertStaticOperand(StaticOperandInterface $operand): string
{
if ($operand instanceof QOM\BindVariableValueInterface) {
return $this->convertBindVariable($operand->getBindVariableName());
Expand Down
12 changes: 6 additions & 6 deletions src/PHPCR/Util/QOM/BaseSqlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ abstract public function evalCastLiteral(string $literal, string $type): string;
* @param string|null $selectorName The selector name. If it is different than the nodeTypeName, the alias is
* declared if supported by the SQL dialect.
*/
abstract public function evalSelector(string $nodeTypeName, string $selectorName = null): string;
abstract public function evalSelector(string $nodeTypeName, ?string $selectorName = null): string;

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

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

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

abstract public function evalPropertyValue(string $propertyName, string $selectorName = null);
abstract public function evalPropertyValue(string $propertyName, ?string $selectorName = null);

abstract public function evalChildNode(string $path, string $selectorName = null);
abstract public function evalChildNode(string $path, ?string $selectorName = null);

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

abstract public function evalFullTextSearch(string $selectorName, string $searchExpression, string $propertyName = null): string;
abstract public function evalFullTextSearch(string $selectorName, string $searchExpression, ?string $propertyName = null): string;
}
4 changes: 2 additions & 2 deletions src/PHPCR/Util/QOM/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public function setColumns(array $columns): static
* Identifies a property in the specified or default selector to include in the tabular view of query results.
* Replaces any previously specified columns to be selected if any.
*/
public function select(string $selectorName, string $propertyName, string $columnName = null): static
public function select(string $selectorName, string $propertyName, ?string $columnName = null): static
{
$this->state = self::STATE_DIRTY;
$this->columns = [$this->qomFactory->column($selectorName, $propertyName, $columnName)];
Expand All @@ -307,7 +307,7 @@ public function select(string $selectorName, string $propertyName, string $colum
/**
* Adds a property in the specified or default selector to include in the tabular view of query results.
*/
public function addSelect(string $selectorName, string $propertyName, string $columnName = null): static
public function addSelect(string $selectorName, string $propertyName, ?string $columnName = null): static
{
$this->state = self::STATE_DIRTY;

Expand Down
12 changes: 6 additions & 6 deletions src/PHPCR/Util/QOM/Sql1Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Sql1Generator extends BaseSqlGenerator
* @param string $nodeTypeName The node type of the selector. If it does not contain starting and ending brackets ([]) they will be added automatically
* @param string|null $selectorName (unused)
*/
public function evalSelector(string $nodeTypeName, string $selectorName = null): string
public function evalSelector(string $nodeTypeName, ?string $selectorName = null): string
{
return $nodeTypeName;
}
Expand All @@ -43,7 +43,7 @@ protected function getPathForDescendantQuery(string $path): string
/**
* SameNode ::= 'jcr:path like Path/% and not jcr:path like Path/%/%'.
*/
public function evalChildNode(string $path, string $selectorName = null): string
public function evalChildNode(string $path, ?string $selectorName = null): string
{
$path = $this->getPathForDescendantQuery($path);
$sql1 = "jcr:path LIKE '".$path."'";
Expand All @@ -57,7 +57,7 @@ public function evalChildNode(string $path, string $selectorName = null): string
*
* @param string|null $selectorName Unused
*/
public function evalDescendantNode(string $path, string $selectorName = null): string
public function evalDescendantNode(string $path, ?string $selectorName = null): string
{
$path = $this->getPathForDescendantQuery($path);

Expand All @@ -84,7 +84,7 @@ public function evalPropertyExistence(?string $selectorName, string $propertyNam
*
* @param string $selectorName unusued
*/
public function evalFullTextSearch(string $selectorName, string $searchExpression, string $propertyName = null): string
public function evalFullTextSearch(string $selectorName, string $searchExpression, ?string $propertyName = null): string
{
$propertyName = $propertyName ?: '*';

Expand Down Expand Up @@ -123,7 +123,7 @@ public function evalColumns(iterable $columns): string
*
* @param string|null $selectorName unused in SQL1
*/
public function evalPropertyValue(string $propertyName, string $selectorName = null): string
public function evalPropertyValue(string $propertyName, ?string $selectorName = null): string
{
return $propertyName;
}
Expand All @@ -137,7 +137,7 @@ public function evalPropertyValue(string $propertyName, string $selectorName = n
* @param string $selectorName unused in SQL1
* @param string|null $colname unused in SQL1
*/
public function evalColumn(string $selectorName, string $propertyName = null, string $colname = null): string
public function evalColumn(string $selectorName, ?string $propertyName = null, ?string $colname = null): string
{
return $propertyName;
}
Expand Down
22 changes: 11 additions & 11 deletions src/PHPCR/Util/QOM/Sql2Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Sql2Generator extends BaseSqlGenerator
* @param string|null $selectorName The selector name. If it is different than
* the nodeTypeName, the alias is declared.
*/
public function evalSelector(string $nodeTypeName, string $selectorName = null): string
public function evalSelector(string $nodeTypeName, ?string $selectorName = null): string
{
$sql2 = $this->addBracketsIfNeeded($nodeTypeName);

Expand Down Expand Up @@ -83,7 +83,7 @@ public function evalEquiJoinCondition(string $sel1Name, string $prop1Name, strin
* [',' selector2Path] ')'
* selector2Path ::= Path.
*/
public function evalSameNodeJoinCondition(string $sel1Name, string $sel2Name, string $sel2Path = null): string
public function evalSameNodeJoinCondition(string $sel1Name, string $sel2Name, ?string $sel2Path = null): string
{
$sql2 = 'ISSAMENODE('
.$this->addBracketsIfNeeded($sel1Name).', '
Expand Down Expand Up @@ -127,7 +127,7 @@ public function evalDescendantNodeJoinCondition(string $descendantSelectorName,
/**
* SameNode ::= 'ISSAMENODE(' [selectorName ','] Path ')'.
*/
public function evalSameNode(string $path, string $selectorName = null): string
public function evalSameNode(string $path, ?string $selectorName = null): string
{
$sql2 = 'ISSAMENODE(';
$sql2 .= null === $selectorName ? $path : $this->addBracketsIfNeeded($selectorName).', '.$path;
Expand All @@ -139,7 +139,7 @@ public function evalSameNode(string $path, string $selectorName = null): string
/**
* SameNode ::= 'ISCHILDNODE(' [selectorName ','] Path ')'.
*/
public function evalChildNode(string $path, string $selectorName = null): string
public function evalChildNode(string $path, ?string $selectorName = null): string
{
$sql2 = 'ISCHILDNODE(';
$sql2 .= null === $selectorName ? $path : $this->addBracketsIfNeeded($selectorName).', '.$path;
Expand All @@ -151,7 +151,7 @@ public function evalChildNode(string $path, string $selectorName = null): string
/**
* SameNode ::= 'ISDESCENDANTNODE(' [selectorName ','] Path ')'.
*/
public function evalDescendantNode(string $path, string $selectorName = null): string
public function evalDescendantNode(string $path, ?string $selectorName = null): string
{
$sql2 = 'ISDESCENDANTNODE(';
$sql2 .= null === $selectorName ? $path : $this->addBracketsIfNeeded($selectorName).', '.$path;
Expand Down Expand Up @@ -179,7 +179,7 @@ public function evalPropertyExistence(?string $selectorName, string $propertyNam
* FullTextSearchExpression ')'
* FullTextSearchExpression ::= BindVariable | ''' FullTextSearchLiteral '''.
*/
public function evalFullTextSearch(string $selectorName, string $searchExpression, string $propertyName = null): string
public function evalFullTextSearch(string $selectorName, string $searchExpression, ?string $propertyName = null): string
{
$propertyName = $propertyName ?: '*';

Expand All @@ -201,31 +201,31 @@ public function evalLength(string $propertyValue): string
/**
* NodeName ::= 'NAME(' [selectorName] ')'.
*/
public function evalNodeName(string $selectorValue = null): string
public function evalNodeName(?string $selectorValue = null): string
{
return "NAME($selectorValue)";
}

/**
* NodeLocalName ::= 'LOCALNAME(' [selectorName] ')'.
*/
public function evalNodeLocalName(string $selectorValue = null): string
public function evalNodeLocalName(?string $selectorValue = null): string
{
return "LOCALNAME($selectorValue)";
}

/**
* FullTextSearchScore ::= 'SCORE(' [selectorName] ')'.
*/
public function evalFullTextSearchScore(string $selectorValue = null): string
public function evalFullTextSearchScore(?string $selectorValue = null): string
{
return "SCORE($selectorValue)";
}

/**
* PropertyValue ::= [selectorName'.'] propertyName // If only one selector exists.
*/
public function evalPropertyValue(string $propertyName, string $selectorName = null): string
public function evalPropertyValue(string $propertyName, ?string $selectorName = null): string
{
$sql2 = null !== $selectorName ? $this->addBracketsIfNeeded($selectorName).'.' : '';
if ('*' !== $propertyName && !str_starts_with($propertyName, '[')) {
Expand Down Expand Up @@ -267,7 +267,7 @@ public function evalColumns(iterable $columns): string
* propertyName ::= Name
* columnName ::= Name.
*/
public function evalColumn(string $selectorName, string $propertyName = null, string $colname = null): string
public function evalColumn(string $selectorName, ?string $propertyName = null, ?string $colname = null): string
{
$sql2 = '';
if (null !== $selectorName && null === $propertyName && null === $colname) {
Expand Down
6 changes: 3 additions & 3 deletions src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Sql2ToQomQueryConverter
/**
* @param ValueConverter|null $valueConverter to override default converter
*/
public function __construct(QueryObjectModelFactoryInterface $factory, ValueConverter $valueConverter = null)
public function __construct(QueryObjectModelFactoryInterface $factory, ?ValueConverter $valueConverter = null)
{
$this->factory = $factory;
$this->valueConverter = $valueConverter ?: new ValueConverter();
Expand Down Expand Up @@ -313,7 +313,7 @@ protected function parseDescendantNodeJoinCondition(): DescendantNodeJoinConditi
*
* @throws \Exception
*/
protected function parseConstraint(ConstraintInterface $lhs = null, int $minprec = 0): ConstraintInterface|null
protected function parseConstraint(?ConstraintInterface $lhs = null, int $minprec = 0): ?ConstraintInterface
{
if (null === $lhs) {
$lhs = $this->parsePrimaryConstraint();
Expand Down Expand Up @@ -924,7 +924,7 @@ protected function updateImplicitSelectorName(string $selectorName): void
* @throws InvalidQueryException if there was no explicit selector and
* there is more than one selector available
*/
protected function ensureSelectorName(?string $parsedName): string|null
protected function ensureSelectorName(?string $parsedName): ?string
{
if (null !== $parsedName) {
if ((is_array($this->implicitSelectorName) && !isset($this->implicitSelectorName[$parsedName]))
Expand Down
2 changes: 1 addition & 1 deletion src/PHPCR/Util/TreeWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class TreeWalker
* @param ItemVisitorInterface $nodeVisitor The visitor for the nodes
* @param ItemVisitorInterface|null $propertyVisitor The visitor for the nodes properties
*/
public function __construct(ItemVisitorInterface $nodeVisitor, ItemVisitorInterface $propertyVisitor = null)
public function __construct(ItemVisitorInterface $nodeVisitor, ?ItemVisitorInterface $propertyVisitor = null)
{
$this->nodeVisitor = $nodeVisitor;
$this->propertyVisitor = $propertyVisitor;
Expand Down
Loading