From 7727816b455bc5a2d0f3a21061c99f087299b16e Mon Sep 17 00:00:00 2001 From: David Rans Date: Tue, 20 Aug 2024 12:41:28 -0700 Subject: [PATCH] Style autofix --- QueryGenerator.php | 16 +++++++++------- QueryGeneratorTest.php | 8 ++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/QueryGenerator.php b/QueryGenerator.php index a7df235..286013f 100644 --- a/QueryGenerator.php +++ b/QueryGenerator.php @@ -232,7 +232,7 @@ class QueryGenerator { 'STRAIGHT_JOIN', 'SQL_SMALL_RESULT', 'SQL_BIG_RESULT', 'SQL_BUFFER_RESULT', 'SQL_CACHE', 'SQL_NO_CACHE', - 'SQL_CALC_FOUND_ROWS' + 'SQL_CALC_FOUND_ROWS', ], 'insert' => ['LOW_PRIORITY', 'DELAYED', 'HIGH_PRIORITY', 'IGNORE'], 'replace' => ['LOW_PRIORITY', 'DELAYED'], @@ -285,8 +285,9 @@ public function __call(string $method, array $args) { throw new Exception("Method \"$method\" does not exist."); } - $requiresArgument = (isset(self::$methods[$method]['requiresArgument']) ? - self::$methods[$method]['requiresArgument'] : false); + $requiresArgument = (isset(self::$methods[$method]['requiresArgument']) + ? self::$methods[$method]['requiresArgument'] + : false); if ($requiresArgument && count($args) < 1) { throw new Exception("Missing argument 1 (\$clauses) for $method()"); @@ -294,12 +295,12 @@ public function __call(string $method, array $args) { $clauses = reset($args); $params = []; } else { - list($clauses, $params) = $args; + [$clauses, $params] = $args; } - if ($clauses instanceOf QueryGenerator) { + if ($clauses instanceof self) { $clauses->skipValidation(); - list($clauses, $params) = $clauses->build(/* $skipClauses = */ true); + [$clauses, $params] = $clauses->build(/* $skipClauses = */ true); } if (!is_array($clauses)) { @@ -391,7 +392,8 @@ private function assertCompleteQuery(): void { if (!$primaryMethod) { $primaryClauseStr = implode("', '", $this->getPrimaryClauses()); throw new MissingPrimaryClauseException( - "Missing primary clause. One of '$primaryClauseStr' needed."); + "Missing primary clause. One of '$primaryClauseStr' needed." + ); } $minimumClauses = self::$minimumClauses[$primaryMethod]; diff --git a/QueryGeneratorTest.php b/QueryGeneratorTest.php index c3b8b3c..b19850c 100644 --- a/QueryGeneratorTest.php +++ b/QueryGeneratorTest.php @@ -1,6 +1,6 @@ from(['table1', 'table2']); $qGen->join([ 'INNER JOIN table3 USING (asdf)', - 'OUTER JOIN table4 ON foo = bar' + 'OUTER JOIN table4 ON foo = bar', ]); $qGen->where(['where1', 'where2 OR where3']); $qGen->group(['group1', 'group2']); @@ -242,11 +242,11 @@ public function testOnDuplicate(): void { } public function assertQuery(QueryGenerator $qGen, string $expectedQuery, array $expectedParams): void { - list($actualQuery, $actualParams) = $qGen->build(); + [$actualQuery, $actualParams] = $qGen->build(); $this->assertEquals($expectedQuery, $actualQuery); $this->assertEquals($expectedParams, $actualParams); - list($actualQuery, $actualParams) = $qGen->skipValidation()->build(); + [$actualQuery, $actualParams] = $qGen->skipValidation()->build(); $this->assertEquals($expectedQuery, $actualQuery); $this->assertEquals($expectedParams, $actualParams); }