Skip to content

Commit a08dfdb

Browse files
authored
Migrate from slevomat/coding-standard to shipmonk/coding-standard (#61)
1 parent 4b4f46b commit a08dfdb

File tree

7 files changed

+30
-403
lines changed

7 files changed

+30
-403
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"phpstan/phpstan-phpunit": "2.0.0",
1818
"phpstan/phpstan-strict-rules": "2.0.0",
1919
"phpunit/phpunit": "10.5.36",
20+
"shipmonk/coding-standard": "^0.2.0",
2021
"shipmonk/composer-dependency-analyser": "1.7.0",
2122
"shipmonk/phpstan-rules": "4.0.0",
22-
"slevomat/coding-standard": "8.15.0",
2323
"symfony/cache": "^6.4.13 || ^7.0 || ^8.0",
2424
"symfony/cache-contracts": "^3.5.0 || ^4.0"
2525
},

phpcs.xml.dist

Lines changed: 3 additions & 395 deletions
Large diffs are not rendered by default.

src/HintDrivenSqlWalker.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ public function walkEntityIdentificationVariable(string $identVariable): string
119119
return $this->callWalkers(SqlNode::EntityIdentificationVariable, parent::walkEntityIdentificationVariable($identVariable));
120120
}
121121

122-
public function walkIdentificationVariable(string $identificationVariable, string|null $fieldName = null): string
122+
public function walkIdentificationVariable(
123+
string $identificationVariable,
124+
?string $fieldName = null,
125+
): string
123126
{
124127
return $this->callWalkers(SqlNode::IdentificationVariable, parent::walkIdentificationVariable($identificationVariable, $fieldName));
125128
}
@@ -233,7 +236,10 @@ public function walkParenthesisExpression(ParenthesisExpression $parenthesisExpr
233236
return $this->callWalkers(SqlNode::ParenthesisExpression, parent::walkParenthesisExpression($parenthesisExpression));
234237
}
235238

236-
public function walkNewObject(NewObjectExpression $newObjectExpression, string|null $newObjectResultAlias = null): string
239+
public function walkNewObject(
240+
NewObjectExpression $newObjectExpression,
241+
?string $newObjectResultAlias = null,
242+
): string
237243
{
238244
return $this->callWalkers(SqlNode::NewObject, parent::walkNewObject($newObjectExpression, $newObjectResultAlias));
239245
}
@@ -273,7 +279,7 @@ public function walkUpdateItem(UpdateItem $updateItem): string
273279
return $this->callWalkers(SqlNode::UpdateItem, parent::walkUpdateItem($updateItem));
274280
}
275281

276-
public function walkWhereClause(WhereClause|null $whereClause): string
282+
public function walkWhereClause(?WhereClause $whereClause): string
277283
{
278284
return $this->callWalkers(SqlNode::WhereClause, parent::walkWhereClause($whereClause));
279285
}
@@ -403,7 +409,10 @@ public function walkResultVariable(string $resultVariable): string
403409
return $this->callWalkers(SqlNode::ResultVariable, parent::walkResultVariable($resultVariable));
404410
}
405411

406-
private function callWalkers(SqlNode $sqlNode, string $sql): string
412+
private function callWalkers(
413+
SqlNode $sqlNode,
414+
string $sql,
415+
): string
407416
{
408417
foreach ($this->stringSqlWalkers[$sqlNode->value] ?? [] as $stringSqlWalker) {
409418
$sql = $stringSqlWalker->processNode($sqlNode, $sql);

src/HintHandler.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ protected function getHintValue(): mixed
2929
*/
3030
abstract public function getNodes(): array;
3131

32-
abstract public function processNode(SqlNode $sqlNode, string $sql): string;
32+
abstract public function processNode(
33+
SqlNode $sqlNode,
34+
string $sql,
35+
): string;
3336

3437
}

tests/Handlers/CommentWholeSqlHintHandler.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ public function getNodes(): array
1616
return [SqlNode::SelectStatement, SqlNode::UpdateStatement, SqlNode::DeleteStatement];
1717
}
1818

19-
public function processNode(SqlNode $sqlNode, string $sql): string
19+
public function processNode(
20+
SqlNode $sqlNode,
21+
string $sql,
22+
): string
2023
{
2124
$hintValue = $this->getHintValue();
2225

tests/Handlers/LowercaseSelectHintHandler.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ public function getNodes(): array
1515
return [SqlNode::SelectClause];
1616
}
1717

18-
public function processNode(SqlNode $sqlNode, string $sql): string
18+
public function processNode(
19+
SqlNode $sqlNode,
20+
string $sql,
21+
): string
1922
{
2023
$result = preg_replace('~^SELECT~', 'select', $sql);
2124

tests/HintDrivenSqlWalkerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class HintDrivenSqlWalkerTest extends TestCase
2323

2424
/**
2525
* @param callable(EntityManager):Query $queryCallback
26+
*
2627
* @dataProvider walksProvider
2728
*/
2829
public function testWalker(

0 commit comments

Comments
 (0)