@@ -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; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function __construct($maxLength = null) |
| 32 | 32 | { |
| 33 | - $this->maxLength = (int)$maxLength; |
|
| 33 | + $this->maxLength = (int) $maxLength; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public static function factory(Dbal $dbal, array $columnDefinition) |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | public function validate($value) |
| 42 | 42 | { |
| 43 | 43 | if (!is_string($value)) { |
| 44 | - return new NoString([ 'type' => $this->type ]); |
|
| 44 | + return new NoString(['type' => $this->type]); |
|
| 45 | 45 | } elseif ($this->maxLength !== 0 && mb_strlen($value) > $this->maxLength) { |
| 46 | - return new TooLong([ 'value' => $value, 'max' => $this->maxLength ]); |
|
| 46 | + return new TooLong(['value' => $value, 'max' => $this->maxLength]); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return true; |
@@ -44,14 +44,14 @@ |
||
| 44 | 44 | if (!is_bool($value)) { |
| 45 | 45 | // convert int to string |
| 46 | 46 | if (is_int($value)) { |
| 47 | - $value = (string)$value; |
|
| 47 | + $value = (string) $value; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | if (!is_string($value) || |
| 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 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | public function validate($value) |
| 17 | 17 | { |
| 18 | 18 | if (!is_int($value) && !is_double($value) && (!is_string($value) || !is_numeric($value))) { |
| 19 | - return new NoNumber([ 'value' => (string)$value ]); |
|
| 19 | + return new NoNumber(['value' => (string) $value]); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | 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); |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | if (!is_string($value)) { |
| 27 | 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; |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | if (is_scalar($values[$attribute]) || is_null($values[$attribute])) { |
| 276 | - return (string)$values[$attribute]; |
|
| 276 | + return (string) $values[$attribute]; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | return $this->arrayToString($values[$attribute], $arrayAccessor, $arrayGlue); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | { |
| 292 | 292 | if (isset($accessor[0])) { |
| 293 | 293 | $from = $accessor[0] === '-' ? |
| 294 | - count($array) - abs($accessor) : (int)$accessor; |
|
| 294 | + count($array) - abs($accessor) : (int) $accessor; |
|
| 295 | 295 | |
| 296 | 296 | if ($from >= count($array)) { |
| 297 | 297 | return ''; |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $statement = 'UPDATE ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 166 | - 'SET ' . implode(',', $set) . ' ' . |
|
| 167 | - 'WHERE ' . implode(' AND ', $where); |
|
| 166 | + 'SET ' . implode(',', $set) . ' ' . |
|
| 167 | + 'WHERE ' . implode(' AND ', $where); |
|
| 168 | 168 | $this->entityManager->getConnection()->query($statement); |
| 169 | 169 | |
| 170 | 170 | return $this->entityManager->sync($entity, true); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $statement = 'DELETE FROM ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 191 | - 'WHERE ' . implode(' AND ', $where); |
|
| 191 | + 'WHERE ' . implode(' AND ', $where); |
|
| 192 | 192 | $this->entityManager->getConnection()->query($statement); |
| 193 | 193 | |
| 194 | 194 | return true; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | }, array_values($data)); |
| 214 | 214 | |
| 215 | 215 | $statement = 'INSERT INTO ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 216 | - '(' . implode(',', $cols) . ') VALUES (' . implode(',', $values) . ')'; |
|
| 216 | + '(' . implode(',', $cols) . ') VALUES (' . implode(',', $values) . ')'; |
|
| 217 | 217 | |
| 218 | 218 | return $statement; |
| 219 | 219 | } |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace ORM; |
| 4 | 4 | |
| 5 | 5 | use Mockery as m; |
| 6 | -use Mockery\Mock; |
|
| 7 | 6 | use ORM\Exception\IncompletePrimaryKey; |
| 8 | 7 | |
| 9 | 8 | trait MockTrait |