From 980fa402f3400f73e2eca756fe2e3db53ef2c49f Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 27 Feb 2023 09:52:49 +0100 Subject: [PATCH] Create QueryReflection lazily to prevent eager creation of a database connection (#554) --- src/Rules/DoctrineKeyValueStyleRule.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Rules/DoctrineKeyValueStyleRule.php b/src/Rules/DoctrineKeyValueStyleRule.php index 896399f48..b36234dbe 100644 --- a/src/Rules/DoctrineKeyValueStyleRule.php +++ b/src/Rules/DoctrineKeyValueStyleRule.php @@ -32,11 +32,6 @@ final class DoctrineKeyValueStyleRule implements Rule */ private $classMethods; - /** - * @var QueryReflection - */ - private $queryReflection; - /** * @param list $classMethods */ @@ -55,7 +50,6 @@ public function __construct(array $classMethods) } $this->classMethods[] = [$className, $methodName, $arrayArgPositions]; } - $this->queryReflection = new QueryReflection(); } public function getNodeType(): string @@ -116,7 +110,8 @@ public function processNode(Node $callLike, Scope $scope): array ]; } - $schemaReflection = $this->queryReflection->getSchemaReflection(); + $queryReflection = new QueryReflection(); + $schemaReflection = $queryReflection->getSchemaReflection(); // Table name may be escaped with backticks $argTableName = trim($tableType->getValue(), '`');