@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class Expression |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class Expression |
|
56 | -{ |
|
55 | +class Expression { |
|
57 | 56 | /** |
58 | 57 | * The list of expression |
59 | 58 | * @var array<int, array<string, mixed>> |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param string|array<string> $tables |
112 | 112 | * @return SelectStatement |
113 | 113 | */ |
114 | - public function from(string|array $tables): SelectStatement |
|
114 | + public function from(string | array $tables): SelectStatement |
|
115 | 115 | { |
116 | 116 | $subQuery = new SubQuery(); |
117 | 117 | $this->addExpression('subquery', $subQuery); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @return $this |
126 | 126 | */ |
127 | 127 | public function count( |
128 | - string|array|Expression|Closure $column = '*', |
|
128 | + string | array | Expression | Closure $column = '*', |
|
129 | 129 | bool $distinct = false |
130 | 130 | ): self { |
131 | 131 | if (!is_array($column)) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @param bool $distinct |
146 | 146 | * @return $this |
147 | 147 | */ |
148 | - public function sum(string|Expression|Closure $column, bool $distinct = false): self |
|
148 | + public function sum(string | Expression | Closure $column, bool $distinct = false): self |
|
149 | 149 | { |
150 | 150 | return $this->addFunction( |
151 | 151 | 'aggregateFunction', |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param bool $distinct |
161 | 161 | * @return $this |
162 | 162 | */ |
163 | - public function avg(string|Expression|Closure $column, bool $distinct = false): self |
|
163 | + public function avg(string | Expression | Closure $column, bool $distinct = false): self |
|
164 | 164 | { |
165 | 165 | return $this->addFunction( |
166 | 166 | 'aggregateFunction', |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @param bool $distinct |
176 | 176 | * @return $this |
177 | 177 | */ |
178 | - public function min(string|Expression|Closure $column, bool $distinct = false): self |
|
178 | + public function min(string | Expression | Closure $column, bool $distinct = false): self |
|
179 | 179 | { |
180 | 180 | return $this->addFunction( |
181 | 181 | 'aggregateFunction', |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param bool $distinct |
191 | 191 | * @return $this |
192 | 192 | */ |
193 | - public function max(string|Expression|Closure $column, bool $distinct = false): self |
|
193 | + public function max(string | Expression | Closure $column, bool $distinct = false): self |
|
194 | 194 | { |
195 | 195 | return $this->addFunction( |
196 | 196 | 'aggregateFunction', |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | protected function addFunction( |
239 | 239 | string $type, |
240 | 240 | string $name, |
241 | - string|Closure|array|Expression $column, |
|
241 | + string | Closure | array | Expression $column, |
|
242 | 242 | array $arguments = [] |
243 | 243 | ): self { |
244 | 244 | if ($column instanceof Closure) { |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class Join |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class Join |
|
56 | -{ |
|
55 | +class Join { |
|
57 | 56 | /** |
58 | 57 | * The Join conditions |
59 | 58 | * @var array<int, mixed> |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @return $this |
76 | 76 | */ |
77 | 77 | public function on( |
78 | - string|Expression|Closure $column1, |
|
79 | - string|Expression|Closure|bool|null $column2 = null, |
|
78 | + string | Expression | Closure $column1, |
|
79 | + string | Expression | Closure | bool | null $column2 = null, |
|
80 | 80 | string $operator = '=' |
81 | 81 | ): self { |
82 | 82 | return $this->addJoinCondition($column1, $column2, $operator, 'AND'); |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * @return $this |
90 | 90 | */ |
91 | 91 | public function andOn( |
92 | - string|Expression|Closure $column1, |
|
93 | - string|Expression|Closure|bool|null $column2 = null, |
|
92 | + string | Expression | Closure $column1, |
|
93 | + string | Expression | Closure | bool | null $column2 = null, |
|
94 | 94 | string $operator = '=' |
95 | 95 | ): self { |
96 | 96 | return $this->addJoinCondition($column1, $column2, $operator, 'AND'); |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * @return $this |
104 | 104 | */ |
105 | 105 | public function orOn( |
106 | - string|Expression|Closure $column1, |
|
107 | - string|Expression|Closure|bool|null $column2 = null, |
|
106 | + string | Expression | Closure $column1, |
|
107 | + string | Expression | Closure | bool | null $column2 = null, |
|
108 | 108 | string $operator = '=' |
109 | 109 | ): self { |
110 | 110 | return $this->addJoinCondition($column1, $column2, $operator, 'OR'); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param string $separator |
116 | 116 | * @return $this |
117 | 117 | */ |
118 | - protected function addJoinExpression(Expression|Closure $expression, string $separator = 'AND'): self |
|
118 | + protected function addJoinExpression(Expression | Closure $expression, string $separator = 'AND'): self |
|
119 | 119 | { |
120 | 120 | if ($expression instanceof Closure) { |
121 | 121 | $expression = Expression::fromClosure($expression); |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @return $this |
139 | 139 | */ |
140 | 140 | protected function addJoinCondition( |
141 | - string|Expression|Closure $column1, |
|
142 | - string|Expression|Closure|bool|null $column2, |
|
141 | + string | Expression | Closure $column1, |
|
142 | + string | Expression | Closure | bool | null $column2, |
|
143 | 143 | string $operator, |
144 | 144 | string $separator = 'AND' |
145 | 145 | ): self { |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | * @class ColumnExpression |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class ColumnExpression |
|
56 | -{ |
|
55 | +class ColumnExpression { |
|
57 | 56 | /** |
58 | 57 | * The Query statement instance |
59 | 58 | * @var QueryStatement |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | * ColumnExpression constructor. |
65 | 64 | * @param QueryStatement $queryStatement |
66 | 65 | */ |
67 | - public function __construct(QueryStatement $queryStatement) |
|
68 | - { |
|
66 | + public function __construct(QueryStatement $queryStatement) { |
|
69 | 67 | $this->queryStatement = $queryStatement; |
70 | 68 | } |
71 | 69 | |
@@ -159,8 +157,7 @@ discard block |
||
159 | 157 | return $this->column((new Expression())->max($column, $distinct), $alias); |
160 | 158 | } |
161 | 159 | |
162 | - public function __clone() |
|
163 | - { |
|
160 | + public function __clone() { |
|
164 | 161 | $this->queryStatement = clone $this->queryStatement; |
165 | 162 | } |
166 | 163 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string|null $alias |
75 | 75 | * @return $this |
76 | 76 | */ |
77 | - public function column(string|Expression|Closure $name, string $alias = null): self |
|
77 | + public function column(string | Expression | Closure $name, string $alias = null): self |
|
78 | 78 | { |
79 | 79 | $this->queryStatement->addColumn($name, $alias); |
80 | 80 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return $this |
112 | 112 | */ |
113 | 113 | public function count( |
114 | - string|array|Expression|Closure $column = '*', |
|
114 | + string | array | Expression | Closure $column = '*', |
|
115 | 115 | string $alias = null, |
116 | 116 | bool $distinct = false |
117 | 117 | ): self { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @return $this |
126 | 126 | */ |
127 | 127 | public function avg( |
128 | - string|Expression|Closure $column, |
|
128 | + string | Expression | Closure $column, |
|
129 | 129 | string $alias = null, |
130 | 130 | bool $distinct = false |
131 | 131 | ): self { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @return $this |
140 | 140 | */ |
141 | 141 | public function sum( |
142 | - string|Expression|Closure $column, |
|
142 | + string | Expression | Closure $column, |
|
143 | 143 | string $alias = null, |
144 | 144 | bool $distinct = false |
145 | 145 | ): self { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return $this |
154 | 154 | */ |
155 | 155 | public function min( |
156 | - string|Expression|Closure $column, |
|
156 | + string | Expression | Closure $column, |
|
157 | 157 | string $alias = null, |
158 | 158 | bool $distinct = false |
159 | 159 | ): self { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @return $this |
168 | 168 | */ |
169 | 169 | public function max( |
170 | - string|Expression|Closure $column, |
|
170 | + string | Expression | Closure $column, |
|
171 | 171 | string $alias = null, |
172 | 172 | bool $distinct = false |
173 | 173 | ): self { |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | * @class AlterTable |
51 | 51 | * @package Platine\Database\Schema |
52 | 52 | */ |
53 | -class AlterTable |
|
54 | -{ |
|
53 | +class AlterTable { |
|
55 | 54 | /** |
56 | 55 | * The name of table |
57 | 56 | * @var string |
@@ -68,8 +67,7 @@ discard block |
||
68 | 67 | * Class constructor |
69 | 68 | * @param string $table |
70 | 69 | */ |
71 | - public function __construct(string $table) |
|
72 | - { |
|
70 | + public function __construct(string $table) { |
|
73 | 71 | $this->table = $table; |
74 | 72 | } |
75 | 73 |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param string|null $name |
172 | 172 | * @return $this |
173 | 173 | */ |
174 | - public function primary(string|array $columns, ?string $name = null): self |
|
174 | + public function primary(string | array $columns, ?string $name = null): self |
|
175 | 175 | { |
176 | 176 | return $this->addKey('addPrimary', $columns, $name); |
177 | 177 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param string|null $name |
183 | 183 | * @return $this |
184 | 184 | */ |
185 | - public function unique(string|array $columns, ?string $name = null): self |
|
185 | + public function unique(string | array $columns, ?string $name = null): self |
|
186 | 186 | { |
187 | 187 | return $this->addKey('addUnique', $columns, $name); |
188 | 188 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param string|null $name |
194 | 194 | * @return $this |
195 | 195 | */ |
196 | - public function index(string|array $columns, ?string $name = null): self |
|
196 | + public function index(string | array $columns, ?string $name = null): self |
|
197 | 197 | { |
198 | 198 | return $this->addKey('addIndex', $columns, $name); |
199 | 199 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @param string|null $name |
205 | 205 | * @return ForeignKey |
206 | 206 | */ |
207 | - public function foreign(string|array $columns, ?string $name = null): ForeignKey |
|
207 | + public function foreign(string | array $columns, ?string $name = null): ForeignKey |
|
208 | 208 | { |
209 | 209 | if (!is_array($columns)) { |
210 | 210 | $columns = [$columns]; |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | * @param string|null $name |
567 | 567 | * @return $this |
568 | 568 | */ |
569 | - protected function addKey(string $type, string|array $columns, ?string $name = null): self |
|
569 | + protected function addKey(string $type, string | array $columns, ?string $name = null): self |
|
570 | 570 | { |
571 | 571 | static $maps = [ |
572 | 572 | 'addPrimary' => 'pk', |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | * @class AlterColumn |
51 | 51 | * @package Platine\Database\Schema |
52 | 52 | */ |
53 | -class AlterColumn extends BaseColumn |
|
54 | -{ |
|
53 | +class AlterColumn extends BaseColumn { |
|
55 | 54 | /** |
56 | 55 | * The alter table |
57 | 56 | * @var AlterTable |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | * @param string $name |
65 | 64 | * @param string|null $type |
66 | 65 | */ |
67 | - public function __construct(AlterTable $table, string $name, ?string $type = null) |
|
68 | - { |
|
66 | + public function __construct(AlterTable $table, string $name, ?string $type = null) { |
|
69 | 67 | $this->table = $table; |
70 | 68 | parent::__construct($name, $type); |
71 | 69 | } |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | * @class CreateColumn |
51 | 51 | * @package Platine\Database\Schema |
52 | 52 | */ |
53 | -class CreateColumn extends BaseColumn |
|
54 | -{ |
|
53 | +class CreateColumn extends BaseColumn { |
|
55 | 54 | /** |
56 | 55 | * The associated table instance |
57 | 56 | * @var CreateTable |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | * @param string $name |
65 | 64 | * @param string|null $type |
66 | 65 | */ |
67 | - public function __construct(CreateTable $table, string $name, ?string $type = null) |
|
68 | - { |
|
66 | + public function __construct(CreateTable $table, string $name, ?string $type = null) { |
|
69 | 67 | $this->table = $table; |
70 | 68 | parent::__construct($name, $type); |
71 | 69 | } |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | * @class ForeignKey |
51 | 51 | * @package Platine\Database\Schema |
52 | 52 | */ |
53 | -class ForeignKey |
|
54 | -{ |
|
53 | +class ForeignKey { |
|
55 | 54 | /** |
56 | 55 | * The referenced table |
57 | 56 | * @var string |
@@ -80,8 +79,7 @@ discard block |
||
80 | 79 | * Class constructor |
81 | 80 | * @param array<int, string> $columns |
82 | 81 | */ |
83 | - public function __construct(array $columns) |
|
84 | - { |
|
82 | + public function __construct(array $columns) { |
|
85 | 83 | $this->columns = $columns; |
86 | 84 | } |
87 | 85 |
@@ -54,8 +54,7 @@ |
||
54 | 54 | * @class PostgreSQL |
55 | 55 | * @package Platine\Database\Driver |
56 | 56 | */ |
57 | -class PostgreSQL extends Driver |
|
58 | -{ |
|
57 | +class PostgreSQL extends Driver { |
|
59 | 58 | /** |
60 | 59 | * @inheritDoc |
61 | 60 | */ |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class MySQL |
53 | 53 | * @package Platine\Database\Driver |
54 | 54 | */ |
55 | -class MySQL extends Driver |
|
56 | -{ |
|
55 | +class MySQL extends Driver { |
|
57 | 56 | /** |
58 | 57 | * @inheritdoc |
59 | 58 | * @var string |