@@ -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; |
@@ -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 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | public function validate($value) |
| 24 | 24 | { |
| 25 | 25 | if (!is_int($value) && !is_double($value) && (!is_string($value) || !is_numeric($value))) { |
| 26 | - return new NoNumber([ 'value' => (string) $value ]); |
|
| 26 | + return new NoNumber(['value' => (string) $value]); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | return true; |
@@ -35,8 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $this->precision = (int) $precision; |
| 37 | 37 | $this->regex = $dateOnly ? |
| 38 | - '/^' . self::DATE_REGEX . '([ T]' . self::TIME_REGEX . self::ZONE_REGEX . ')?$/' : |
|
| 39 | - '/^' . self::DATE_REGEX . '[ T]' . self::TIME_REGEX . self::ZONE_REGEX . '$/'; |
|
| 38 | + '/^' . self::DATE_REGEX . '([ T]' . self::TIME_REGEX . self::ZONE_REGEX . ')?$/' : '/^' . self::DATE_REGEX . '[ T]' . self::TIME_REGEX . self::ZONE_REGEX . '$/'; |
|
| 40 | 39 | } |
| 41 | 40 | |
| 42 | 41 | public static function factory(Dbal $dbal, array $columnDefinition) |
@@ -56,7 +55,7 @@ discard block |
||
| 56 | 55 | public function validate($value) |
| 57 | 56 | { |
| 58 | 57 | if (!$value instanceof \DateTime && (!is_string($value) || !preg_match($this->regex, $value))) { |
| 59 | - return new NoDateTime([ 'value' => (string) $value ]); |
|
| 58 | + return new NoDateTime(['value' => (string) $value]); |
|
| 60 | 59 | } |
| 61 | 60 | |
| 62 | 61 | return true; |