@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @param string $path The path to current parameters for nested objects. |
| 155 | 155 | * @return Schema Returns the current instance for fluent calls. |
| 156 | 156 | */ |
| 157 | - protected function filterData(array &$data, array $schema, Validation &$validation, $path = '') { |
|
| 157 | + protected function filterData(array &$data, array $schema, Validation & $validation, $path = '') { |
|
| 158 | 158 | foreach ($data as $key => $val) { |
| 159 | 159 | if (array_key_exists($key, $schema)) { |
| 160 | 160 | continue; |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * @return Schema Returns `$this` for fluent calls. |
| 356 | 356 | */ |
| 357 | 357 | public function requireOneOf(array $fieldnames, $count = 1) { |
| 358 | - $result = $this->addValidator('*', function ($data, Validation $validation) use ($fieldnames, $count) { |
|
| 358 | + $result = $this->addValidator('*', function($data, Validation $validation) use ($fieldnames, $count) { |
|
| 359 | 359 | $hasCount = 0; |
| 360 | 360 | $flattened = []; |
| 361 | 361 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - $messageFields = array_map(function ($v) { |
|
| 387 | + $messageFields = array_map(function($v) { |
|
| 388 | 388 | if (is_array($v)) { |
| 389 | 389 | return '('.implode(', ', $v).')'; |
| 390 | 390 | } |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | * @return bool Returns true if the data is valid, false otherwise. |
| 415 | 415 | * @throws ValidationException Throws an exception when the data does not validate against the schema. |
| 416 | 416 | */ |
| 417 | - public function validate(array &$data, Validation &$validation = null) { |
|
| 417 | + public function validate(array &$data, Validation & $validation = null) { |
|
| 418 | 418 | if (!$this->isValidInternal($data, $this->schema, $validation, '')) { |
| 419 | 419 | if ($validation === null) { |
| 420 | 420 | // Although this should never be null, scrutinizer complains that it might be. |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | * @param Validation &$validation This argument will be filled with the validation result. |
| 434 | 434 | * @return bool Returns true if the data is valid. False otherwise. |
| 435 | 435 | */ |
| 436 | - public function isValid(array &$data, Validation &$validation = null) { |
|
| 436 | + public function isValid(array &$data, Validation & $validation = null) { |
|
| 437 | 437 | return $this->isValidInternal($data, $this->schema, $validation, ''); |
| 438 | 438 | } |
| 439 | 439 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | * @param string $path The path to the current path for nested objects. |
| 447 | 447 | * @return bool Returns true if the data is valid. False otherwise. |
| 448 | 448 | */ |
| 449 | - protected function isValidInternal(array &$data, array $schema, Validation &$validation = null, $path = '') { |
|
| 449 | + protected function isValidInternal(array &$data, array $schema, Validation & $validation = null, $path = '') { |
|
| 450 | 450 | if ($validation === null) { |
| 451 | 451 | $validation = new Validation(); |
| 452 | 452 | } |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | } else { |
| 684 | 684 | $bools = [ |
| 685 | 685 | '0' => false, 'false' => false, 'no' => false, 'off' => false, |
| 686 | - '1' => true, 'true' => true, 'yes' => true, 'on' => true |
|
| 686 | + '1' => true, 'true' => true, 'yes' => true, 'on' => true |
|
| 687 | 687 | ]; |
| 688 | 688 | if ((is_string($value) || is_numeric($value)) && isset($bools[$value])) { |
| 689 | 689 | $value = $bools[$value]; |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if ($type === Db::INDEX_PK || array_diff($index['columns'], $columns) == []) { |
| 155 | - $currentIndex =& $this->indexes[$i]; |
|
| 155 | + $currentIndex = & $this->indexes[$i]; |
|
| 156 | 156 | break; |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $this->px = $px; |
| 139 | 139 | |
| 140 | 140 | $fetchMode = $this->pdo->getAttribute(PDO::ATTR_DEFAULT_FETCH_MODE); |
| 141 | - $this->setDefaultFetchMode($fetchMode === PDO::FETCH_BOTH ? PDO::FETCH_ASSOC: $fetchMode); |
|
| 141 | + $this->setDefaultFetchMode($fetchMode === PDO::FETCH_BOTH ? PDO::FETCH_ASSOC : $fetchMode); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | if (!empty($row['enum'])) { |
| 371 | 371 | $enum = explode(',', $brackets); |
| 372 | - $schema['enum'] = array_map(function ($str) { |
|
| 372 | + $schema['enum'] = array_map(function($str) { |
|
| 373 | 373 | return trim($str, "'\" \t\n\r\0\x0B"); |
| 374 | 374 | }, $enum); |
| 375 | 375 | } |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | } |
| 400 | 400 | $dbtype .= ')'; |
| 401 | 401 | } elseif (!empty($typeDef['enum'])) { |
| 402 | - $parts = array_map(function ($str) { |
|
| 402 | + $parts = array_map(function($str) { |
|
| 403 | 403 | return "'{$str}'"; |
| 404 | 404 | }, $typeDef['enum']); |
| 405 | 405 | $dbtype .= '('.implode(',', $parts).')'; |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $newColumns = (array)$tableDef['columns']; |
| 450 | 450 | |
| 451 | 451 | $alterDef['add']['columns'] = array_diff_key($newColumns, $curColumns); |
| 452 | - $alterDef['alter']['columns'] = array_uintersect_assoc($newColumns, $curColumns, function ($new, $curr) { |
|
| 452 | + $alterDef['alter']['columns'] = array_uintersect_assoc($newColumns, $curColumns, function($new, $curr) { |
|
| 453 | 453 | $search = ['dbtype', 'allowNull', 'default']; |
| 454 | 454 | foreach ($search as $key) { |
| 455 | 455 | if (self::val($key, $curr) !== self::val($key, $new)) { |
@@ -445,7 +445,7 @@ |
||
| 445 | 445 | )->fetchAll(PDO::FETCH_COLUMN); |
| 446 | 446 | |
| 447 | 447 | // Remove internal tables. |
| 448 | - $tables = array_filter($tables, function ($name) { |
|
| 448 | + $tables = array_filter($tables, function($name) { |
|
| 449 | 449 | return substr($name, 0, 7) !== 'sqlite_'; |
| 450 | 450 | }); |
| 451 | 451 | |