@@ -38,7 +38,7 @@ class QueryBuilderHandler implements IQueryBuilderHandler
3838 */
3939 public const UNION_TYPE_ALL = 'ALL ' ;
4040 /**
41- * @var Connection
41+ * @var Connection|null
4242 */
4343 protected $ connection ;
4444
@@ -84,7 +84,7 @@ class QueryBuilderHandler implements IQueryBuilderHandler
8484 *
8585 * @throws Exception
8686 */
87- public function __construct (Connection $ connection = null )
87+ final public function __construct (Connection $ connection = null )
8888 {
8989 $ this ->connection = $ connection ?? Connection::getStoredConnection ();
9090
@@ -241,7 +241,7 @@ public function first()
241241 {
242242 $ result = $ this ->limit (1 )->get ();
243243
244- return ($ result !== null && \count ($ result ) !== 0 ) ? $ result [0 ] : null ;
244+ return (\count ($ result ) !== 0 ) ? $ result [0 ] : null ;
245245 }
246246
247247 /**
@@ -260,19 +260,12 @@ public function first()
260260 */
261261 public function get (): array
262262 {
263- /**
264- * @var $queryObject QueryObject
265- * @var $executionTime float
266- * @var $start float
267- * @var $result array
268- */
269-
270263 $ queryObject = $ this ->getQuery ();
271264 $ this ->connection ->setLastQuery ($ queryObject );
272265
273266 $ this ->fireEvents (EventHandler::EVENT_BEFORE_SELECT , $ queryObject );
274267
275- $ executionTime = 0 ;
268+ $ executionTime = 0.0 ;
276269 $ startTime = microtime (true );
277270
278271 if ($ this ->pdoStatement === null ) {
@@ -548,7 +541,7 @@ public function addTablePrefix($values, bool $tableFieldMix = true)
548541 $ target = &$ key ;
549542 }
550543
551- if ($ tableFieldMix === false || ($ tableFieldMix && strpos ($ target , '. ' ) !== false )) {
544+ if (( $ tableFieldMix === false ) || (strpos ($ target , '. ' ) !== false )) {
552545 $ target = $ this ->tablePrefix . $ target ;
553546 }
554547
@@ -631,7 +624,7 @@ public function from($tables = null): self
631624
632625 $ tTables = [];
633626
634- foreach (( array ) $ tables as $ key => $ value ) {
627+ foreach ($ tables as $ key => $ value ) {
635628 if (\is_string ($ key ) === true ) {
636629 $ this ->alias ($ value , $ key );
637630 $ tTables [] = $ key ;
@@ -890,7 +883,7 @@ public function where($key, $operator = null, $value = null): self
890883 *
891884 * @param string|Raw|\Closure $key
892885 * @param string|null $operator
893- * @param string|Raw|\Closure|null $value
886+ * @param string|array| Raw|\Closure|null $value
894887 * @param string $joiner
895888 *
896889 * @return static
@@ -1017,7 +1010,7 @@ public function join($table, $key = null, $operator = null, $value = null, $type
10171010 * in the closure should reflect here
10181011 */
10191012 if ($ key instanceof \Closure === false ) {
1020- $ key = static function (JoinBuilder $ joinBuilder ) use ($ key , $ operator , $ value ) {
1013+ $ key = static function (JoinBuilder $ joinBuilder ) use ($ key , $ operator , $ value ): void {
10211014 $ joinBuilder ->on ($ key , $ operator , $ value );
10221015 };
10231016 }
@@ -1086,10 +1079,9 @@ private function doInsert(array $data, string $type)
10861079 $ this ->connection ->setLastQuery ($ queryObject );
10871080
10881081 $ this ->fireEvents (EventHandler::EVENT_BEFORE_INSERT , $ queryObject );
1089- /**
1090- * @var $result \PDOStatement
1091- * @var $executionTime float
1092- */
1082+
1083+ /** @var float $executionTime */
1084+ /** @var \PDOStatement $result */
10931085 [$ result , $ executionTime ] = $ this ->statement ($ queryObject ->getSql (), $ queryObject ->getBindings ());
10941086
10951087 $ insertId = $ result ->rowCount () === 1 ? $ this ->pdo ()->lastInsertId () : null ;
@@ -1107,7 +1099,7 @@ private function doInsert(array $data, string $type)
11071099
11081100 if ($ this ->pdo ()->inTransaction () === false ) {
11091101
1110- $ this ->transaction (function (Transaction $ transaction ) use (&$ insertIds , $ data , $ type ) {
1102+ $ this ->transaction (function (Transaction $ transaction ) use (&$ insertIds , $ data , $ type ): void {
11111103 foreach ($ data as $ subData ) {
11121104 $ insertIds [] = $ transaction ->doInsert ($ subData , $ type );
11131105 }
@@ -1405,7 +1397,7 @@ public function orderBy($fields, string $direction = 'ASC'): self
14051397 $ fields = [$ fields ];
14061398 }
14071399
1408- foreach (( array ) $ fields as $ key => $ value ) {
1400+ foreach ($ fields as $ key => $ value ) {
14091401 $ field = $ key ;
14101402 $ type = $ value ;
14111403
@@ -1632,15 +1624,13 @@ public function updateOrInsert(array $data)
16321624 */
16331625 public function update (array $ data ): \PDOStatement
16341626 {
1635- /**
1636- * @var $response \PDOStatement
1637- */
16381627 $ queryObject = $ this ->getQuery ('update ' , $ data );
16391628
16401629 $ this ->connection ->setLastQuery ($ queryObject );
16411630
16421631 $ this ->fireEvents (EventHandler::EVENT_BEFORE_UPDATE , $ queryObject );
16431632
1633+ /** @var \PDOStatement $response */
16441634 [$ response , $ executionTime ] = $ this ->statement ($ queryObject ->getSql (), $ queryObject ->getBindings ());
16451635
16461636 $ this ->fireEvents (EventHandler::EVENT_AFTER_UPDATE , $ queryObject , [
@@ -1757,7 +1747,7 @@ public function whereNull($key): self
17571747
17581748 /**
17591749 * Will add FOR statement to the end of the SELECT statement, like FOR UPDATE, FOR SHARE etc.
1760- * @param $statement string
1750+ * @param string $statement
17611751 * @return static
17621752 */
17631753 public function for (string $ statement ): self
0 commit comments