@@ -70,7 +70,7 @@ class QueryBuilderHandler implements IQueryBuilderHandler
7070 *
7171 * @var array
7272 */
73- protected $ fetchParameters = [\ PDO ::FETCH_OBJ ];
73+ protected $ fetchParameters = [PDO ::FETCH_OBJ ];
7474
7575 /**
7676 * If true calling from, select etc. will overwrite any existing values from previous calls in query.
@@ -80,9 +80,9 @@ class QueryBuilderHandler implements IQueryBuilderHandler
8080 protected $ overwriteEnabled = false ;
8181
8282 /**
83- * @param \Pecee\Pixie\ Connection|null $connection
83+ * @param Connection|null $connection
8484 *
85- * @throws \Pecee\Pixie\ Exception
85+ * @throws Exception
8686 */
8787 public function __construct (Connection $ connection = null )
8888 {
@@ -228,7 +228,7 @@ public function first()
228228 public function get (): array
229229 {
230230 /**
231- * @var $queryObject \Pecee\Pixie\QueryBuilder\ QueryObject
231+ * @var $queryObject QueryObject
232232 * @var $executionTime float
233233 * @var $start float
234234 * @var $result array
@@ -340,7 +340,7 @@ public function fireEvents(string $name, QueryObject $queryObject, array $eventA
340340 * @throws \Pecee\Pixie\Exceptions\TableNotFoundException
341341 * @throws \Pecee\Pixie\Exceptions\ConnectionException
342342 * @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
343- * @throws \Pecee\Pixie\ Exception
343+ * @throws Exception
344344 * @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
345345 * @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
346346 * @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
@@ -453,7 +453,7 @@ public function fetchNext(int $fetchNext): IQueryBuilderHandler
453453 *
454454 * Example: ['field' => 'alias'] will become `field` AS `alias`
455455 *
456- * @param string|array $fields,...
456+ * @param string|array|Raw $fields,...
457457 *
458458 * @return static
459459 */
@@ -661,7 +661,7 @@ public function subQuery(QueryBuilderHandler $queryBuilder, $alias = null): Raw
661661 {
662662 $ sql = '( ' . $ queryBuilder ->getQuery ()->getRawSql () . ') ' ;
663663 if ($ alias !== null ) {
664- $ sql = $ sql . ' AS ' . $ this ->adapterInstance ->wrapSanitizer ($ alias );
664+ $ sql .= ' AS ' . $ this ->adapterInstance ->wrapSanitizer ($ alias );
665665 }
666666
667667 return $ queryBuilder ->raw ($ sql );
@@ -927,7 +927,7 @@ public function join($table, $key = null, $operator = null, $value = null, $type
927927 * in the closure should reflect here
928928 */
929929 if ($ key instanceof \Closure === false ) {
930- $ key = function (JoinBuilder $ joinBuilder ) use ($ key , $ operator , $ value ) {
930+ $ key = static function (JoinBuilder $ joinBuilder ) use ($ key , $ operator , $ value ) {
931931 $ joinBuilder ->on ($ key , $ operator , $ value );
932932 };
933933 }
@@ -1028,12 +1028,6 @@ private function doInsert(array $data, string $type)
10281028 */
10291029 public function transaction (\Closure $ callback ): Transaction
10301030 {
1031- /**
1032- * Get the Transaction class
1033- *
1034- * @var \Pecee\Pixie\QueryBuilder\Transaction $queryTransaction
1035- * @throws \Exception
1036- */
10371031 $ queryTransaction = new Transaction ($ this ->connection );
10381032 $ queryTransaction ->statements = $ this ->statements ;
10391033
@@ -1074,7 +1068,7 @@ public function transaction(\Closure $callback): Transaction
10741068 * @return static
10751069 * @throws Exception
10761070 */
1077- public function joinUsing ($ table , $ fields , $ joinType = '' )
1071+ public function joinUsing ($ table , $ fields , $ joinType = '' ): IQueryBuilderHandler
10781072 {
10791073 if (\is_array ($ fields ) === false ) {
10801074 $ fields = [$ fields ];
@@ -1414,7 +1408,7 @@ public function rightJoin($table, $key, ?string $operator = null, $value = null)
14141408 *
14151409 * @return static
14161410 */
1417- public function selectDistinct ($ fields )
1411+ public function selectDistinct ($ fields ): IQueryBuilderHandler
14181412 {
14191413 if ($ this ->overwriteEnabled === true ) {
14201414 $ this ->statements ['distincts ' ] = $ fields ;
@@ -1466,7 +1460,7 @@ public function getStatements(): array
14661460 *
14671461 * @return static $this
14681462 */
1469- public function setStatements (array $ statements )
1463+ public function setStatements (array $ statements ): IQueryBuilderHandler
14701464 {
14711465 $ this ->statements = $ statements ;
14721466
@@ -1615,6 +1609,17 @@ public function whereNull($key): IQueryBuilderHandler
16151609 return $ this ->whereNullHandler ($ key );
16161610 }
16171611
1612+ /**
1613+ * Will add FOR statement to the end of the SELECT statement, like FOR UPDATE, FOR SHARE etc.
1614+ * @param $statement string
1615+ * @return static
1616+ */
1617+ public function for (string $ statement ): IQueryBuilderHandler
1618+ {
1619+ $ this ->addStatement ('for ' , $ statement );
1620+ return $ this ;
1621+ }
1622+
16181623 /**
16191624 * Returns all columns in current query
16201625 *
@@ -1655,7 +1660,7 @@ public function isOverwriteEnabled(): bool
16551660 * @param bool $enabled
16561661 * @return static
16571662 */
1658- public function setOverwriteEnabled (bool $ enabled )
1663+ public function setOverwriteEnabled (bool $ enabled ): IQueryBuilderHandler
16591664 {
16601665 $ this ->overwriteEnabled = $ enabled ;
16611666
0 commit comments