@@ -16,7 +16,7 @@ |
||
| 16 | 16 | private $assignments = []; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * @param Column|string $column Column to update (or Column name) |
|
| 19 | + * @param Column $column Column to update (or Column name) |
|
| 20 | 20 | * @param mixed $value value to apply |
| 21 | 21 | * |
| 22 | 22 | * @return $this |
@@ -2,9 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace mindplay\sql\model; |
| 4 | 4 | |
| 5 | -use mindplay\sql\framework\Driver; |
|
| 6 | -use mindplay\sql\framework\TypeProvider; |
|
| 7 | - |
|
| 8 | 5 | /** |
| 9 | 6 | * This class represents an UPDATE query. |
| 10 | 7 | */ |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | */ |
| 80 | 80 | public function fetch() |
| 81 | 81 | { |
| 82 | - if (! $this->executed) { |
|
| 82 | + if (!$this->executed) { |
|
| 83 | 83 | $this->execute(); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | throw new LogicException("unhandled Exception during transaction", 0, $exception); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if (! is_bool($commit)) { |
|
| 138 | + if (!is_bool($commit)) { |
|
| 139 | 139 | throw new UnexpectedValueException("\$func must return TRUE (to commit) or FALSE (to roll back)"); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $replace_pairs[":{$name}"] = count($value) === 0 |
| 176 | 176 | ? "(null)" // empty set |
| 177 | - : "(" . implode(', ', array_map(function ($i) use ($name) { |
|
| 177 | + : "(" . implode(', ', array_map(function($i) use ($name) { |
|
| 178 | 178 | return ":{$name}_{$i}"; |
| 179 | 179 | }, range(1, count($value)))) . ")"; |
| 180 | 180 | } |
@@ -61,12 +61,12 @@ |
||
| 61 | 61 | foreach ($value as $item) { |
| 62 | 62 | $item_type = gettype($item); |
| 63 | 63 | |
| 64 | - if (! isset($SCALAR_TYPES[$item_type])) { |
|
| 64 | + if (!isset($SCALAR_TYPES[$item_type])) { |
|
| 65 | 65 | throw new UnexpectedValueException("unexpected item type in array: {$item_type}"); |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | } else { |
| 69 | - if (! isset($SCALAR_TYPES[$value_type])) { |
|
| 69 | + if (!isset($SCALAR_TYPES[$value_type])) { |
|
| 70 | 70 | throw new UnexpectedValueException("unexpected value type: {$value_type}"); |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -35,13 +35,13 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function getSchema($schema) |
| 37 | 37 | { |
| 38 | - if (! $this->container->has($schema)) { |
|
| 38 | + if (!$this->container->has($schema)) { |
|
| 39 | 39 | $this->container->register($schema); // auto-wiring (for Schema with no special constructor dependencies) |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $schema = $this->container->get($schema); |
| 43 | 43 | |
| 44 | - if (! $schema instanceof Schema) { |
|
| 44 | + if (!$schema instanceof Schema) { |
|
| 45 | 45 | $class_name = get_class($schema); |
| 46 | 46 | |
| 47 | 47 | throw new UnexpectedValueException("{$class_name} does not extend the Schema class"); |
@@ -33,13 +33,13 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function getType($type) |
| 35 | 35 | { |
| 36 | - if (! $this->has($type)) { |
|
| 36 | + if (!$this->has($type)) { |
|
| 37 | 37 | $this->register($type); // auto-wiring (for Types with no special constructor dependencies) |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $type = $this->get($type); |
| 41 | 41 | |
| 42 | - if (! $type instanceof Type) { |
|
| 42 | + if (!$type instanceof Type) { |
|
| 43 | 43 | $class_name = get_class($type); |
| 44 | 44 | |
| 45 | 45 | throw new UnexpectedValueException("{$class_name} does not implement the Type interface"); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $columns = array_filter( |
| 90 | 90 | $this->table->listColumns(), |
| 91 | - function (Column $column) { |
|
| 91 | + function(Column $column) { |
|
| 92 | 92 | return $column->isAuto() === false; |
| 93 | 93 | } |
| 94 | 94 | ); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $quoted_column_names = implode( |
| 97 | 97 | ", ", |
| 98 | 98 | array_map( |
| 99 | - function (Column $column) { |
|
| 99 | + function(Column $column) { |
|
| 100 | 100 | return $this->driver->quoteName($column->getName()); |
| 101 | 101 | }, |
| 102 | 102 | $columns |
@@ -35,12 +35,12 @@ |
||
| 35 | 35 | public function map(array $record_set) |
| 36 | 36 | { |
| 37 | 37 | foreach ($record_set as $index => &$record) { |
| 38 | - if (! is_array($record)) { |
|
| 38 | + if (!is_array($record)) { |
|
| 39 | 39 | throw new UnexpectedValueException("unexpected record type: " . gettype($record)); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | foreach ($this->types as $name => $type) { |
| 43 | - if (! array_key_exists($name, $record)) { |
|
| 43 | + if (!array_key_exists($name, $record)) { |
|
| 44 | 44 | throw new OutOfBoundsException("undefined record field: {$name}"); |
| 45 | 45 | } |
| 46 | 46 | |