@@ -18,12 +18,12 @@ |
||
| 18 | 18 | public function validate($value) |
| 19 | 19 | { |
| 20 | 20 | if (!is_string($value)) { |
| 21 | - return new NoString([ 'type' => 'set' ]); |
|
| 21 | + return new NoString(['type' => 'set']); |
|
| 22 | 22 | } else { |
| 23 | 23 | $values = explode(',', $value); |
| 24 | 24 | foreach ($values as $value) { |
| 25 | 25 | if (!in_array($value, $this->allowedValues)) { |
| 26 | - return new NotAllowed([ 'value' => $value, 'type' => 'set' ]); |
|
| 26 | + return new NotAllowed(['value' => $value, 'type' => 'set']); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | public function validate($value) |
| 42 | 42 | { |
| 43 | 43 | if (!is_string($value)) { |
| 44 | - return new NoString([ 'type' => 'enum' ]); |
|
| 44 | + return new NoString(['type' => 'enum']); |
|
| 45 | 45 | } elseif (!in_array($value, $this->allowedValues)) { |
| 46 | - return new NotAllowed([ 'value' => $value, 'type' => 'enum' ]); |
|
| 46 | + return new NotAllowed(['value' => $value, 'type' => 'enum']); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return true; |
@@ -575,7 +575,7 @@ |
||
| 575 | 575 | if (!empty($attribute)) { |
| 576 | 576 | $col = static::getColumnName($attribute); |
| 577 | 577 | return (isset($this->data[$col]) ? $this->data[$col] : null) !== |
| 578 | - (isset($this->originalData[$col]) ? $this->originalData[$col] : null); |
|
| 578 | + (isset($this->originalData[$col]) ? $this->originalData[$col] : null); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | ksort($this->data); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public static function getPrimaryKeyVars() |
| 174 | 174 | { |
| 175 | - return !is_array(static::$primaryKey) ? [ static::$primaryKey ] : static::$primaryKey; |
|
| 175 | + return !is_array(static::$primaryKey) ? [static::$primaryKey] : static::$primaryKey; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $em = EM::getInstance(static::class); |
| 317 | 317 | $getter = $em->getNamer()->getMethodName('get' . ucfirst($attribute), self::$namingSchemeMethods); |
| 318 | 318 | |
| 319 | - if (method_exists($this, $getter) && is_callable([ $this, $getter ])) { |
|
| 319 | + if (method_exists($this, $getter) && is_callable([$this, $getter])) { |
|
| 320 | 320 | return $this->$getter(); |
| 321 | 321 | } else { |
| 322 | 322 | $col = static::getColumnName($attribute); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $em = EM::getInstance(static::class); |
| 354 | 354 | $setter = $em->getNamer()->getMethodName('set' . ucfirst($attribute), self::$namingSchemeMethods); |
| 355 | 355 | |
| 356 | - if (method_exists($this, $setter) && is_callable([ $this, $setter ])) { |
|
| 356 | + if (method_exists($this, $setter) && is_callable([$this, $setter])) { |
|
| 357 | 357 | $oldValue = $this->__get($attribute); |
| 358 | 358 | $md5OldData = md5(serialize($this->data)); |
| 359 | 359 | $this->$setter($value); |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | */ |
| 770 | 770 | public function serialize() |
| 771 | 771 | { |
| 772 | - return serialize([ $this->data, $this->relatedObjects ]); |
|
| 772 | + return serialize([$this->data, $this->relatedObjects]); |
|
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | /** |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $this->tableName = $entityManager->escapeIdentifier($class::getTableName()); |
| 65 | 65 | $this->alias = 't0'; |
| 66 | - $this->columns = [ 't0.*' ]; |
|
| 67 | - $this->modifier = [ 'DISTINCT' ]; |
|
| 66 | + $this->columns = ['t0.*']; |
|
| 67 | + $this->modifier = ['DISTINCT']; |
|
| 68 | 68 | |
| 69 | 69 | $this->classMapping['byClass'][$class] = 't0'; |
| 70 | 70 | $this->classMapping['byAlias']['t0'] = $class; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $alias = $this->alias; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - call_user_func([ $class, 'getRelation' ], $relation)->addJoin($this, $join, $alias); |
|
| 194 | + call_user_func([$class, 'getRelation'], $relation)->addJoin($this, $join, $alias); |
|
| 195 | 195 | return $this; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -289,11 +289,11 @@ discard block |
||
| 289 | 289 | public function count() |
| 290 | 290 | { |
| 291 | 291 | // set the columns and reset after get query |
| 292 | - $this->columns = [ 'COUNT(DISTINCT t0.*)' ]; |
|
| 292 | + $this->columns = ['COUNT(DISTINCT t0.*)']; |
|
| 293 | 293 | $this->modifier = []; |
| 294 | 294 | $query = $this->getQuery(); |
| 295 | - $this->columns = [ 't0.*' ]; |
|
| 296 | - $this->modifier = [ 'DISTINCT' ]; |
|
| 295 | + $this->columns = ['t0.*']; |
|
| 296 | + $this->modifier = ['DISTINCT']; |
|
| 297 | 297 | |
| 298 | 298 | return (int) $this->entityManager->getConnection()->query($query)->fetchColumn(); |
| 299 | 299 | } |
@@ -305,7 +305,7 @@ |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | $array = substr($accessor, -1) === '*' ? |
| 308 | - array_slice($array, $from) : [ $array[$from] ]; |
|
| 308 | + array_slice($array, $from) : [$array[$from]]; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | return implode($glue, $array); |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function __construct(Column $column) |
| 21 | 21 | { |
| 22 | - parent::__construct([ 'column' => $column->name ]); |
|
| 22 | + parent::__construct(['column' => $column->name]); |
|
| 23 | 23 | } |
| 24 | 24 | } |
@@ -24,9 +24,9 @@ |
||
| 24 | 24 | public function validate($value) |
| 25 | 25 | { |
| 26 | 26 | if (!is_string($value)) { |
| 27 | - return new NoString([ 'type' => 'json' ]); |
|
| 27 | + return new NoString(['type' => 'json']); |
|
| 28 | 28 | } elseif ($value !== 'null' && json_decode($value) === null) { |
| 29 | - return new InvalidJson([ 'value' => (string) $value ]); |
|
| 29 | + return new InvalidJson(['value' => (string) $value]); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | return true; |
@@ -48,9 +48,9 @@ |
||
| 48 | 48 | public function validate($value) |
| 49 | 49 | { |
| 50 | 50 | if (!is_string($value)) { |
| 51 | - return new NoString([ 'type' => $this->type ]); |
|
| 51 | + return new NoString(['type' => $this->type]); |
|
| 52 | 52 | } elseif ($this->maxLength !== 0 && mb_strlen($value) > $this->maxLength) { |
| 53 | - return new TooLong([ 'value' => $value, 'max' => $this->maxLength ]); |
|
| 53 | + return new TooLong(['value' => $value, 'max' => $this->maxLength]); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return true; |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | ($value !== $this->getBoolean(true) && $value !== $this->getBoolean(false)) |
| 52 | 52 | ) { |
| 53 | 53 | // value is not boolean, not int and (not string OR string value for boolean) |
| 54 | - return new NoBoolean([ 'value' => (string) $value ]); |
|
| 54 | + return new NoBoolean(['value' => (string) $value]); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |