@@ -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 | } |
@@ -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 | /** |
@@ -501,7 +500,7 @@ discard block |
||
| 501 | 500 | return new EntityFetcher($this, $class); |
| 502 | 501 | } |
| 503 | 502 | |
| 504 | - $primaryKey = $this::buildPrimaryKey($class, (array)$primaryKey); |
|
| 503 | + $primaryKey = $this::buildPrimaryKey($class, (array) $primaryKey); |
|
| 505 | 504 | $checksum = $this::buildChecksum($primaryKey); |
| 506 | 505 | |
| 507 | 506 | if (isset($this->map[$class][$checksum])) { |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | return new EntityFetcherMock($this, $class); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - $primaryKey = $this->buildPrimaryKey($class, (array)$primaryKey); |
|
| 23 | + $primaryKey = $this->buildPrimaryKey($class, (array) $primaryKey); |
|
| 24 | 24 | $checksum = $this->buildChecksum($primaryKey); |
| 25 | 25 | |
| 26 | 26 | if (isset($this->map[$class][$checksum])) { |
@@ -176,7 +176,7 @@ |
||
| 176 | 176 | $em = $this->ormGetEntityManagerInstance($class); |
| 177 | 177 | |
| 178 | 178 | /** @var m\MockInterface|EntityFetcher $fetcher */ |
| 179 | - $fetcher = m::mock(EntityFetcher::class, [ $em, $class ])->makePartial(); |
|
| 179 | + $fetcher = m::mock(EntityFetcher::class, [$em, $class])->makePartial(); |
|
| 180 | 180 | $expectation = $em->shouldReceive('fetch')->with($class)->andReturn($fetcher); |
| 181 | 181 | |
| 182 | 182 | $fetcher->shouldReceive('count')->with()->andReturn(count($entities))->byDefault(); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | protected static function getRegisteredType(array $columnDefinition) |
| 42 | 42 | { |
| 43 | 43 | foreach (self::$registeredTypes as $class) { |
| 44 | - if (call_user_func([ $class, 'fits' ], $columnDefinition)) { |
|
| 44 | + if (call_user_func([$class, 'fits'], $columnDefinition)) { |
|
| 45 | 45 | return $class; |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -114,8 +114,7 @@ discard block |
||
| 114 | 114 | public function __get($name) |
| 115 | 115 | { |
| 116 | 116 | $method = [$this, 'get' . ucfirst($name)]; |
| 117 | - return is_callable($method) ? call_user_func($method) : |
|
| 118 | - (isset($this->columnDefinition[$name]) ? $this->columnDefinition[$name] : null); |
|
| 117 | + return is_callable($method) ? call_user_func($method) : (isset($this->columnDefinition[$name]) ? $this->columnDefinition[$name] : null); |
|
| 119 | 118 | } |
| 120 | 119 | |
| 121 | 120 | /** |
@@ -183,11 +182,11 @@ discard block |
||
| 183 | 182 | $class = $this->columnDefinition['type']; |
| 184 | 183 | } |
| 185 | 184 | |
| 186 | - if ($class === null || !is_callable([ $class, 'factory' ])) { |
|
| 185 | + if ($class === null || !is_callable([$class, 'factory'])) { |
|
| 187 | 186 | $class = Type\Text::class; |
| 188 | 187 | } |
| 189 | 188 | |
| 190 | - $this->type = call_user_func([ $class, 'factory' ], $this->dbal, $this->columnDefinition); |
|
| 189 | + $this->type = call_user_func([$class, 'factory'], $this->dbal, $this->columnDefinition); |
|
| 191 | 190 | } |
| 192 | 191 | |
| 193 | 192 | return $this->type; |