@@ -118,6 +118,7 @@ |
||
| 118 | 118 | * Add a new cleaner associated to a key. |
| 119 | 119 | * |
| 120 | 120 | * @throws \InvalidArgumentException |
| 121 | + * @param string $name |
|
| 121 | 122 | */ |
| 122 | 123 | public function addCleaner($name, callable $cleaner): self |
| 123 | 124 | { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | /** @var array list of fields, this gives an information if the field |
| 36 | 36 | is mandatory or optional. */ |
| 37 | - protected $fields = []; |
|
| 37 | + protected $fields = []; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * getName |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $this |
| 108 | 108 | ->checkFieldExists($name) |
| 109 | - ->validators[$name][] = $validator |
|
| 109 | + ->validators[$name][] = $validator |
|
| 110 | 110 | ; |
| 111 | 111 | |
| 112 | 112 | return $this; |
@@ -85,11 +85,13 @@ discard block |
||
| 85 | 85 | $this->checkFieldExists($name); |
| 86 | 86 | unset($this->fields[$name]); |
| 87 | 87 | |
| 88 | - if (isset($this->validators[$name])) |
|
| 89 | - unset($this->validators[$name]); |
|
| 88 | + if (isset($this->validators[$name])) { |
|
| 89 | + unset($this->validators[$name]); |
|
| 90 | + } |
|
| 90 | 91 | |
| 91 | - if (isset($this->cleaners[$name])) |
|
| 92 | - unset($this->cleaners[$name]); |
|
| 92 | + if (isset($this->cleaners[$name])) { |
|
| 93 | + unset($this->cleaners[$name]); |
|
| 94 | + } |
|
| 93 | 95 | |
| 94 | 96 | return $this; |
| 95 | 97 | } |
@@ -261,8 +263,9 @@ discard block |
||
| 261 | 263 | ) |
| 262 | 264 | ); |
| 263 | 265 | |
| 264 | - if (count($diff_keys) === 0 || $strategy === self::STRATEGY_ACCEPT_EXTRA_VALUES) |
|
| 265 | - return $values; |
|
| 266 | + if (count($diff_keys) === 0 || $strategy === self::STRATEGY_ACCEPT_EXTRA_VALUES) { |
|
| 267 | + return $values; |
|
| 268 | + } |
|
| 266 | 269 | |
| 267 | 270 | if ($strategy === self::STRATEGY_REFUSE_EXTRA_VALUES) { |
| 268 | 271 | foreach ($diff_keys as $key) { |
@@ -277,8 +280,9 @@ discard block |
||
| 277 | 280 | return $values; |
| 278 | 281 | } |
| 279 | 282 | |
| 280 | - if ($strategy === self::STRATEGY_IGNORE_EXTRA_VALUES) |
|
| 281 | - return array_diff_key($values, array_flip($diff_keys)); |
|
| 283 | + if ($strategy === self::STRATEGY_IGNORE_EXTRA_VALUES) { |
|
| 284 | + return array_diff_key($values, array_flip($diff_keys)); |
|
| 285 | + } |
|
| 282 | 286 | |
| 283 | 287 | throw new \RuntimeException( |
| 284 | 288 | sprintf( |