Skip to content

Commit 980fa40

Browse files
authored
Create QueryReflection lazily to prevent eager creation of a database connection (#554)
1 parent b7d0f28 commit 980fa40

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/Rules/DoctrineKeyValueStyleRule.php

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

35-
/**
36-
* @var QueryReflection
37-
*/
38-
private $queryReflection;
39-
4035
/**
4136
* @param list<string> $classMethods
4237
*/
@@ -55,7 +50,6 @@ public function __construct(array $classMethods)
5550
}
5651
$this->classMethods[] = [$className, $methodName, $arrayArgPositions];
5752
}
58-
$this->queryReflection = new QueryReflection();
5953
}
6054

6155
public function getNodeType(): string
@@ -116,7 +110,8 @@ public function processNode(Node $callLike, Scope $scope): array
116110
];
117111
}
118112

119-
$schemaReflection = $this->queryReflection->getSchemaReflection();
113+
$queryReflection = new QueryReflection();
114+
$schemaReflection = $queryReflection->getSchemaReflection();
120115

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

0 commit comments

Comments
 (0)