Skip to content

Commit

Permalink
Add type hinting for lateral join methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Bakke committed Feb 16, 2024
1 parent 021acc9 commit b31ddd1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ public function joinSub($query, $as, $first, $operator = null, $second = null, $
* @param string $type
* @return $this
*/
public function joinLateral($query, $as, $type = 'inner')
public function joinLateral($query, string $as, string $type = 'inner'): static
{
[$query, $bindings] = $this->createSub($query);

Expand All @@ -614,7 +614,7 @@ public function joinLateral($query, $as, $type = 'inner')
* @param string $as
* @return $this
*/
public function leftJoinLateral($query, $as)
public function leftJoinLateral($query, string $as): static
{
return $this->joinLateral($query, $as, 'left');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ protected function compileJoins(Builder $query, $joins)
*
* @throws \RuntimeException
*/
public function joinLateral(JoinClause $join, string $expression)
public function joinLateral(JoinClause $join, string $expression): string
{
throw new RuntimeException('This database engine does not support lateral joins.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected function compileUpdateColumns(Builder $query, array $values)
* @param string $expression
* @return string
*/
public function joinLateral(JoinClause $join, string $expression)
public function joinLateral(JoinClause $join, string $expression): string
{
return trim("{$join->type} join lateral {$expression} on true");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/PostgresGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ protected function compileUpdateColumns(Builder $query, array $values)
* @param string $expression
* @return string
*/
public function joinLateral(JoinClause $join, string $expression)
public function joinLateral(JoinClause $join, string $expression): string
{
return trim("{$join->type} join lateral {$expression} on true");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ protected function compileUpdateWithJoins(Builder $query, $table, $columns, $whe
* @param string $expression
* @return string
*/
public function joinLateral(JoinClause $join, string $expression)
public function joinLateral(JoinClause $join, string $expression): string
{
$type = $join->type == 'left' ? 'outer' : 'cross';

Expand Down

0 comments on commit b31ddd1

Please sign in to comment.