diff --git a/composer.json b/composer.json index 63c390d..3153515 100644 --- a/composer.json +++ b/composer.json @@ -17,9 +17,9 @@ "phpstan/phpstan-phpunit": "2.0.0", "phpstan/phpstan-strict-rules": "2.0.0", "phpunit/phpunit": "10.5.36", + "shipmonk/coding-standard": "^0.2.0", "shipmonk/composer-dependency-analyser": "1.7.0", "shipmonk/phpstan-rules": "4.0.0", - "slevomat/coding-standard": "8.15.0", "symfony/cache": "^6.4.13 || ^7.0 || ^8.0", "symfony/cache-contracts": "^3.5.0 || ^4.0" }, diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 7165d19..aa0ae6f 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -2,409 +2,17 @@ - - - - - - - - src/ tests/ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Exception type missing for @throws annotation - - - Only 1 @return annotation is allowed in a function comment - - - Extra @param annotation - - - @param annotation for parameter "%s" missing - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/src/HintDrivenSqlWalker.php b/src/HintDrivenSqlWalker.php index 0759bc8..8b575f7 100644 --- a/src/HintDrivenSqlWalker.php +++ b/src/HintDrivenSqlWalker.php @@ -119,7 +119,10 @@ public function walkEntityIdentificationVariable(string $identVariable): string return $this->callWalkers(SqlNode::EntityIdentificationVariable, parent::walkEntityIdentificationVariable($identVariable)); } - public function walkIdentificationVariable(string $identificationVariable, string|null $fieldName = null): string + public function walkIdentificationVariable( + string $identificationVariable, + ?string $fieldName = null, + ): string { return $this->callWalkers(SqlNode::IdentificationVariable, parent::walkIdentificationVariable($identificationVariable, $fieldName)); } @@ -233,7 +236,10 @@ public function walkParenthesisExpression(ParenthesisExpression $parenthesisExpr return $this->callWalkers(SqlNode::ParenthesisExpression, parent::walkParenthesisExpression($parenthesisExpression)); } - public function walkNewObject(NewObjectExpression $newObjectExpression, string|null $newObjectResultAlias = null): string + public function walkNewObject( + NewObjectExpression $newObjectExpression, + ?string $newObjectResultAlias = null, + ): string { return $this->callWalkers(SqlNode::NewObject, parent::walkNewObject($newObjectExpression, $newObjectResultAlias)); } @@ -273,7 +279,7 @@ public function walkUpdateItem(UpdateItem $updateItem): string return $this->callWalkers(SqlNode::UpdateItem, parent::walkUpdateItem($updateItem)); } - public function walkWhereClause(WhereClause|null $whereClause): string + public function walkWhereClause(?WhereClause $whereClause): string { return $this->callWalkers(SqlNode::WhereClause, parent::walkWhereClause($whereClause)); } @@ -403,7 +409,10 @@ public function walkResultVariable(string $resultVariable): string return $this->callWalkers(SqlNode::ResultVariable, parent::walkResultVariable($resultVariable)); } - private function callWalkers(SqlNode $sqlNode, string $sql): string + private function callWalkers( + SqlNode $sqlNode, + string $sql, + ): string { foreach ($this->stringSqlWalkers[$sqlNode->value] ?? [] as $stringSqlWalker) { $sql = $stringSqlWalker->processNode($sqlNode, $sql); diff --git a/src/HintHandler.php b/src/HintHandler.php index 05503ff..c76f16b 100644 --- a/src/HintHandler.php +++ b/src/HintHandler.php @@ -29,6 +29,9 @@ protected function getHintValue(): mixed */ abstract public function getNodes(): array; - abstract public function processNode(SqlNode $sqlNode, string $sql): string; + abstract public function processNode( + SqlNode $sqlNode, + string $sql, + ): string; } diff --git a/tests/Handlers/CommentWholeSqlHintHandler.php b/tests/Handlers/CommentWholeSqlHintHandler.php index 9e34ac4..a7588cd 100644 --- a/tests/Handlers/CommentWholeSqlHintHandler.php +++ b/tests/Handlers/CommentWholeSqlHintHandler.php @@ -16,7 +16,10 @@ public function getNodes(): array return [SqlNode::SelectStatement, SqlNode::UpdateStatement, SqlNode::DeleteStatement]; } - public function processNode(SqlNode $sqlNode, string $sql): string + public function processNode( + SqlNode $sqlNode, + string $sql, + ): string { $hintValue = $this->getHintValue(); diff --git a/tests/Handlers/LowercaseSelectHintHandler.php b/tests/Handlers/LowercaseSelectHintHandler.php index 7301956..4743992 100644 --- a/tests/Handlers/LowercaseSelectHintHandler.php +++ b/tests/Handlers/LowercaseSelectHintHandler.php @@ -15,7 +15,10 @@ public function getNodes(): array return [SqlNode::SelectClause]; } - public function processNode(SqlNode $sqlNode, string $sql): string + public function processNode( + SqlNode $sqlNode, + string $sql, + ): string { $result = preg_replace('~^SELECT~', 'select', $sql); diff --git a/tests/HintDrivenSqlWalkerTest.php b/tests/HintDrivenSqlWalkerTest.php index 08b91cc..33d37f9 100644 --- a/tests/HintDrivenSqlWalkerTest.php +++ b/tests/HintDrivenSqlWalkerTest.php @@ -23,6 +23,7 @@ class HintDrivenSqlWalkerTest extends TestCase /** * @param callable(EntityManager):Query $queryCallback + * * @dataProvider walksProvider */ public function testWalker(