@@ -349,7 +349,7 @@ |
||
349 | 349 | */ |
350 | 350 | protected function validateId($id): void |
351 | 351 | { |
352 | - if (! is_string($id) && ! is_int($id)) { |
|
352 | + if (!is_string($id) && !is_int($id)) { |
|
353 | 353 | throw new InvalidArgumentException('ID should be an int or string only.'); |
354 | 354 | } |
355 | 355 | } |
@@ -120,7 +120,7 @@ |
||
120 | 120 | */ |
121 | 121 | public function ensureTransaction(): void |
122 | 122 | { |
123 | - if (! $this->inTransaction()) { |
|
123 | + if (!$this->inTransaction()) { |
|
124 | 124 | $this->beginTransaction(); |
125 | 125 | } |
126 | 126 | } |
@@ -528,7 +528,7 @@ |
||
528 | 528 | return ':' . $column; |
529 | 529 | } |
530 | 530 | |
531 | - if (! is_array($value)) { |
|
531 | + if (!is_array($value)) { |
|
532 | 532 | return (string) $value; |
533 | 533 | } |
534 | 534 |
@@ -468,7 +468,7 @@ |
||
468 | 468 | */ |
469 | 469 | protected function validateEntity(Entity $entity): void |
470 | 470 | { |
471 | - if (! ($entity instanceof $this->entity)) { |
|
471 | + if (!($entity instanceof $this->entity)) { |
|
472 | 472 | throw new InvalidEntityException( |
473 | 473 | 'This repository expects entities to be instances of ' |
474 | 474 | . $this->entity |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | // Iterate through the properties |
177 | 177 | foreach ($properties as $property => $value) { |
178 | - if (! property_exists($this, $property)) { |
|
178 | + if (!property_exists($this, $property)) { |
|
179 | 179 | continue; |
180 | 180 | } |
181 | 181 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $type = $propertyTypes[$property] ?? null; |
263 | 263 | |
264 | 264 | // If there is no type specified just return the value |
265 | - if (null === $type || ! is_string($value)) { |
|
265 | + if (null === $type || !is_string($value)) { |
|
266 | 266 | return $value; |
267 | 267 | } |
268 | 268 |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $container->setClosure( |
129 | 129 | Driver::class, |
130 | - static function (array $config, string $adapter) use ($container): Driver { |
|
130 | + static function(array $config, string $adapter) use ($container): Driver { |
|
131 | 131 | return new Driver( |
132 | 132 | $container, |
133 | 133 | $adapter, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | { |
149 | 149 | $container->setClosure( |
150 | 150 | PDODriver::class, |
151 | - static function (array $config, string $adapter) use ($container): PDODriver { |
|
151 | + static function(array $config, string $adapter) use ($container): PDODriver { |
|
152 | 152 | return new PDODriver( |
153 | 153 | $container, |
154 | 154 | $adapter, |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | $container->setClosure( |
171 | 171 | MySqlDriver::class, |
172 | - static function (array $config, string $adapter) use ($container): MySqlDriver { |
|
172 | + static function(array $config, string $adapter) use ($container): MySqlDriver { |
|
173 | 173 | return new MySqlDriver( |
174 | 174 | $container, |
175 | 175 | $adapter, |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | { |
191 | 191 | $container->setClosure( |
192 | 192 | PgSqlDriver::class, |
193 | - static function (array $config, string $adapter) use ($container): PgSqlDriver { |
|
193 | + static function(array $config, string $adapter) use ($container): PgSqlDriver { |
|
194 | 194 | return new PgSqlDriver( |
195 | 195 | $container, |
196 | 196 | $adapter, |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | $container->setClosure( |
215 | 215 | PDOAdapter::class, |
216 | - static function (array $config) use ($container, $orm) { |
|
216 | + static function(array $config) use ($container, $orm) { |
|
217 | 217 | return new PDOAdapter( |
218 | 218 | $container, |
219 | 219 | $orm, |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | $container->setClosure( |
244 | 244 | Repository::class, |
245 | - static function (string $entity) use ($orm): Repository { |
|
245 | + static function(string $entity) use ($orm): Repository { |
|
246 | 246 | return new Repository( |
247 | 247 | $orm, |
248 | 248 | $entity |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | |
266 | 266 | $container->setClosure( |
267 | 267 | CacheRepository::class, |
268 | - static function (string $entity) use ($orm, $cache): CacheRepository { |
|
268 | + static function(string $entity) use ($orm, $cache): CacheRepository { |
|
269 | 269 | return new CacheRepository( |
270 | 270 | $orm, |
271 | 271 | $cache, |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | { |
287 | 287 | $container->setClosure( |
288 | 288 | Persister::class, |
289 | - static function (Adapter $adapter): Persister { |
|
289 | + static function(Adapter $adapter): Persister { |
|
290 | 290 | return new \Valkyrja\ORM\Persisters\Persister( |
291 | 291 | $adapter |
292 | 292 | ); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | { |
306 | 306 | $container->setClosure( |
307 | 307 | Retriever::class, |
308 | - static function (Adapter $adapter): Retriever { |
|
308 | + static function(Adapter $adapter): Retriever { |
|
309 | 309 | return new \Valkyrja\ORM\Retrievers\Retriever( |
310 | 310 | $adapter |
311 | 311 | ); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | { |
325 | 325 | $container->setClosure( |
326 | 326 | Query::class, |
327 | - static function (Adapter $adapter): Query { |
|
327 | + static function(Adapter $adapter): Query { |
|
328 | 328 | return new \Valkyrja\ORM\Queries\Query( |
329 | 329 | $adapter |
330 | 330 | ); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | { |
344 | 344 | $container->setClosure( |
345 | 345 | QueryBuilder::class, |
346 | - static function (Adapter $adapter): QueryBuilder { |
|
346 | + static function(Adapter $adapter): QueryBuilder { |
|
347 | 347 | return new SqlQueryBuilder( |
348 | 348 | $adapter |
349 | 349 | ); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $entity->__set($entity::getDateModifiedField(), $this->getFormattedDate()); |
100 | 100 | } |
101 | 101 | |
102 | - if (! $defer) { |
|
102 | + if (!$defer) { |
|
103 | 103 | $this->persistEntity(Statement::INSERT, $entity); |
104 | 104 | |
105 | 105 | return; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $entity->__set($entity::getDateModifiedField(), $this->getFormattedDate()); |
132 | 132 | } |
133 | 133 | |
134 | - if (! $defer) { |
|
134 | + if (!$defer) { |
|
135 | 135 | $this->persistEntity(Statement::UPDATE, $entity); |
136 | 136 | |
137 | 137 | return; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function delete(Entity $entity, bool $defer = true): void |
161 | 161 | { |
162 | - if (! $defer) { |
|
162 | + if (!$defer) { |
|
163 | 163 | $this->persistEntity(Statement::DELETE, $entity); |
164 | 164 | |
165 | 165 | return; |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | $query = $this->getQuery($queryBuilder, $type, $idField, $properties); |
302 | 302 | |
303 | 303 | // If the execute failed |
304 | - if (! $query->execute()) { |
|
304 | + if (!$query->execute()) { |
|
305 | 305 | // Throw a fail exception |
306 | 306 | throw new ExecuteException($query->getError()); |
307 | 307 | } |
308 | 308 | |
309 | - if (! $entity->__isset($idField) && $lastInsertId = $this->adapter->lastInsertId($entity::getTableName(), $idField)) { |
|
309 | + if (!$entity->__isset($idField) && $lastInsertId = $this->adapter->lastInsertId($entity::getTableName(), $idField)) { |
|
310 | 310 | $entity->__set($idField, $lastInsertId); |
311 | 311 | } |
312 | 312 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $container->setClosure( |
109 | 109 | Nexmo::class, |
110 | - static function (array $config): Nexmo { |
|
110 | + static function(array $config): Nexmo { |
|
111 | 111 | return new Nexmo( |
112 | 112 | new Basic($config['username'], $config['password']) |
113 | 113 | ); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $container->setClosure( |
131 | 131 | LogAdapter::class, |
132 | - static function (array $config) use ($logger): LogAdapter { |
|
132 | + static function(array $config) use ($logger): LogAdapter { |
|
133 | 133 | return new LogAdapter( |
134 | 134 | $logger->useLogger($config['logger'] ?? null), |
135 | 135 | $config |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | { |
150 | 150 | $container->setClosure( |
151 | 151 | NexmoAdapter::class, |
152 | - static function (array $config) use ($container): NexmoAdapter { |
|
152 | + static function(array $config) use ($container): NexmoAdapter { |
|
153 | 153 | return new NexmoAdapter( |
154 | 154 | $container->get(Nexmo::class, [$config]) |
155 | 155 | ); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | { |
169 | 169 | $container->setClosure( |
170 | 170 | NullAdapter::class, |
171 | - static function (array $config): NullAdapter { |
|
171 | + static function(array $config): NullAdapter { |
|
172 | 172 | return new NullAdapter( |
173 | 173 | $config |
174 | 174 | ); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | $container->setClosure( |
189 | 189 | Message::class, |
190 | - static function (array $config): Message { |
|
190 | + static function(array $config): Message { |
|
191 | 191 | return (new Message())->setFrom($config['fromName']); |
192 | 192 | } |
193 | 193 | ); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | // If the target directory is not a directory |
240 | 240 | // or the target directory is not writable |
241 | - if (! is_dir($targetDirectory) || ! is_writable($targetDirectory)) { |
|
241 | + if (!is_dir($targetDirectory) || !is_writable($targetDirectory)) { |
|
242 | 242 | // Throw a runtime exception |
243 | 243 | throw new RuntimeException( |
244 | 244 | sprintf('The target directory `%s` does not exists or is not writable', $targetDirectory) |
@@ -250,13 +250,13 @@ discard block |
||
250 | 250 | // If the PHP_SAPI value is empty |
251 | 251 | // or there is no file |
252 | 252 | // or the PHP_SAPI value is set to a CLI environment |
253 | - if (empty($sapi) || ! $this->file || 0 === strpos($sapi, 'cli')) { |
|
253 | + if (empty($sapi) || !$this->file || 0 === strpos($sapi, 'cli')) { |
|
254 | 254 | // Non-SAPI environment, or no filename present |
255 | 255 | $this->writeStream($targetPath); |
256 | 256 | } |
257 | 257 | // Otherwise try to use the move_uploaded_file function |
258 | 258 | // and if the move_uploaded_file function call failed |
259 | - elseif (! move_uploaded_file($this->file, $targetPath)) { |
|
259 | + elseif (!move_uploaded_file($this->file, $targetPath)) { |
|
260 | 260 | // Throw a runtime exception |
261 | 261 | throw new RuntimeException('Error occurred while moving uploaded file'); |
262 | 262 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $stream->rewind(); |
354 | 354 | |
355 | 355 | // While the end of file hasn't been reached |
356 | - while (! $stream->eof()) { |
|
356 | + while (!$stream->eof()) { |
|
357 | 357 | // Write the stream's contents to the handler |
358 | 358 | fwrite($handle, $stream->read(4096)); |
359 | 359 | } |