@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @param string|null $name |
| 200 | 200 | * @return $this |
| 201 | 201 | */ |
| 202 | - public function primary(string|array $columns, ?string $name = null): self |
|
| 202 | + public function primary(string | array $columns, ?string $name = null): self |
|
| 203 | 203 | { |
| 204 | 204 | if (!is_array($columns)) { |
| 205 | 205 | $columns = [$columns]; |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * @param string|null $name |
| 224 | 224 | * @return $this |
| 225 | 225 | */ |
| 226 | - public function unique(string|array $columns, ?string $name = null): self |
|
| 226 | + public function unique(string | array $columns, ?string $name = null): self |
|
| 227 | 227 | { |
| 228 | 228 | if (!is_array($columns)) { |
| 229 | 229 | $columns = [$columns]; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param string|null $name |
| 245 | 245 | * @return $this |
| 246 | 246 | */ |
| 247 | - public function index(string|array $columns, ?string $name = null): self |
|
| 247 | + public function index(string | array $columns, ?string $name = null): self |
|
| 248 | 248 | { |
| 249 | 249 | if (!is_array($columns)) { |
| 250 | 250 | $columns = [$columns]; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * @param string|null $name |
| 266 | 266 | * @return ForeignKey |
| 267 | 267 | */ |
| 268 | - public function foreign(string|array $columns, ?string $name = null): ForeignKey |
|
| 268 | + public function foreign(string | array $columns, ?string $name = null): ForeignKey |
|
| 269 | 269 | { |
| 270 | 270 | if (!is_array($columns)) { |
| 271 | 271 | $columns = [$columns]; |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * @class CreateTable |
| 51 | 51 | * @package Platine\Database\Schema |
| 52 | 52 | */ |
| 53 | -class CreateTable |
|
| 54 | -{ |
|
| 53 | +class CreateTable { |
|
| 55 | 54 | /** |
| 56 | 55 | * The list of CreateColumn |
| 57 | 56 | * @var array<string, CreateColumn> |
@@ -98,8 +97,7 @@ discard block |
||
| 98 | 97 | * Class constructor |
| 99 | 98 | * @param string $table The name of the table |
| 100 | 99 | */ |
| 101 | - public function __construct(protected string $table) |
|
| 102 | - { |
|
| 100 | + public function __construct(protected string $table) { |
|
| 103 | 101 | } |
| 104 | 102 | |
| 105 | 103 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function __construct( |
| 70 | 70 | Connection $connection, |
| 71 | - string|array $from, |
|
| 71 | + string | array $from, |
|
| 72 | 72 | ?QueryStatement $queryStatement = null |
| 73 | 73 | ) { |
| 74 | 74 | parent::__construct($from, $queryStatement); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @return int |
| 84 | 84 | * @throws QueryException |
| 85 | 85 | */ |
| 86 | - public function delete(string|array $tables = []): int |
|
| 86 | + public function delete(string | array $tables = []): int |
|
| 87 | 87 | { |
| 88 | 88 | parent::delete($tables); |
| 89 | 89 | $driver = $this->connection->getDriver(); |
@@ -53,8 +53,7 @@ |
||
| 53 | 53 | * @class Delete |
| 54 | 54 | * @package Platine\Database\Query |
| 55 | 55 | */ |
| 56 | -class Delete extends DeleteStatement |
|
| 57 | -{ |
|
| 56 | +class Delete extends DeleteStatement { |
|
| 58 | 57 | /** |
| 59 | 58 | * @var Connection |
| 60 | 59 | */ |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * @class Update |
| 53 | 53 | * @package Platine\Database\Query |
| 54 | 54 | */ |
| 55 | -class Update extends UpdateStatement |
|
| 56 | -{ |
|
| 55 | +class Update extends UpdateStatement { |
|
| 57 | 56 | /** |
| 58 | 57 | * @var Connection |
| 59 | 58 | */ |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function __construct( |
| 69 | 69 | Connection $connection, |
| 70 | - string|array $table, |
|
| 70 | + string | array $table, |
|
| 71 | 71 | ?QueryStatement $queryStatement = null |
| 72 | 72 | ) { |
| 73 | 73 | parent::__construct($table, $queryStatement); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param mixed $value |
| 97 | 97 | * @return int |
| 98 | 98 | */ |
| 99 | - public function increment(string|array $column, mixed $value = 1): int |
|
| 99 | + public function increment(string | array $column, mixed $value = 1): int |
|
| 100 | 100 | { |
| 101 | 101 | return $this->incrementOrDecrement('+', $column, $value); |
| 102 | 102 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @param mixed $value |
| 107 | 107 | * @return int |
| 108 | 108 | */ |
| 109 | - public function decrement(string|array $column, mixed $value = 1): int |
|
| 109 | + public function decrement(string | array $column, mixed $value = 1): int |
|
| 110 | 110 | { |
| 111 | 111 | return $this->incrementOrDecrement('-', $column, $value); |
| 112 | 112 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | protected function incrementOrDecrement( |
| 121 | 121 | string $sign, |
| 122 | - string|array $columns, |
|
| 122 | + string | array $columns, |
|
| 123 | 123 | mixed $value |
| 124 | 124 | ): int { |
| 125 | 125 | if (!is_array($columns)) { |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | foreach ($columns as $key => $val) { |
| 132 | 132 | if (is_numeric($key)) { |
| 133 | - $values[$val] = function (Expression $expr) use ($sign, $val, $value) { |
|
| 133 | + $values[$val] = function(Expression $expr) use ($sign, $val, $value) { |
|
| 134 | 134 | $expr->column($val)->op($sign)->value($value); |
| 135 | 135 | }; |
| 136 | 136 | } else { |
| 137 | - $values[$key] = function (Expression $expr) use ($sign, $key, $val) { |
|
| 137 | + $values[$key] = function(Expression $expr) use ($sign, $key, $val) { |
|
| 138 | 138 | $expr->column($key)->op($sign)->value($val); |
| 139 | 139 | }; |
| 140 | 140 | } |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | * @class HavingExpression |
| 56 | 56 | * @package Platine\Database\Query |
| 57 | 57 | */ |
| 58 | -class HavingExpression |
|
| 59 | -{ |
|
| 58 | +class HavingExpression { |
|
| 60 | 59 | /** |
| 61 | 60 | * The Query statement instance |
| 62 | 61 | * @var QueryStatement |
@@ -83,8 +82,7 @@ discard block |
||
| 83 | 82 | * HavingExpression constructor. |
| 84 | 83 | * @param QueryStatement $queryStatement |
| 85 | 84 | */ |
| 86 | - public function __construct(QueryStatement $queryStatement) |
|
| 87 | - { |
|
| 85 | + public function __construct(QueryStatement $queryStatement) { |
|
| 88 | 86 | $this->queryStatement = $queryStatement; |
| 89 | 87 | |
| 90 | 88 | $this->having = new Having($queryStatement); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * @var string|Expression |
| 74 | 74 | */ |
| 75 | - protected string|Expression $column; |
|
| 75 | + protected string | Expression $column; |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * @var string |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param string $separator |
| 96 | 96 | * @return $this |
| 97 | 97 | */ |
| 98 | - public function init(string|Expression|Closure $column, string $separator): self |
|
| 98 | + public function init(string | Expression | Closure $column, string $separator): self |
|
| 99 | 99 | { |
| 100 | 100 | if ($column instanceof Closure) { |
| 101 | 101 | $column = Expression::fromClosure($column); |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | * @param string|array<int, string> $tables |
| 63 | 63 | * @return SelectStatement |
| 64 | 64 | */ |
| 65 | - public function from(string|array $tables): SelectStatement |
|
| 65 | + public function from(string | array $tables): SelectStatement |
|
| 66 | 66 | { |
| 67 | 67 | return $this->select = new SelectStatement($tables); |
| 68 | 68 | } |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | * @class SubQuery |
| 51 | 51 | * @package Platine\Database\Query |
| 52 | 52 | */ |
| 53 | -class SubQuery |
|
| 54 | -{ |
|
| 53 | +class SubQuery { |
|
| 55 | 54 | /** |
| 56 | 55 | * The SelectStatement instance |
| 57 | 56 | * @var SelectStatement |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * @var string|Expression |
| 59 | 59 | */ |
| 60 | - protected string|Expression $aggregate; |
|
| 60 | + protected string | Expression $aggregate; |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * @var string |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param string $separator |
| 85 | 85 | * @return self |
| 86 | 86 | */ |
| 87 | - public function init(string|Expression|Closure $aggregate, string $separator): self |
|
| 87 | + public function init(string | Expression | Closure $aggregate, string $separator): self |
|
| 88 | 88 | { |
| 89 | 89 | if ($aggregate instanceof Closure) { |
| 90 | 90 | $aggregate = Expression::fromClosure($aggregate); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @param array<int, mixed>|Closure $value |
| 212 | 212 | * @return void |
| 213 | 213 | */ |
| 214 | - public function in(array|Closure $value): void |
|
| 214 | + public function in(array | Closure $value): void |
|
| 215 | 215 | { |
| 216 | 216 | $this->queryStatement->addHavingIn( |
| 217 | 217 | $this->aggregate, |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @param array<int, mixed>|Closure $value |
| 226 | 226 | * @return void |
| 227 | 227 | */ |
| 228 | - public function notIn(array|Closure $value): void |
|
| 228 | + public function notIn(array | Closure $value): void |
|
| 229 | 229 | { |
| 230 | 230 | $this->queryStatement->addHavingIn( |
| 231 | 231 | $this->aggregate, |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | * @class Having |
| 53 | 53 | * @package Platine\Database\Query |
| 54 | 54 | */ |
| 55 | -class Having |
|
| 56 | -{ |
|
| 55 | +class Having { |
|
| 57 | 56 | /** |
| 58 | 57 | * @var string|Expression |
| 59 | 58 | */ |
@@ -68,8 +67,7 @@ discard block |
||
| 68 | 67 | * Having constructor. |
| 69 | 68 | * @param QueryStatement $queryStatement |
| 70 | 69 | */ |
| 71 | - public function __construct(protected QueryStatement $queryStatement) |
|
| 72 | - { |
|
| 70 | + public function __construct(protected QueryStatement $queryStatement) { |
|
| 73 | 71 | } |
| 74 | 72 | |
| 75 | 73 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return Delete|Select|BaseStatement |
| 62 | 62 | */ |
| 63 | - public function join(array|string $table, Closure $closure): Delete|Select|BaseStatement |
|
| 63 | + public function join(array | string $table, Closure $closure): Delete | Select | BaseStatement |
|
| 64 | 64 | { |
| 65 | 65 | $this->queryStatement->addJoinClause('INNER', $table, $closure); |
| 66 | 66 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return Delete|Select|BaseStatement |
| 75 | 75 | */ |
| 76 | - public function leftJoin(array|string $table, Closure $closure): Delete|Select|BaseStatement |
|
| 76 | + public function leftJoin(array | string $table, Closure $closure): Delete | Select | BaseStatement |
|
| 77 | 77 | { |
| 78 | 78 | $this->queryStatement->addJoinClause('LEFT', $table, $closure); |
| 79 | 79 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return Delete|Select|BaseStatement |
| 88 | 88 | */ |
| 89 | - public function rightJoin(array|string $table, Closure $closure): Delete|Select|BaseStatement |
|
| 89 | + public function rightJoin(array | string $table, Closure $closure): Delete | Select | BaseStatement |
|
| 90 | 90 | { |
| 91 | 91 | $this->queryStatement->addJoinClause('RIGHT', $table, $closure); |
| 92 | 92 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return Delete|Select|BaseStatement |
| 101 | 101 | */ |
| 102 | - public function fullJoin(array|string $table, Closure $closure): Delete|Select|BaseStatement |
|
| 102 | + public function fullJoin(array | string $table, Closure $closure): Delete | Select | BaseStatement |
|
| 103 | 103 | { |
| 104 | 104 | $this->queryStatement->addJoinClause('FULL', $table, $closure); |
| 105 | 105 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @return Delete|Select|BaseStatement |
| 114 | 114 | */ |
| 115 | - public function crossJoin(array|string $table, Closure $closure): Delete|Select|BaseStatement |
|
| 115 | + public function crossJoin(array | string $table, Closure $closure): Delete | Select | BaseStatement |
|
| 116 | 116 | { |
| 117 | 117 | $this->queryStatement->addJoinClause('CROSS', $table, $closure); |
| 118 | 118 | |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * @class BaseStatement |
| 53 | 53 | * @package Platine\Database\Query |
| 54 | 54 | */ |
| 55 | -class BaseStatement extends WhereStatement |
|
| 56 | -{ |
|
| 55 | +class BaseStatement extends WhereStatement { |
|
| 57 | 56 | /** |
| 58 | 57 | * @param string|string[] $table |
| 59 | 58 | * @param Closure $closure |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * @class Insert |
| 53 | 53 | * @package Platine\Database\Query |
| 54 | 54 | */ |
| 55 | -class Insert extends InsertStatement |
|
| 56 | -{ |
|
| 55 | +class Insert extends InsertStatement { |
|
| 57 | 56 | /** |
| 58 | 57 | * @var Connection |
| 59 | 58 | */ |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @param string|array<int, string> $tables |
| 65 | 65 | * @param QueryStatement|null $queryStatement |
| 66 | 66 | */ |
| 67 | - public function __construct(string|array $tables, ?QueryStatement $queryStatement = null) |
|
| 67 | + public function __construct(string | array $tables, ?QueryStatement $queryStatement = null) |
|
| 68 | 68 | { |
| 69 | 69 | parent::__construct($queryStatement); |
| 70 | 70 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @param string|Expression|Closure|string[]|Expression[]|Closure[] $columns |
| 103 | 103 | * @return $this |
| 104 | 104 | */ |
| 105 | - public function groupBy(string|Expression|Closure|array $columns): self |
|
| 105 | + public function groupBy(string | Expression | Closure | array $columns): self |
|
| 106 | 106 | { |
| 107 | 107 | if (!is_array($columns)) { |
| 108 | 108 | $columns = [$columns]; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param Closure|null $closure |
| 118 | 118 | * @return $this |
| 119 | 119 | */ |
| 120 | - public function having(string|Expression|Closure $column, ?Closure $closure = null): self |
|
| 120 | + public function having(string | Expression | Closure $column, ?Closure $closure = null): self |
|
| 121 | 121 | { |
| 122 | 122 | $this->havingStatement->having($column, $closure); |
| 123 | 123 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @return $this |
| 131 | 131 | */ |
| 132 | 132 | public function orHaving( |
| 133 | - string|Expression|Closure $column, |
|
| 133 | + string | Expression | Closure $column, |
|
| 134 | 134 | ?Closure $closure = null |
| 135 | 135 | ): self { |
| 136 | 136 | $this->havingStatement->orHaving($column, $closure); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @return $this |
| 145 | 145 | */ |
| 146 | 146 | public function orderBy( |
| 147 | - string|Closure|Expression|array $columns, |
|
| 147 | + string | Closure | Expression | array $columns, |
|
| 148 | 148 | string $order = 'ASC' |
| 149 | 149 | ): self { |
| 150 | 150 | if (!is_array($columns)) { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param string|Expression|Closure|string[]|Expression[]|Closure[] $columns |
| 183 | 183 | * @return mixed |
| 184 | 184 | */ |
| 185 | - public function select(string|Expression|Closure|array $columns = []): mixed |
|
| 185 | + public function select(string | Expression | Closure | array $columns = []): mixed |
|
| 186 | 186 | { |
| 187 | 187 | $expr = new ColumnExpression($this->queryStatement); |
| 188 | 188 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @param string|Expression|Closure $name |
| 203 | 203 | * @return mixed |
| 204 | 204 | */ |
| 205 | - public function column(string|Expression|Closure $name): mixed |
|
| 205 | + public function column(string | Expression | Closure $name): mixed |
|
| 206 | 206 | { |
| 207 | 207 | (new ColumnExpression($this->queryStatement))->column($name); |
| 208 | 208 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @return mixed |
| 216 | 216 | */ |
| 217 | 217 | public function count( |
| 218 | - string|Expression|Closure $column = '*', |
|
| 218 | + string | Expression | Closure $column = '*', |
|
| 219 | 219 | bool $distinct = false |
| 220 | 220 | ): mixed { |
| 221 | 221 | (new ColumnExpression($this->queryStatement))->count($column, null, $distinct); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @return mixed |
| 230 | 230 | */ |
| 231 | 231 | public function avg( |
| 232 | - string|Expression|Closure $column, |
|
| 232 | + string | Expression | Closure $column, |
|
| 233 | 233 | bool $distinct = false |
| 234 | 234 | ): mixed { |
| 235 | 235 | (new ColumnExpression($this->queryStatement))->avg($column, null, $distinct); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @param bool $distinct |
| 243 | 243 | * @return mixed |
| 244 | 244 | */ |
| 245 | - public function sum(string|Expression|Closure $column, bool $distinct = false): mixed |
|
| 245 | + public function sum(string | Expression | Closure $column, bool $distinct = false): mixed |
|
| 246 | 246 | { |
| 247 | 247 | (new ColumnExpression($this->queryStatement))->sum($column, null, $distinct); |
| 248 | 248 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @param bool $distinct |
| 255 | 255 | * @return mixed |
| 256 | 256 | */ |
| 257 | - public function min(string|Expression|Closure $column, bool $distinct = false): mixed |
|
| 257 | + public function min(string | Expression | Closure $column, bool $distinct = false): mixed |
|
| 258 | 258 | { |
| 259 | 259 | (new ColumnExpression($this->queryStatement))->min($column, null, $distinct); |
| 260 | 260 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | * @param bool $distinct |
| 267 | 267 | * @return mixed |
| 268 | 268 | */ |
| 269 | - public function max(string|Expression|Closure $column, bool $distinct = false): mixed |
|
| 269 | + public function max(string | Expression | Closure $column, bool $distinct = false): mixed |
|
| 270 | 270 | { |
| 271 | 271 | (new ColumnExpression($this->queryStatement))->max($column, null, $distinct); |
| 272 | 272 | |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | * @class SelectStatement |
| 53 | 53 | * @package Platine\Database\Query |
| 54 | 54 | */ |
| 55 | -class SelectStatement extends BaseStatement |
|
| 56 | -{ |
|
| 55 | +class SelectStatement extends BaseStatement { |
|
| 57 | 56 | /** |
| 58 | 57 | * @var HavingStatement |
| 59 | 58 | */ |
@@ -64,8 +63,7 @@ discard block |
||
| 64 | 63 | * @param string|array<int, string> $tables |
| 65 | 64 | * @param QueryStatement|null $queryStatement |
| 66 | 65 | */ |
| 67 | - public function __construct(string|array $tables, ?QueryStatement $queryStatement = null) |
|
| 68 | - { |
|
| 66 | + public function __construct(string|array $tables, ?QueryStatement $queryStatement = null) { |
|
| 69 | 67 | parent::__construct($queryStatement); |
| 70 | 68 | |
| 71 | 69 | if (!is_array($tables)) { |