Skip to content

Commit

Permalink
Create QueryReflection lazily to prevent eager creation of a database…
Browse files Browse the repository at this point in the history
… connection (#554)
  • Loading branch information
staabm authored Feb 27, 2023
1 parent b7d0f28 commit 980fa40
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Rules/DoctrineKeyValueStyleRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ final class DoctrineKeyValueStyleRule implements Rule
*/
private $classMethods;

/**
* @var QueryReflection
*/
private $queryReflection;

/**
* @param list<string> $classMethods
*/
Expand All @@ -55,7 +50,6 @@ public function __construct(array $classMethods)
}
$this->classMethods[] = [$className, $methodName, $arrayArgPositions];
}
$this->queryReflection = new QueryReflection();
}

public function getNodeType(): string
Expand Down Expand Up @@ -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(), '`');
Expand Down

0 comments on commit 980fa40

Please sign in to comment.