@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $statement = 'UPDATE ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 202 | - 'SET ' . implode(',', $set) . ' ' . |
|
| 203 | - 'WHERE ' . implode(' AND ', $where); |
|
| 202 | + 'SET ' . implode(',', $set) . ' ' . |
|
| 203 | + 'WHERE ' . implode(' AND ', $where); |
|
| 204 | 204 | $this->entityManager->getConnection()->query($statement); |
| 205 | 205 | |
| 206 | 206 | return $this->entityManager->sync($entity, true); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $statement = 'DELETE FROM ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 227 | - 'WHERE ' . implode(' AND ', $where); |
|
| 227 | + 'WHERE ' . implode(' AND ', $where); |
|
| 228 | 228 | $this->entityManager->getConnection()->query($statement); |
| 229 | 229 | |
| 230 | 230 | return true; |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $cols = array_combine($cols, array_map([$this, 'escapeIdentifier'], $cols)); |
| 252 | 252 | |
| 253 | 253 | $statement = 'INSERT INTO ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 254 | - '(' . implode(',', $cols) . ') VALUES '; |
|
| 254 | + '(' . implode(',', $cols) . ') VALUES '; |
|
| 255 | 255 | |
| 256 | 256 | $statement .= implode(',', array_map(function ($values) use ($cols) { |
| 257 | 257 | $result = []; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | public function escapeValue($value) |
| 98 | 98 | { |
| 99 | 99 | $type = is_object($value) ? get_class($value) : gettype($value); |
| 100 | - $method = [ $this, 'escape' . ucfirst($type) ]; |
|
| 100 | + $method = [$this, 'escape' . ucfirst($type)]; |
|
| 101 | 101 | |
| 102 | 102 | if (is_callable($method)) { |
| 103 | 103 | return call_user_func($method, $value); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $var = $entity::getPrimaryKeyVars()[0]; |
| 280 | 280 | $column = $entity::getColumnName($var); |
| 281 | 281 | |
| 282 | - $entity->setOriginalData(array_merge($entity->getData(), [ $column => $value ])); |
|
| 282 | + $entity->setOriginalData(array_merge($entity->getData(), [$column => $value])); |
|
| 283 | 283 | $entity->__set($var, $value); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -297,8 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | $query = "SELECT * FROM " . $this->escapeIdentifier($entity::getTableName()) . " WHERE "; |
| 299 | 299 | $query .= count($cols) > 1 ? |
| 300 | - '(' . implode(',', array_map([$this, 'escapeIdentifier'], $cols)) . ')' : |
|
| 301 | - $this->escapeIdentifier($cols[0]); |
|
| 300 | + '(' . implode(',', array_map([$this, 'escapeIdentifier'], $cols)) . ')' : $this->escapeIdentifier($cols[0]); |
|
| 302 | 301 | $query .= ' IN ('; |
| 303 | 302 | $pKeys = []; |
| 304 | 303 | foreach ($entities as $entity) { |
@@ -384,8 +384,7 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | return $useAutoIncrement && $entity::isAutoIncremented() ? |
| 387 | - $this->getDbal()->insertAndSyncWithAutoInc($entity) : |
|
| 388 | - $this->getDbal()->insertAndSync($entity); |
|
| 387 | + $this->getDbal()->insertAndSyncWithAutoInc($entity) : $this->getDbal()->insertAndSync($entity); |
|
| 389 | 388 | } |
| 390 | 389 | |
| 391 | 390 | /** |
@@ -502,7 +501,7 @@ discard block |
||
| 502 | 501 | } |
| 503 | 502 | |
| 504 | 503 | if (!is_array($primaryKey)) { |
| 505 | - $primaryKey = [ $primaryKey ]; |
|
| 504 | + $primaryKey = [$primaryKey]; |
|
| 506 | 505 | } |
| 507 | 506 | |
| 508 | 507 | /** @noinspection PhpUndefinedMethodInspection */ |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | public function describe($schemaTable) |
| 65 | 65 | { |
| 66 | 66 | $table = explode($this->identifierDivider, $schemaTable); |
| 67 | - list($schema, $table) = count($table) === 2 ? $table : [ 'public', $table[0] ]; |
|
| 67 | + list($schema, $table) = count($table) === 2 ? $table : ['public', $table[0]]; |
|
| 68 | 68 | |
| 69 | 69 | $query = new QueryBuilder('INFORMATION_SCHEMA.COLUMNS', '', $this->entityManager); |
| 70 | 70 | $query->where('table_name', $table)->andWhere('table_schema', $schema); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function ormInitMock($options = [], $driver = 'mysql') |
| 33 | 33 | { |
| 34 | 34 | /** @var EntityManager|m\Mock $em */ |
| 35 | - $em = m::mock(EntityManager::class, [ $options ])->makePartial(); |
|
| 35 | + $em = m::mock(EntityManager::class, [$options])->makePartial(); |
|
| 36 | 36 | /** @var \PDO|m\Mock $pdo */ |
| 37 | 37 | $pdo = m::mock(\PDO::class); |
| 38 | 38 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $em = $em ?: EntityManager::getInstance($class); |
| 139 | 139 | |
| 140 | 140 | /** @var m\Mock|EntityFetcher $fetcher */ |
| 141 | - $fetcher = m::mock(EntityFetcher::class, [ $em, $class ])->makePartial(); |
|
| 141 | + $fetcher = m::mock(EntityFetcher::class, [$em, $class])->makePartial(); |
|
| 142 | 142 | $em->shouldReceive('fetch')->with($class)->once()->andReturn($fetcher); |
| 143 | 143 | |
| 144 | 144 | /** @scrutinizer ignore-call */ |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** {@inheritdoc} */ |
| 39 | 39 | public function fetch(Entity $self, EntityManager $entityManager) |
| 40 | 40 | { |
| 41 | - $key = array_map([$self, '__get' ], array_keys($this->reference)); |
|
| 41 | + $key = array_map([$self, '__get'], array_keys($this->reference)); |
|
| 42 | 42 | |
| 43 | 43 | if (in_array(null, $key)) { |
| 44 | 44 | return null; |
@@ -82,6 +82,6 @@ discard block |
||
| 82 | 82 | $expression[] = $alias . '.' . $myVar . ' = ' . $this->name . '.' . $hisVar; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - call_user_func([ $fetcher, $join ], $this->class, implode(' AND ', $expression), $this->name, [], true); |
|
| 85 | + call_user_func([$fetcher, $join], $this->class, implode(' AND ', $expression), $this->name, [], true); |
|
| 86 | 86 | } |
| 87 | 87 | } |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $this->tableName = $entityManager->escapeIdentifier($class::getTableName()); |
| 63 | 63 | $this->alias = 't0'; |
| 64 | - $this->columns = [ 't0.*' ]; |
|
| 65 | - $this->modifier = [ 'DISTINCT' ]; |
|
| 64 | + $this->columns = ['t0.*']; |
|
| 65 | + $this->modifier = ['DISTINCT']; |
|
| 66 | 66 | |
| 67 | 67 | $this->classMapping['byClass'][$class] = 't0'; |
| 68 | 68 | $this->classMapping['byAlias']['t0'] = $class; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $alias = $this->alias; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - call_user_func([ $class, 'getRelation' ], $relation)->addJoin($this, $join, $alias); |
|
| 186 | + call_user_func([$class, 'getRelation'], $relation)->addJoin($this, $join, $alias); |
|
| 187 | 187 | return $this; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | return null; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - $class = $this->class; |
|
| 233 | + $class = $this->class; |
|
| 234 | 234 | $newEntity = new $class($data, $this->entityManager, true); |
| 235 | 235 | $entity = $this->entityManager->map($newEntity); |
| 236 | 236 | |
@@ -275,11 +275,11 @@ discard block |
||
| 275 | 275 | public function count() |
| 276 | 276 | { |
| 277 | 277 | // set the columns and reset after get query |
| 278 | - $this->columns = [ 'COUNT(DISTINCT t0.*)' ]; |
|
| 278 | + $this->columns = ['COUNT(DISTINCT t0.*)']; |
|
| 279 | 279 | $this->modifier = []; |
| 280 | 280 | $query = $this->getQuery(); |
| 281 | - $this->columns = [ 't0.*' ]; |
|
| 282 | - $this->modifier = [ 'DISTINCT' ]; |
|
| 281 | + $this->columns = ['t0.*']; |
|
| 282 | + $this->modifier = ['DISTINCT']; |
|
| 283 | 283 | |
| 284 | 284 | return (int) $this->entityManager->getConnection()->query($query)->fetchColumn(); |
| 285 | 285 | } |