Skip to content

Commit 61866ff

Browse files
authored
prevent excessive sql queries in DoctrineKeyValueStyleRule (staabm#557)
1 parent 7524a82 commit 61866ff

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Rules/DoctrineKeyValueStyleRule.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ final class DoctrineKeyValueStyleRule implements Rule
3232
*/
3333
private $classMethods;
3434

35+
/**
36+
* @var QueryReflection
37+
*/
38+
private $queryReflection;
39+
3540
/**
3641
* @param list<string> $classMethods
3742
*/
@@ -110,8 +115,10 @@ public function processNode(Node $callLike, Scope $scope): array
110115
];
111116
}
112117

113-
$queryReflection = new QueryReflection();
114-
$schemaReflection = $queryReflection->getSchemaReflection();
118+
if ($this->queryReflection === null) {
119+
$this->queryReflection = new QueryReflection();
120+
}
121+
$schemaReflection = $this->queryReflection->getSchemaReflection();
115122

116123
// Table name may be escaped with backticks
117124
$argTableName = trim($tableType->getValue(), '`');

0 commit comments

Comments
 (0)