Skip to content

Commit 53a0623

Browse files
authored
tests: strict string concat (#38)
1 parent 38b783b commit 53a0623

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/Handlers/CommentWholeSqlHintHandler.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use LogicException;
66
use ShipMonk\Doctrine\Walker\HintHandler;
77
use ShipMonk\Doctrine\Walker\SqlNode;
8+
use function is_string;
89
use function preg_replace;
910

1011
class CommentWholeSqlHintHandler extends HintHandler
@@ -17,7 +18,13 @@ public function getNodes(): array
1718

1819
public function processNode(SqlNode $sqlNode, string $sql): string
1920
{
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);
2128

2229
if ($result === null) {
2330
throw new LogicException('Regex failure');

0 commit comments

Comments
 (0)