@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\DBAL; |
6 | 6 |
@@ -104,7 +104,7 @@ |
||
104 | 104 | */ |
105 | 105 | public function fetch($fetchMode = null, $cursorOrientation = \PDO::FETCH_ORI_NEXT, $cursorOffset = 0) |
106 | 106 | { |
107 | - if (! isset($this->data[$this->num])) { |
|
107 | + if ( ! isset($this->data[$this->num])) { |
|
108 | 108 | return false; |
109 | 109 | } |
110 | 110 |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | // also remember all foreign keys that point to a specific table |
108 | 108 | foreach ($table->getForeignKeys() as $foreignKey) { |
109 | 109 | $foreignTable = strtolower($foreignKey->getForeignTableName()); |
110 | - if (!isset($foreignKeysToTable[$foreignTable])) { |
|
110 | + if ( ! isset($foreignKeysToTable[$foreignTable])) { |
|
111 | 111 | $foreignKeysToTable[$foreignTable] = []; |
112 | 112 | } |
113 | 113 | $foreignKeysToTable[$foreignTable][] = $foreignKey; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | /* See if all the fields in table 1 exist in table 2 */ |
219 | 219 | foreach ($table2Columns as $columnName => $column) { |
220 | - if ( !$table1->hasColumn($columnName)) { |
|
220 | + if ( ! $table1->hasColumn($columnName)) { |
|
221 | 221 | $tableDifferences->addedColumns[$columnName] = $column; |
222 | 222 | $changes++; |
223 | 223 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | // Gather possible rename candidates by comparing each added and removed index based on semantics. |
360 | 360 | foreach ($tableDifferences->addedIndexes as $addedIndexName => $addedIndex) { |
361 | 361 | foreach ($tableDifferences->removedIndexes as $removedIndex) { |
362 | - if (! $this->diffIndex($addedIndex, $removedIndex)) { |
|
362 | + if ( ! $this->diffIndex($addedIndex, $removedIndex)) { |
|
363 | 363 | $renameCandidates[$addedIndex->getName()][] = [$removedIndex, $addedIndex, $addedIndexName]; |
364 | 364 | } |
365 | 365 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $removedIndexName = strtolower($removedIndex->getName()); |
377 | 377 | $addedIndexName = strtolower($addedIndex->getName()); |
378 | 378 | |
379 | - if (! isset($tableDifferences->renamedIndexes[$removedIndexName])) { |
|
379 | + if ( ! isset($tableDifferences->renamedIndexes[$removedIndexName])) { |
|
380 | 380 | $tableDifferences->renamedIndexes[$removedIndexName] = $addedIndex; |
381 | 381 | unset( |
382 | 382 | $tableDifferences->addedIndexes[$addedIndexName], |
@@ -182,7 +182,7 @@ |
||
182 | 182 | $foreignKeys = []; |
183 | 183 | |
184 | 184 | foreach ($tableForeignKeys as $tableForeignKey) { |
185 | - if (!isset($foreignKeys[$tableForeignKey['index_name']])) { |
|
185 | + if ( ! isset($foreignKeys[$tableForeignKey['index_name']])) { |
|
186 | 186 | $foreignKeys[$tableForeignKey['index_name']] = [ |
187 | 187 | 'local_columns' => [$tableForeignKey['local_column']], |
188 | 188 | 'foreign_table' => $tableForeignKey['foreign_table'], |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } catch (DBALException $exception) { |
54 | 54 | $exception = $exception->getPrevious(); |
55 | 55 | |
56 | - if (! $exception instanceof DriverException) { |
|
56 | + if ( ! $exception instanceof DriverException) { |
|
57 | 57 | throw $exception; |
58 | 58 | } |
59 | 59 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @license New BSD License |
110 | 110 | * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html |
111 | 111 | */ |
112 | - protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) |
|
112 | + protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) |
|
113 | 113 | { |
114 | 114 | $indexBuffer = []; |
115 | 115 | foreach ($tableIndexes as $tableIndex) { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $list = []; |
262 | 262 | foreach ($tableForeignKeys as $value) { |
263 | 263 | $value = \array_change_key_case($value, CASE_LOWER); |
264 | - if (!isset($list[$value['constraint_name']])) { |
|
264 | + if ( ! isset($list[$value['constraint_name']])) { |
|
265 | 265 | if ($value['delete_rule'] == "NO ACTION") { |
266 | 266 | $value['delete_rule'] = null; |
267 | 267 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $username = $database; |
342 | 342 | $password = $params['password']; |
343 | 343 | |
344 | - $query = 'CREATE USER ' . $username . ' IDENTIFIED BY ' . $password; |
|
344 | + $query = 'CREATE USER ' . $username . ' IDENTIFIED BY ' . $password; |
|
345 | 345 | $this->_conn->executeUpdate($query); |
346 | 346 | |
347 | 347 | $query = 'GRANT DBA TO ' . $username; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param Type $type |
109 | 109 | * @param array $options |
110 | 110 | */ |
111 | - public function __construct($columnName, Type $type, array $options=[]) |
|
111 | + public function __construct($columnName, Type $type, array $options = []) |
|
112 | 112 | { |
113 | 113 | $this->_setName($columnName); |
114 | 114 | $this->setType($type); |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | public function setOptions(array $options) |
124 | 124 | { |
125 | 125 | foreach ($options as $name => $value) { |
126 | - $method = "set".$name; |
|
126 | + $method = "set" . $name; |
|
127 | 127 | if ( ! method_exists($this, $method)) { |
128 | 128 | // next major: throw an exception |
129 | 129 | @trigger_error(sprintf( |
130 | - 'The "%s" column option is not supported,'. |
|
130 | + 'The "%s" column option is not supported,' . |
|
131 | 131 | ' setting it is deprecated and will cause an error in Doctrine 3.0', |
132 | 132 | $name |
133 | 133 | ), E_USER_DEPRECATED); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function setPrecision($precision) |
177 | 177 | { |
178 | - if (!is_numeric($precision)) { |
|
178 | + if ( ! is_numeric($precision)) { |
|
179 | 179 | $precision = 10; // defaults to 10 when no valid precision is given. |
180 | 180 | } |
181 | 181 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function setScale($scale) |
193 | 193 | { |
194 | - if (!is_numeric($scale)) { |
|
194 | + if ( ! is_numeric($scale)) { |
|
195 | 195 | $scale = 0; |
196 | 196 | } |
197 | 197 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function tableDoesNotExist($tableName) |
45 | 45 | { |
46 | - return new self("There is no table with name '".$tableName."' in the schema.", self::TABLE_DOESNT_EXIST); |
|
46 | + return new self("There is no table with name '" . $tableName . "' in the schema.", self::TABLE_DOESNT_EXIST); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public static function tableAlreadyExists($tableName) |
111 | 111 | { |
112 | - return new self("The table with name '".$tableName."' already exists.", self::TABLE_ALREADY_EXISTS); |
|
112 | + return new self("The table with name '" . $tableName . "' already exists.", self::TABLE_ALREADY_EXISTS); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public static function columnAlreadyExists($tableName, $columnName) |
122 | 122 | { |
123 | 123 | return new self( |
124 | - "The column '".$columnName."' on table '".$tableName."' already exists.", self::COLUMN_ALREADY_EXISTS |
|
124 | + "The column '" . $columnName . "' on table '" . $tableName . "' already exists.", self::COLUMN_ALREADY_EXISTS |
|
125 | 125 | ); |
126 | 126 | } |
127 | 127 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public static function sequenceAlreadyExists($sequenceName) |
134 | 134 | { |
135 | - return new self("The sequence '".$sequenceName."' already exists.", self::SEQUENCE_ALREADY_EXISTS); |
|
135 | + return new self("The sequence '" . $sequenceName . "' already exists.", self::SEQUENCE_ALREADY_EXISTS); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public static function sequenceDoesNotExist($sequenceName) |
144 | 144 | { |
145 | - return new self("There exists no sequence with the name '".$sequenceName."'.", self::SEQUENCE_DOENST_EXIST); |
|
145 | + return new self("There exists no sequence with the name '" . $sequenceName . "'.", self::SEQUENCE_DOENST_EXIST); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | public static function namedForeignKeyRequired(Table $localTable, ForeignKeyConstraint $foreignKey) |
166 | 166 | { |
167 | 167 | return new self( |
168 | - "The performed schema operation on ".$localTable->getName()." requires a named foreign key, ". |
|
169 | - "but the given foreign key from (".implode(", ", $foreignKey->getColumns()).") onto foreign table ". |
|
170 | - "'".$foreignKey->getForeignTableName()."' (".implode(", ", $foreignKey->getForeignColumns()).") is currently ". |
|
168 | + "The performed schema operation on " . $localTable->getName() . " requires a named foreign key, " . |
|
169 | + "but the given foreign key from (" . implode(", ", $foreignKey->getColumns()) . ") onto foreign table " . |
|
170 | + "'" . $foreignKey->getForeignTableName() . "' (" . implode(", ", $foreignKey->getForeignColumns()) . ") is currently " . |
|
171 | 171 | "unnamed." |
172 | 172 | ); |
173 | 173 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | { |
64 | 64 | $rows = $this->_conn->fetchAll("SELECT nspname as schema_name FROM pg_namespace WHERE nspname !~ '^pg_.*' and nspname != 'information_schema'"); |
65 | 65 | |
66 | - return array_map(function ($v) { return $v['schema_name']; }, $rows); |
|
66 | + return array_map(function($v) { return $v['schema_name']; }, $rows); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $names = $this->getSchemaNames(); |
114 | 114 | $paths = $this->getSchemaSearchPaths(); |
115 | 115 | |
116 | - $this->existingSchemaPaths = array_filter($paths, function ($v) use ($names) { |
|
116 | + $this->existingSchemaPaths = array_filter($paths, function($v) use ($names) { |
|
117 | 117 | return in_array($v, $names); |
118 | 118 | }); |
119 | 119 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | protected function _getPortableViewDefinition($view) |
189 | 189 | { |
190 | - return new View($view['schemaname'].'.'.$view['viewname'], $view['definition']); |
|
190 | + return new View($view['schemaname'] . '.' . $view['viewname'], $view['definition']); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @license New BSD License |
223 | 223 | * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html |
224 | 224 | */ |
225 | - protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) |
|
225 | + protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) |
|
226 | 226 | { |
227 | 227 | $buffer = []; |
228 | 228 | foreach ($tableIndexes as $row) { |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $buffer[] = [ |
242 | 242 | 'key_name' => $row['relname'], |
243 | 243 | 'column_name' => trim($colRow['attname']), |
244 | - 'non_unique' => !$row['indisunique'], |
|
244 | + 'non_unique' => ! $row['indisunique'], |
|
245 | 245 | 'primary' => $row['indisprimary'], |
246 | 246 | 'where' => $row['where'], |
247 | 247 | ]; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | } |
354 | 354 | $fixed = null; |
355 | 355 | |
356 | - if (!isset($tableColumn['name'])) { |
|
356 | + if ( ! isset($tableColumn['name'])) { |
|
357 | 357 | $tableColumn['name'] = ''; |
358 | 358 | } |
359 | 359 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $jsonb = null; |
363 | 363 | |
364 | 364 | $dbType = strtolower($tableColumn['type']); |
365 | - if (strlen($tableColumn['domain_type']) && !$this->_platform->hasDoctrineTypeMappingFor($tableColumn['type'])) { |
|
365 | + if (strlen($tableColumn['domain_type']) && ! $this->_platform->hasDoctrineTypeMappingFor($tableColumn['type'])) { |
|
366 | 366 | $dbType = strtolower($tableColumn['domain_type']); |
367 | 367 | $tableColumn['complete_type'] = $tableColumn['domain_complete_type']; |
368 | 368 | } |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | |
460 | 460 | $column = new Column($tableColumn['field'], Type::getType($type), $options); |
461 | 461 | |
462 | - if (isset($tableColumn['collation']) && !empty($tableColumn['collation'])) { |
|
462 | + if (isset($tableColumn['collation']) && ! empty($tableColumn['collation'])) { |
|
463 | 463 | $column->setPlatformOption('collation', $tableColumn['collation']); |
464 | 464 | } |
465 | 465 |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @throws DBALException |
93 | 93 | */ |
94 | - public function __construct($tableName, array $columns=[], array $indexes=[], array $fkConstraints=[], $idGeneratorType = 0, array $options=[]) |
|
94 | + public function __construct($tableName, array $columns = [], array $indexes = [], array $fkConstraints = [], $idGeneratorType = 0, array $options = []) |
|
95 | 95 | { |
96 | 96 | if (strlen($tableName) == 0) { |
97 | 97 | throw DBALException::invalidTableName($tableName); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @return Column |
327 | 327 | */ |
328 | - public function addColumn($columnName, $typeName, array $options=[]) |
|
328 | + public function addColumn($columnName, $typeName, array $options = []) |
|
329 | 329 | { |
330 | 330 | $column = new Column($columnName, Type::getType($typeName), $options); |
331 | 331 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | * |
396 | 396 | * @return self |
397 | 397 | */ |
398 | - public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=[], $constraintName = null) |
|
398 | + public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = [], $constraintName = null) |
|
399 | 399 | { |
400 | 400 | $constraintName = $constraintName ?: $this->_generateIdentifierName(array_merge((array) $this->getName(), $localColumnNames), "fk", $this->_getMaxIdentifierLength()); |
401 | 401 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * |
417 | 417 | * @return self |
418 | 418 | */ |
419 | - public function addUnnamedForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=[]) |
|
419 | + public function addUnnamedForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = []) |
|
420 | 420 | { |
421 | 421 | return $this->addForeignKeyConstraint($foreignTable, $localColumnNames, $foreignColumnNames, $options); |
422 | 422 | } |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @throws SchemaException |
438 | 438 | */ |
439 | - public function addNamedForeignKeyConstraint($name, $foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=[]) |
|
439 | + public function addNamedForeignKeyConstraint($name, $foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = []) |
|
440 | 440 | { |
441 | 441 | if ($foreignTable instanceof Table) { |
442 | 442 | foreach ($foreignColumnNames as $columnName) { |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | public function getForeignKey($constraintName) |
599 | 599 | { |
600 | 600 | $constraintName = $this->normalizeIdentifier($constraintName); |
601 | - if (!$this->hasForeignKey($constraintName)) { |
|
601 | + if ( ! $this->hasForeignKey($constraintName)) { |
|
602 | 602 | throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name); |
603 | 603 | } |
604 | 604 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | public function removeForeignKey($constraintName) |
618 | 618 | { |
619 | 619 | $constraintName = $this->normalizeIdentifier($constraintName); |
620 | - if (!$this->hasForeignKey($constraintName)) { |
|
620 | + if ( ! $this->hasForeignKey($constraintName)) { |
|
621 | 621 | throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name); |
622 | 622 | } |
623 | 623 | |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | */ |
660 | 660 | private function filterColumns(array $columnNames) |
661 | 661 | { |
662 | - return array_filter($this->_columns, function ($columnName) use ($columnNames) { |
|
662 | + return array_filter($this->_columns, function($columnName) use ($columnNames) { |
|
663 | 663 | return in_array($columnName, $columnNames, true); |
664 | 664 | }, ARRAY_FILTER_USE_KEY); |
665 | 665 | } |