6969 */
7070abstract class AbstractCommand implements CommandInterface
7171{
72- /**
73- * @param ConnectionInterface $db The database connection to use.
74- */
75- public function __construct (
76- protected readonly ConnectionInterface $ db ,
77- ) {
78- }
79-
8072 /**
8173 * Command in this query mode returns count of affected rows.
8274 *
@@ -123,15 +115,22 @@ public function __construct(
123115 /**
124116 * @var string|null Name of the table to refresh schema for. Null means not to refresh the schema.
125117 */
126- protected string | null $ refreshTableName = null ;
127- protected Closure | null $ retryHandler = null ;
118+ protected ? string $ refreshTableName = null ;
119+ protected ? Closure $ retryHandler = null ;
128120 protected bool $ dbTypecasting = true ;
129121 protected bool $ phpTypecasting = false ;
130122 /**
131123 * @var string The SQL statement to execute.
132124 */
133125 private string $ sql = '' ;
134126
127+ /**
128+ * @param ConnectionInterface $db The database connection to use.
129+ */
130+ public function __construct (
131+ protected readonly ConnectionInterface $ db ,
132+ ) {}
133+
135134 public function addCheck (string $ table , string $ name , string $ expression ): static
136135 {
137136 $ sql = $ this ->getQueryBuilder ()->addCheck ($ table , $ name , $ expression );
@@ -169,7 +168,7 @@ public function addForeignKey(
169168 string $ referenceTable ,
170169 array |string $ referenceColumns ,
171170 ?string $ delete = null ,
172- ?string $ update = null
171+ ?string $ update = null ,
173172 ): static {
174173 $ sql = $ this ->getQueryBuilder ()->addForeignKey (
175174 $ table ,
@@ -178,7 +177,7 @@ public function addForeignKey(
178177 $ referenceTable ,
179178 $ referenceColumns ,
180179 $ delete ,
181- $ update
180+ $ update,
182181 );
183182 return $ this ->setSql ($ sql )->requireTableSchemaRefresh ($ table );
184183 }
@@ -241,7 +240,7 @@ public function createIndex(
241240 string $ name ,
242241 array |string $ columns ,
243242 ?string $ indexType = null ,
244- ?string $ indexMethod = null
243+ ?string $ indexMethod = null ,
245244 ): static {
246245 $ sql = $ this ->getQueryBuilder ()->createIndex ($ table , $ name , $ columns , $ indexType , $ indexMethod );
247246 return $ this ->setSql ($ sql )->requireTableSchemaRefresh ($ table );
@@ -438,14 +437,14 @@ public function queryColumn(): array
438437 return is_array ($ results ) ? $ results : [];
439438 }
440439
441- public function queryOne (): array | null
440+ public function queryOne (): ? array
442441 {
443442 /** @psalm-var array<string,mixed>|false $results */
444443 $ results = $ this ->queryInternal (self ::QUERY_MODE_ROW );
445444 return is_array ($ results ) ? $ results : null ;
446445 }
447446
448- public function queryScalar (): bool |string |null | int |float
447+ public function queryScalar (): bool |string |int |float | null
449448 {
450449 $ result = $ this ->queryInternal (self ::QUERY_MODE_SCALAR );
451450
@@ -493,7 +492,7 @@ public function setSql(string $sql): static
493492 return $ this ;
494493 }
495494
496- public function setRetryHandler (Closure | null $ handler ): static
495+ public function setRetryHandler (? Closure $ handler ): static
497496 {
498497 $ this ->retryHandler = $ handler ;
499498 return $ this ;
@@ -510,7 +509,7 @@ public function update(
510509 array $ columns ,
511510 array |ExpressionInterface |string $ condition = '' ,
512511 array |ExpressionInterface |string |null $ from = null ,
513- array $ params = []
512+ array $ params = [],
514513 ): static {
515514 $ sql = $ this ->getQueryBuilder ()->update ($ table , $ columns , $ condition , $ from , $ params );
516515 return $ this ->setSql ($ sql )->bindValues ($ params );
@@ -530,7 +529,7 @@ public function upsertReturning(
530529 string $ table ,
531530 array |QueryInterface $ insertColumns ,
532531 array |bool $ updateColumns = true ,
533- array | null $ returnColumns = null ,
532+ ? array $ returnColumns = null ,
534533 ): array {
535534 if ($ returnColumns === []) {
536535 $ this ->upsert ($ table , $ insertColumns , $ updateColumns )->execute ();
0 commit comments