We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38b783b commit 53a0623Copy full SHA for 53a0623
tests/Handlers/CommentWholeSqlHintHandler.php
@@ -5,6 +5,7 @@
5
use LogicException;
6
use ShipMonk\Doctrine\Walker\HintHandler;
7
use ShipMonk\Doctrine\Walker\SqlNode;
8
+use function is_string;
9
use function preg_replace;
10
11
class CommentWholeSqlHintHandler extends HintHandler
@@ -17,7 +18,13 @@ public function getNodes(): array
17
18
19
public function processNode(SqlNode $sqlNode, string $sql): string
20
{
- $result = preg_replace('~$~', ' -- ' . $this->getHintValue(), $sql);
21
+ $hintValue = $this->getHintValue();
22
+
23
+ if (!is_string($hintValue)) {
24
+ throw new LogicException('Hint value must be a string');
25
+ }
26
27
+ $result = preg_replace('~$~', ' -- ' . $hintValue, $sql);
28
29
if ($result === null) {
30
throw new LogicException('Regex failure');
0 commit comments