@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | * |
| 389 | 389 | * @param Entity $entity |
| 390 | 390 | * @param bool $useAutoIncrement |
| 391 | - * @return mixed |
|
| 391 | + * @return boolean |
|
| 392 | 392 | * @internal |
| 393 | 393 | */ |
| 394 | 394 | public function insert(Entity $entity, $useAutoIncrement = true) |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | * |
| 462 | 462 | * Without $primaryKey it creates an entityFetcher and returns this. |
| 463 | 463 | * |
| 464 | - * @param string|Entity $class The entity class you want to fetch |
|
| 464 | + * @param string $class The entity class you want to fetch |
|
| 465 | 465 | * @param mixed $primaryKey The primary key of the entity you want to fetch |
| 466 | 466 | * @return Entity|EntityFetcher |
| 467 | 467 | * @throws IncompletePrimaryKey |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | * Get the table name for $reflection |
| 77 | 77 | * |
| 78 | 78 | * @param ReflectionClass $reflection |
| 79 | - * @param null $template |
|
| 80 | - * @param null $namingScheme |
|
| 79 | + * @param string $template |
|
| 80 | + * @param string $namingScheme |
|
| 81 | 81 | * @return string |
| 82 | 82 | */ |
| 83 | 83 | public function getTableName(ReflectionClass $reflection, $template = null, $namingScheme = null) |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * Get the column name with $namingScheme or default naming scheme |
| 104 | 104 | * |
| 105 | - * @param $field |
|
| 106 | - * @param null $namingScheme |
|
| 105 | + * @param string $field |
|
| 106 | + * @param string $namingScheme |
|
| 107 | 107 | * @return string |
| 108 | 108 | */ |
| 109 | 109 | public function getColumnName($field, $namingScheme = null) |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | /** |
| 119 | 119 | * Get the column name with $namingScheme or default naming scheme |
| 120 | 120 | * |
| 121 | - * @param $name |
|
| 122 | - * @param null $namingScheme |
|
| 121 | + * @param string $name |
|
| 122 | + * @param string $namingScheme |
|
| 123 | 123 | * @return string |
| 124 | 124 | */ |
| 125 | 125 | public function getMethodName($name, $namingScheme = null) |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | if (is_scalar($values[$var]) || is_null($values[$var])) { |
| 169 | - return (string)$values[$var]; |
|
| 169 | + return (string) $values[$var]; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // otherwise we assume it is an array |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | if (isset($arrayAccessor[0])) { |
| 176 | 176 | $from = $arrayAccessor[0] === '-' ? |
| 177 | - count($array) - abs($arrayAccessor) : (int)$arrayAccessor; |
|
| 177 | + count($array) - abs($arrayAccessor) : (int) $arrayAccessor; |
|
| 178 | 178 | |
| 179 | 179 | if ($from >= count($array)) { |
| 180 | 180 | return ''; |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $statement = 'UPDATE ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 145 | - 'SET ' . implode(',', $set) . ' ' . |
|
| 146 | - 'WHERE ' . implode(' AND ', $where); |
|
| 145 | + 'SET ' . implode(',', $set) . ' ' . |
|
| 146 | + 'WHERE ' . implode(' AND ', $where); |
|
| 147 | 147 | $this->entityManager->getConnection()->query($statement); |
| 148 | 148 | |
| 149 | 149 | return true; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $statement = 'DELETE FROM ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 170 | - 'WHERE ' . implode(' AND ', $where); |
|
| 170 | + 'WHERE ' . implode(' AND ', $where); |
|
| 171 | 171 | $this->entityManager->getConnection()->query($statement); |
| 172 | 172 | |
| 173 | 173 | return true; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | }, array_values($data)); |
| 257 | 257 | |
| 258 | 258 | $statement = 'INSERT INTO ' . $this->escapeIdentifier($entity::getTableName()) . ' ' . |
| 259 | - '(' . implode(',', $cols) . ') VALUES (' . implode(',', $values) . ')'; |
|
| 259 | + '(' . implode(',', $cols) . ') VALUES (' . implode(',', $values) . ')'; |
|
| 260 | 260 | |
| 261 | 261 | return $statement; |
| 262 | 262 | } |
@@ -91,8 +91,7 @@ |
||
| 91 | 91 | |
| 92 | 92 | $definition['column_name'] = $rawColumn['Field']; |
| 93 | 93 | $definition['is_nullable'] = $rawColumn['Null'] === 'YES'; |
| 94 | - $definition['column_default'] = $rawColumn['Default'] !== null ? $rawColumn['Default'] : |
|
| 95 | - ($rawColumn['Extra'] === 'auto_increment' ? 'sequence(AUTO_INCREMENT)' : null); |
|
| 94 | + $definition['column_default'] = $rawColumn['Default'] !== null ? $rawColumn['Default'] : ($rawColumn['Extra'] === 'auto_increment' ? 'sequence(AUTO_INCREMENT)' : null); |
|
| 96 | 95 | $definition['character_maximum_length'] = null; |
| 97 | 96 | $definition['datetime_precision'] = null; |
| 98 | 97 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $this->message = $template->substitute( |
| 37 | 37 | $message ? $message : $this->message, |
| 38 | 38 | [ |
| 39 | - 'value' => (string)$value, |
|
| 39 | + 'value' => (string) $value, |
|
| 40 | 40 | 'column' => $column->name, |
| 41 | 41 | 'type' => get_class($column->type) |
| 42 | 42 | ] |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | $result = $this->entityManager->getConnection()->query($query->getQuery()); |
| 73 | 73 | $rawColumns = $result->fetchAll(PDO::FETCH_ASSOC); |
| 74 | 74 | if (count($rawColumns) === 0) { |
| 75 | - throw new Exception('Unknown table ' . $schemaTable); |
|
| 75 | + throw new Exception('Unknown table ' . $schemaTable); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $cols = array_map(function ($columnDefinition) { |