@@ -1630,6 +1630,7 @@ |
||
1630 | 1630 | * {@inheritdoc} |
1631 | 1631 | * |
1632 | 1632 | * Modifies column declaration order as it differs in Microsoft SQL Server. |
1633 | + * @param string $name |
|
1633 | 1634 | */ |
1634 | 1635 | public function getColumnDeclarationSQL($name, array $field) |
1635 | 1636 | { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $factorClause = '-1 * '; |
106 | 106 | } |
107 | 107 | |
108 | - return 'DATEADD(' . $unit . ', ' . $factorClause . $interval . ', ' . $date . ')'; |
|
108 | + return 'DATEADD('.$unit.', '.$factorClause.$interval.', '.$date.')'; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getDateDiffExpression($date1, $date2) |
115 | 115 | { |
116 | - return 'DATEDIFF(day, ' . $date2 . ',' . $date1 . ')'; |
|
116 | + return 'DATEDIFF(day, '.$date2.','.$date1.')'; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function getCreateDatabaseSQL($name) |
184 | 184 | { |
185 | - return 'CREATE DATABASE ' . $name; |
|
185 | + return 'CREATE DATABASE '.$name; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function getDropDatabaseSQL($name) |
192 | 192 | { |
193 | - return 'DROP DATABASE ' . $name; |
|
193 | + return 'DROP DATABASE '.$name; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function getCreateSchemaSQL($schemaName) |
208 | 208 | { |
209 | - return 'CREATE SCHEMA ' . $schemaName; |
|
209 | + return 'CREATE SCHEMA '.$schemaName; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -214,18 +214,18 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function getDropForeignKeySQL($foreignKey, $table) |
216 | 216 | { |
217 | - if (! $foreignKey instanceof ForeignKeyConstraint) { |
|
217 | + if (!$foreignKey instanceof ForeignKeyConstraint) { |
|
218 | 218 | $foreignKey = new Identifier($foreignKey); |
219 | 219 | } |
220 | 220 | |
221 | - if (! $table instanceof Table) { |
|
221 | + if (!$table instanceof Table) { |
|
222 | 222 | $table = new Identifier($table); |
223 | 223 | } |
224 | 224 | |
225 | 225 | $foreignKey = $foreignKey->getQuotedName($this); |
226 | 226 | $table = $table->getQuotedName($this); |
227 | 227 | |
228 | - return 'ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $foreignKey; |
|
228 | + return 'ALTER TABLE '.$table.' DROP CONSTRAINT '.$foreignKey; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | if (!isset($table)) { |
243 | - return 'DROP INDEX ' . $index; |
|
243 | + return 'DROP INDEX '.$index; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | if ($table instanceof Table) { |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | } |
249 | 249 | |
250 | 250 | return "IF EXISTS (SELECT * FROM sysobjects WHERE name = '$index') |
251 | - ALTER TABLE " . $table . " DROP CONSTRAINT " . $index . " |
|
251 | + ALTER TABLE ".$table." DROP CONSTRAINT ".$index." |
|
252 | 252 | ELSE |
253 | - DROP INDEX " . $index . " ON " . $table; |
|
253 | + DROP INDEX " . $index." ON ".$table; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | |
271 | 271 | // Build default constraints SQL statements. |
272 | 272 | if (isset($column['default'])) { |
273 | - $defaultConstraintsSql[] = 'ALTER TABLE ' . $tableName . |
|
274 | - ' ADD' . $this->getDefaultConstraintDeclarationSQL($tableName, $column); |
|
273 | + $defaultConstraintsSql[] = 'ALTER TABLE '.$tableName. |
|
274 | + ' ADD'.$this->getDefaultConstraintDeclarationSQL($tableName, $column); |
|
275 | 275 | } |
276 | 276 | |
277 | - if ( ! empty($column['comment']) || is_numeric($column['comment'])) { |
|
277 | + if (!empty($column['comment']) || is_numeric($column['comment'])) { |
|
278 | 278 | $commentsSql[] = $this->getCreateColumnCommentSQL($tableName, $column['name'], $column['comment']); |
279 | 279 | } |
280 | 280 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | if (isset($options['uniqueConstraints']) && !empty($options['uniqueConstraints'])) { |
285 | 285 | foreach ($options['uniqueConstraints'] as $name => $definition) { |
286 | - $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition); |
|
286 | + $columnListSql .= ', '.$this->getUniqueConstraintDeclarationSQL($name, $definition); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
@@ -292,14 +292,14 @@ discard block |
||
292 | 292 | if (isset($options['primary_index']) && $options['primary_index']->hasFlag('nonclustered')) { |
293 | 293 | $flags = ' NONCLUSTERED'; |
294 | 294 | } |
295 | - $columnListSql .= ', PRIMARY KEY' . $flags . ' (' . implode(', ', array_unique(array_values($options['primary']))) . ')'; |
|
295 | + $columnListSql .= ', PRIMARY KEY'.$flags.' ('.implode(', ', array_unique(array_values($options['primary']))).')'; |
|
296 | 296 | } |
297 | 297 | |
298 | - $query = 'CREATE TABLE ' . $tableName . ' (' . $columnListSql; |
|
298 | + $query = 'CREATE TABLE '.$tableName.' ('.$columnListSql; |
|
299 | 299 | |
300 | 300 | $check = $this->getCheckDeclarationSQL($columns); |
301 | 301 | if (!empty($check)) { |
302 | - $query .= ', ' . $check; |
|
302 | + $query .= ', '.$check; |
|
303 | 303 | } |
304 | 304 | $query .= ')'; |
305 | 305 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $flags = ' NONCLUSTERED'; |
331 | 331 | } |
332 | 332 | |
333 | - return 'ALTER TABLE ' . $table . ' ADD PRIMARY KEY' . $flags . ' (' . $this->getIndexFieldDeclarationListSQL($index->getQuotedColumns($this)) . ')'; |
|
333 | + return 'ALTER TABLE '.$table.' ADD PRIMARY KEY'.$flags.' ('.$this->getIndexFieldDeclarationListSQL($index->getQuotedColumns($this)).')'; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -385,17 +385,17 @@ discard block |
||
385 | 385 | */ |
386 | 386 | public function getDefaultConstraintDeclarationSQL($table, array $column) |
387 | 387 | { |
388 | - if ( ! isset($column['default'])) { |
|
388 | + if (!isset($column['default'])) { |
|
389 | 389 | throw new \InvalidArgumentException("Incomplete column definition. 'default' required."); |
390 | 390 | } |
391 | 391 | |
392 | 392 | $columnName = new Identifier($column['name']); |
393 | 393 | |
394 | 394 | return |
395 | - ' CONSTRAINT ' . |
|
396 | - $this->generateDefaultConstraintName($table, $column['name']) . |
|
397 | - $this->getDefaultValueDeclarationSQL($column) . |
|
398 | - ' FOR ' . $columnName->getQuotedName($this); |
|
395 | + ' CONSTRAINT '. |
|
396 | + $this->generateDefaultConstraintName($table, $column['name']). |
|
397 | + $this->getDefaultValueDeclarationSQL($column). |
|
398 | + ' FOR '.$columnName->getQuotedName($this); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | /** |
@@ -456,10 +456,10 @@ discard block |
||
456 | 456 | $fields = []; |
457 | 457 | |
458 | 458 | foreach ($index->getQuotedColumns($this) as $field) { |
459 | - $fields[] = $field . ' IS NOT NULL'; |
|
459 | + $fields[] = $field.' IS NOT NULL'; |
|
460 | 460 | } |
461 | 461 | |
462 | - return $sql . ' WHERE ' . implode(' AND ', $fields); |
|
462 | + return $sql.' WHERE '.implode(' AND ', $fields); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | /** |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | } |
480 | 480 | |
481 | 481 | $columnDef = $column->toArray(); |
482 | - $queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef); |
|
482 | + $queryParts[] = 'ADD '.$this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef); |
|
483 | 483 | |
484 | 484 | if (isset($columnDef['default'])) { |
485 | 485 | $queryParts[] = $this->getAlterTableAddDefaultConstraintClause($diff->name, $column); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | |
488 | 488 | $comment = $this->getColumnComment($column); |
489 | 489 | |
490 | - if ( ! empty($comment) || is_numeric($comment)) { |
|
490 | + if (!empty($comment) || is_numeric($comment)) { |
|
491 | 491 | $commentsSql[] = $this->getCreateColumnCommentSQL( |
492 | 492 | $diff->name, |
493 | 493 | $column->getQuotedName($this), |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | continue; |
502 | 502 | } |
503 | 503 | |
504 | - $queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this); |
|
504 | + $queryParts[] = 'DROP COLUMN '.$column->getQuotedName($this); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */ |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | |
513 | 513 | $column = $columnDiff->column; |
514 | 514 | $comment = $this->getColumnComment($column); |
515 | - $hasComment = ! empty ($comment) || is_numeric($comment); |
|
515 | + $hasComment = !empty ($comment) || is_numeric($comment); |
|
516 | 516 | |
517 | 517 | if ($columnDiff->fromColumn instanceof Column) { |
518 | 518 | $fromComment = $this->getColumnComment($columnDiff->fromColumn); |
519 | - $hasFromComment = ! empty ($fromComment) || is_numeric($fromComment); |
|
519 | + $hasFromComment = !empty ($fromComment) || is_numeric($fromComment); |
|
520 | 520 | |
521 | 521 | if ($hasFromComment && $hasComment && $fromComment != $comment) { |
522 | 522 | $commentsSql[] = $this->getAlterColumnCommentSQL( |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | $column->getQuotedName($this), |
525 | 525 | $comment |
526 | 526 | ); |
527 | - } elseif ($hasFromComment && ! $hasComment) { |
|
527 | + } elseif ($hasFromComment && !$hasComment) { |
|
528 | 528 | $commentsSql[] = $this->getDropColumnCommentSQL($diff->name, $column->getQuotedName($this)); |
529 | 529 | } elseif ($hasComment) { |
530 | 530 | $commentsSql[] = $this->getCreateColumnCommentSQL( |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | |
554 | 554 | $columnDef = $column->toArray(); |
555 | 555 | |
556 | - $queryParts[] = 'ALTER COLUMN ' . |
|
556 | + $queryParts[] = 'ALTER COLUMN '. |
|
557 | 557 | $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef); |
558 | 558 | |
559 | 559 | if (isset($columnDef['default']) && ($requireDropDefaultConstraint || $columnDiff->hasChanged('default'))) { |
@@ -568,9 +568,9 @@ discard block |
||
568 | 568 | |
569 | 569 | $oldColumnName = new Identifier($oldColumnName); |
570 | 570 | |
571 | - $sql[] = "sp_RENAME '" . |
|
572 | - $diff->getName($this)->getQuotedName($this) . "." . $oldColumnName->getQuotedName($this) . |
|
573 | - "', '" . $column->getQuotedName($this) . "', 'COLUMN'"; |
|
571 | + $sql[] = "sp_RENAME '". |
|
572 | + $diff->getName($this)->getQuotedName($this).".".$oldColumnName->getQuotedName($this). |
|
573 | + "', '".$column->getQuotedName($this)."', 'COLUMN'"; |
|
574 | 574 | |
575 | 575 | // Recreate default constraint with new column name if necessary (for future reference). |
576 | 576 | if ($column->getDefault() !== null) { |
@@ -589,13 +589,13 @@ discard block |
||
589 | 589 | } |
590 | 590 | |
591 | 591 | foreach ($queryParts as $query) { |
592 | - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; |
|
592 | + $sql[] = 'ALTER TABLE '.$diff->getName($this)->getQuotedName($this).' '.$query; |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | $sql = array_merge($sql, $commentsSql); |
596 | 596 | |
597 | 597 | if ($diff->newName !== false) { |
598 | - $sql[] = "sp_RENAME '" . $diff->getName($this)->getQuotedName($this) . "', '" . $diff->getNewName()->getName() . "'"; |
|
598 | + $sql[] = "sp_RENAME '".$diff->getName($this)->getQuotedName($this)."', '".$diff->getNewName()->getName()."'"; |
|
599 | 599 | |
600 | 600 | /** |
601 | 601 | * Rename table's default constraints names |
@@ -605,13 +605,13 @@ discard block |
||
605 | 605 | * alterations as the table name is encoded in |
606 | 606 | * default constraints' names. |
607 | 607 | */ |
608 | - $sql[] = "DECLARE @sql NVARCHAR(MAX) = N''; " . |
|
609 | - "SELECT @sql += N'EXEC sp_rename N''' + dc.name + ''', N''' " . |
|
610 | - "+ REPLACE(dc.name, '" . $this->generateIdentifierName($diff->name) . "', " . |
|
611 | - "'" . $this->generateIdentifierName($diff->newName) . "') + ''', ''OBJECT'';' " . |
|
612 | - "FROM sys.default_constraints dc " . |
|
613 | - "JOIN sys.tables tbl ON dc.parent_object_id = tbl.object_id " . |
|
614 | - "WHERE tbl.name = '" . $diff->getNewName()->getName() . "';" . |
|
608 | + $sql[] = "DECLARE @sql NVARCHAR(MAX) = N''; ". |
|
609 | + "SELECT @sql += N'EXEC sp_rename N''' + dc.name + ''', N''' ". |
|
610 | + "+ REPLACE(dc.name, '".$this->generateIdentifierName($diff->name)."', ". |
|
611 | + "'".$this->generateIdentifierName($diff->newName)."') + ''', ''OBJECT'';' ". |
|
612 | + "FROM sys.default_constraints dc ". |
|
613 | + "JOIN sys.tables tbl ON dc.parent_object_id = tbl.object_id ". |
|
614 | + "WHERE tbl.name = '".$diff->getNewName()->getName()."';". |
|
615 | 615 | "EXEC sp_executesql @sql"; |
616 | 616 | } |
617 | 617 | |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $columnDef = $column->toArray(); |
638 | 638 | $columnDef['name'] = $column->getQuotedName($this); |
639 | 639 | |
640 | - return 'ADD' . $this->getDefaultConstraintDeclarationSQL($tableName, $columnDef); |
|
640 | + return 'ADD'.$this->getDefaultConstraintDeclarationSQL($tableName, $columnDef); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | /** |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | */ |
651 | 651 | private function getAlterTableDropDefaultConstraintClause($tableName, $columnName) |
652 | 652 | { |
653 | - return 'DROP CONSTRAINT ' . $this->generateDefaultConstraintName($tableName, $columnName); |
|
653 | + return 'DROP CONSTRAINT '.$this->generateDefaultConstraintName($tableName, $columnName); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | /** |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | { |
670 | 670 | // We can only decide whether to drop an existing default constraint |
671 | 671 | // if we know the original default value. |
672 | - if ( ! $columnDiff->fromColumn instanceof Column) { |
|
672 | + if (!$columnDiff->fromColumn instanceof Column) { |
|
673 | 673 | return false; |
674 | 674 | } |
675 | 675 | |
@@ -808,12 +808,12 @@ discard block |
||
808 | 808 | $level1Name = null, |
809 | 809 | $level2Type = null, |
810 | 810 | $level2Name = null |
811 | - ) { |
|
812 | - return "EXEC sp_addextendedproperty " . |
|
813 | - "N" . $this->quoteStringLiteral($name) . ", N" . $this->quoteStringLiteral($value) . ", " . |
|
814 | - "N" . $this->quoteStringLiteral($level0Type) . ", " . $level0Name . ', ' . |
|
815 | - "N" . $this->quoteStringLiteral($level1Type) . ", " . $level1Name . ', ' . |
|
816 | - "N" . $this->quoteStringLiteral($level2Type) . ", " . $level2Name; |
|
811 | + ){ |
|
812 | + return "EXEC sp_addextendedproperty ". |
|
813 | + "N".$this->quoteStringLiteral($name).", N".$this->quoteStringLiteral($value).", ". |
|
814 | + "N".$this->quoteStringLiteral($level0Type).", ".$level0Name.', '. |
|
815 | + "N".$this->quoteStringLiteral($level1Type).", ".$level1Name.', '. |
|
816 | + "N".$this->quoteStringLiteral($level2Type).", ".$level2Name; |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | /** |
@@ -839,12 +839,12 @@ discard block |
||
839 | 839 | $level1Name = null, |
840 | 840 | $level2Type = null, |
841 | 841 | $level2Name = null |
842 | - ) { |
|
843 | - return "EXEC sp_dropextendedproperty " . |
|
844 | - "N" . $this->quoteStringLiteral($name) . ", " . |
|
845 | - "N" . $this->quoteStringLiteral($level0Type) . ", " . $level0Name . ', ' . |
|
846 | - "N" . $this->quoteStringLiteral($level1Type) . ", " . $level1Name . ', ' . |
|
847 | - "N" . $this->quoteStringLiteral($level2Type) . ", " . $level2Name; |
|
842 | + ){ |
|
843 | + return "EXEC sp_dropextendedproperty ". |
|
844 | + "N".$this->quoteStringLiteral($name).", ". |
|
845 | + "N".$this->quoteStringLiteral($level0Type).", ".$level0Name.', '. |
|
846 | + "N".$this->quoteStringLiteral($level1Type).", ".$level1Name.', '. |
|
847 | + "N".$this->quoteStringLiteral($level2Type).", ".$level2Name; |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | /** |
@@ -872,12 +872,12 @@ discard block |
||
872 | 872 | $level1Name = null, |
873 | 873 | $level2Type = null, |
874 | 874 | $level2Name = null |
875 | - ) { |
|
876 | - return "EXEC sp_updateextendedproperty " . |
|
877 | - "N" . $this->quoteStringLiteral($name) . ", N" . $this->quoteStringLiteral($value) . ", " . |
|
878 | - "N" . $this->quoteStringLiteral($level0Type) . ", " . $level0Name . ', ' . |
|
879 | - "N" . $this->quoteStringLiteral($level1Type) . ", " . $level1Name . ', ' . |
|
880 | - "N" . $this->quoteStringLiteral($level2Type) . ", " . $level2Name; |
|
875 | + ){ |
|
876 | + return "EXEC sp_updateextendedproperty ". |
|
877 | + "N".$this->quoteStringLiteral($name).", N".$this->quoteStringLiteral($value).", ". |
|
878 | + "N".$this->quoteStringLiteral($level0Type).", ".$level0Name.', '. |
|
879 | + "N".$this->quoteStringLiteral($level1Type).", ".$level1Name.', '. |
|
880 | + "N".$this->quoteStringLiteral($level2Type).", ".$level2Name; |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | /** |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | */ |
886 | 886 | public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName) |
887 | 887 | { |
888 | - return 'INSERT INTO ' . $quotedTableName . ' DEFAULT VALUES'; |
|
888 | + return 'INSERT INTO '.$quotedTableName.' DEFAULT VALUES'; |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | /** |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | JOIN sys.indexes AS idx ON tbl.object_id = idx.object_id |
973 | 973 | JOIN sys.index_columns AS idxcol ON idx.object_id = idxcol.object_id AND idx.index_id = idxcol.index_id |
974 | 974 | JOIN sys.columns AS col ON idxcol.object_id = col.object_id AND idxcol.column_id = col.column_id |
975 | - WHERE " . $this->getTableWhereClause($table, 'scm.name', 'tbl.name') . " |
|
975 | + WHERE " . $this->getTableWhereClause($table, 'scm.name', 'tbl.name')." |
|
976 | 976 | ORDER BY idx.index_id ASC, idxcol.key_ordinal ASC"; |
977 | 977 | } |
978 | 978 | |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | */ |
982 | 982 | public function getCreateViewSQL($name, $sql) |
983 | 983 | { |
984 | - return 'CREATE VIEW ' . $name . ' AS ' . $sql; |
|
984 | + return 'CREATE VIEW '.$name.' AS '.$sql; |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | /** |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | */ |
1021 | 1021 | public function getDropViewSQL($name) |
1022 | 1022 | { |
1023 | - return 'DROP VIEW ' . $name; |
|
1023 | + return 'DROP VIEW '.$name; |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | /** |
@@ -1039,10 +1039,10 @@ discard block |
||
1039 | 1039 | public function getLocateExpression($str, $substr, $startPos = false) |
1040 | 1040 | { |
1041 | 1041 | if ($startPos == false) { |
1042 | - return 'CHARINDEX(' . $substr . ', ' . $str . ')'; |
|
1042 | + return 'CHARINDEX('.$substr.', '.$str.')'; |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | - return 'CHARINDEX(' . $substr . ', ' . $str . ', ' . $startPos . ')'; |
|
1045 | + return 'CHARINDEX('.$substr.', '.$str.', '.$startPos.')'; |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | /** |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | */ |
1051 | 1051 | public function getModExpression($expression1, $expression2) |
1052 | 1052 | { |
1053 | - return $expression1 . ' % ' . $expression2; |
|
1053 | + return $expression1.' % '.$expression2; |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | /** |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | */ |
1059 | 1059 | public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = false) |
1060 | 1060 | { |
1061 | - if ( ! $char) { |
|
1061 | + if (!$char) { |
|
1062 | 1062 | switch ($pos) { |
1063 | 1063 | case TrimMode::LEADING: |
1064 | 1064 | $trimFn = 'LTRIM'; |
@@ -1069,10 +1069,10 @@ discard block |
||
1069 | 1069 | break; |
1070 | 1070 | |
1071 | 1071 | default: |
1072 | - return 'LTRIM(RTRIM(' . $str . '))'; |
|
1072 | + return 'LTRIM(RTRIM('.$str.'))'; |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | - return $trimFn . '(' . $str . ')'; |
|
1075 | + return $trimFn.'('.$str.')'; |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | /** Original query used to get those expressions |
@@ -1087,14 +1087,14 @@ discard block |
||
1087 | 1087 | $pattern = "'%[^' + $char + ']%'"; |
1088 | 1088 | |
1089 | 1089 | if ($pos === TrimMode::LEADING) { |
1090 | - return 'stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)'; |
|
1090 | + return 'stuff('.$str.', 1, patindex('.$pattern.', '.$str.') - 1, null)'; |
|
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | if ($pos === TrimMode::TRAILING) { |
1094 | - return 'reverse(stuff(reverse(' . $str . '), 1, patindex(' . $pattern . ', reverse(' . $str . ')) - 1, null))'; |
|
1094 | + return 'reverse(stuff(reverse('.$str.'), 1, patindex('.$pattern.', reverse('.$str.')) - 1, null))'; |
|
1095 | 1095 | } |
1096 | 1096 | |
1097 | - return 'reverse(stuff(reverse(stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)), 1, patindex(' . $pattern . ', reverse(stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null))) - 1, null))'; |
|
1097 | + return 'reverse(stuff(reverse(stuff('.$str.', 1, patindex('.$pattern.', '.$str.') - 1, null)), 1, patindex('.$pattern.', reverse(stuff('.$str.', 1, patindex('.$pattern.', '.$str.') - 1, null))) - 1, null))'; |
|
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | /** |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | { |
1105 | 1105 | $args = func_get_args(); |
1106 | 1106 | |
1107 | - return '(' . implode(' + ', $args) . ')'; |
|
1107 | + return '('.implode(' + ', $args).')'; |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | /** |
@@ -1129,10 +1129,10 @@ discard block |
||
1129 | 1129 | public function getSubstringExpression($value, $from, $length = null) |
1130 | 1130 | { |
1131 | 1131 | if ($length !== null) { |
1132 | - return 'SUBSTRING(' . $value . ', ' . $from . ', ' . $length . ')'; |
|
1132 | + return 'SUBSTRING('.$value.', '.$from.', '.$length.')'; |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | - return 'SUBSTRING(' . $value . ', ' . $from . ', LEN(' . $value . ') - ' . $from . ' + 1)'; |
|
1135 | + return 'SUBSTRING('.$value.', '.$from.', LEN('.$value.') - '.$from.' + 1)'; |
|
1136 | 1136 | } |
1137 | 1137 | |
1138 | 1138 | /** |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | */ |
1141 | 1141 | public function getLengthExpression($column) |
1142 | 1142 | { |
1143 | - return 'LEN(' . $column . ')'; |
|
1143 | + return 'LEN('.$column.')'; |
|
1144 | 1144 | } |
1145 | 1145 | |
1146 | 1146 | /** |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | */ |
1149 | 1149 | public function getSetTransactionIsolationSQL($level) |
1150 | 1150 | { |
1151 | - return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level); |
|
1151 | + return 'SET TRANSACTION ISOLATION LEVEL '.$this->_getTransactionIsolationLevelSQL($level); |
|
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | /** |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | */ |
1157 | 1157 | public function getIntegerTypeDeclarationSQL(array $field) |
1158 | 1158 | { |
1159 | - return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); |
|
1159 | + return 'INT'.$this->_getCommonIntegerTypeDeclarationSQL($field); |
|
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | /** |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | */ |
1165 | 1165 | public function getBigIntTypeDeclarationSQL(array $field) |
1166 | 1166 | { |
1167 | - return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); |
|
1167 | + return 'BIGINT'.$this->_getCommonIntegerTypeDeclarationSQL($field); |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | /** |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | */ |
1173 | 1173 | public function getSmallIntTypeDeclarationSQL(array $field) |
1174 | 1174 | { |
1175 | - return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); |
|
1175 | + return 'SMALLINT'.$this->_getCommonIntegerTypeDeclarationSQL($field); |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | /** |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | */ |
1189 | 1189 | protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) |
1190 | 1190 | { |
1191 | - return $fixed ? ($length ? 'NCHAR(' . $length . ')' : 'CHAR(255)') : ($length ? 'NVARCHAR(' . $length . ')' : 'NVARCHAR(255)'); |
|
1191 | + return $fixed ? ($length ? 'NCHAR('.$length.')' : 'CHAR(255)') : ($length ? 'NVARCHAR('.$length.')' : 'NVARCHAR(255)'); |
|
1192 | 1192 | } |
1193 | 1193 | |
1194 | 1194 | /** |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | */ |
1197 | 1197 | protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) |
1198 | 1198 | { |
1199 | - return $fixed ? 'BINARY(' . ($length ?: 255) . ')' : 'VARBINARY(' . ($length ?: 255) . ')'; |
|
1199 | + return $fixed ? 'BINARY('.($length ?: 255).')' : 'VARBINARY('.($length ?: 255).')'; |
|
1200 | 1200 | } |
1201 | 1201 | |
1202 | 1202 | /** |
@@ -1343,7 +1343,7 @@ discard block |
||
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | if ($currentPosition < $qLen - 1) { |
1346 | - $query = substr($query, 0, $orderByPos) . substr($query, $currentPosition - 1); |
|
1346 | + $query = substr($query, 0, $orderByPos).substr($query, $currentPosition - 1); |
|
1347 | 1347 | $offset = $orderByPos; |
1348 | 1348 | } |
1349 | 1349 | } |
@@ -1373,7 +1373,7 @@ discard block |
||
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | // Only yank query text on the same nesting level as the ORDER BY clause. |
1376 | - $subQueryBuffer = ($parenCount === 0 ? $query[$currentPosition] : ' ') . $subQueryBuffer; |
|
1376 | + $subQueryBuffer = ($parenCount === 0 ? $query[$currentPosition] : ' ').$subQueryBuffer; |
|
1377 | 1377 | |
1378 | 1378 | $currentPosition--; |
1379 | 1379 | } |
@@ -1420,7 +1420,7 @@ discard block |
||
1420 | 1420 | */ |
1421 | 1421 | public function getTemporaryTableName($tableName) |
1422 | 1422 | { |
1423 | - return '#' . $tableName; |
|
1423 | + return '#'.$tableName; |
|
1424 | 1424 | } |
1425 | 1425 | |
1426 | 1426 | /** |
@@ -1502,7 +1502,7 @@ discard block |
||
1502 | 1502 | */ |
1503 | 1503 | public function createSavePoint($savepoint) |
1504 | 1504 | { |
1505 | - return 'SAVE TRANSACTION ' . $savepoint; |
|
1505 | + return 'SAVE TRANSACTION '.$savepoint; |
|
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | /** |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | */ |
1519 | 1519 | public function rollbackSavePoint($savepoint) |
1520 | 1520 | { |
1521 | - return 'ROLLBACK TRANSACTION ' . $savepoint; |
|
1521 | + return 'ROLLBACK TRANSACTION '.$savepoint; |
|
1522 | 1522 | } |
1523 | 1523 | |
1524 | 1524 | /** |
@@ -1541,13 +1541,13 @@ discard block |
||
1541 | 1541 | { |
1542 | 1542 | switch (true) { |
1543 | 1543 | case LockMode::NONE === $lockMode: |
1544 | - return $fromClause . ' WITH (NOLOCK)'; |
|
1544 | + return $fromClause.' WITH (NOLOCK)'; |
|
1545 | 1545 | |
1546 | 1546 | case LockMode::PESSIMISTIC_READ === $lockMode: |
1547 | - return $fromClause . ' WITH (HOLDLOCK, ROWLOCK)'; |
|
1547 | + return $fromClause.' WITH (HOLDLOCK, ROWLOCK)'; |
|
1548 | 1548 | |
1549 | 1549 | case LockMode::PESSIMISTIC_WRITE === $lockMode: |
1550 | - return $fromClause . ' WITH (UPDLOCK, ROWLOCK)'; |
|
1550 | + return $fromClause.' WITH (UPDLOCK, ROWLOCK)'; |
|
1551 | 1551 | |
1552 | 1552 | default: |
1553 | 1553 | return $fromClause; |
@@ -1575,7 +1575,7 @@ discard block |
||
1575 | 1575 | */ |
1576 | 1576 | public function quoteSingleIdentifier($str) |
1577 | 1577 | { |
1578 | - return "[" . str_replace("]", "][", $str) . "]"; |
|
1578 | + return "[".str_replace("]", "][", $str)."]"; |
|
1579 | 1579 | } |
1580 | 1580 | |
1581 | 1581 | /** |
@@ -1585,7 +1585,7 @@ discard block |
||
1585 | 1585 | { |
1586 | 1586 | $tableIdentifier = new Identifier($tableName); |
1587 | 1587 | |
1588 | - return 'TRUNCATE TABLE ' . $tableIdentifier->getQuotedName($this); |
|
1588 | + return 'TRUNCATE TABLE '.$tableIdentifier->getQuotedName($this); |
|
1589 | 1589 | } |
1590 | 1590 | |
1591 | 1591 | /** |
@@ -1601,29 +1601,29 @@ discard block |
||
1601 | 1601 | */ |
1602 | 1602 | public function getDefaultValueDeclarationSQL($field) |
1603 | 1603 | { |
1604 | - if ( ! isset($field['default'])) { |
|
1604 | + if (!isset($field['default'])) { |
|
1605 | 1605 | return empty($field['notnull']) ? ' NULL' : ''; |
1606 | 1606 | } |
1607 | 1607 | |
1608 | - if ( ! isset($field['type'])) { |
|
1609 | - return " DEFAULT '" . $field['default'] . "'"; |
|
1608 | + if (!isset($field['type'])) { |
|
1609 | + return " DEFAULT '".$field['default']."'"; |
|
1610 | 1610 | } |
1611 | 1611 | |
1612 | 1612 | $type = $field['type']; |
1613 | 1613 | |
1614 | 1614 | if ($type instanceof Types\PhpIntegerMappingType) { |
1615 | - return " DEFAULT " . $field['default']; |
|
1615 | + return " DEFAULT ".$field['default']; |
|
1616 | 1616 | } |
1617 | 1617 | |
1618 | 1618 | if ($type instanceof Types\PhpDateTimeMappingType && $field['default'] === $this->getCurrentTimestampSQL()) { |
1619 | - return " DEFAULT " . $this->getCurrentTimestampSQL(); |
|
1619 | + return " DEFAULT ".$this->getCurrentTimestampSQL(); |
|
1620 | 1620 | } |
1621 | 1621 | |
1622 | 1622 | if ($type instanceof Types\BooleanType) { |
1623 | - return " DEFAULT '" . $this->convertBooleans($field['default']) . "'"; |
|
1623 | + return " DEFAULT '".$this->convertBooleans($field['default'])."'"; |
|
1624 | 1624 | } |
1625 | 1625 | |
1626 | - return " DEFAULT '" . $field['default'] . "'"; |
|
1626 | + return " DEFAULT '".$field['default']."'"; |
|
1627 | 1627 | } |
1628 | 1628 | |
1629 | 1629 | /** |
@@ -1637,21 +1637,21 @@ discard block |
||
1637 | 1637 | $columnDef = $this->getCustomTypeDeclarationSQL($field); |
1638 | 1638 | } else { |
1639 | 1639 | $collation = (isset($field['collation']) && $field['collation']) ? |
1640 | - ' ' . $this->getColumnCollationDeclarationSQL($field['collation']) : ''; |
|
1640 | + ' '.$this->getColumnCollationDeclarationSQL($field['collation']) : ''; |
|
1641 | 1641 | |
1642 | 1642 | $notnull = (isset($field['notnull']) && $field['notnull']) ? ' NOT NULL' : ''; |
1643 | 1643 | |
1644 | 1644 | $unique = (isset($field['unique']) && $field['unique']) ? |
1645 | - ' ' . $this->getUniqueFieldDeclarationSQL() : ''; |
|
1645 | + ' '.$this->getUniqueFieldDeclarationSQL() : ''; |
|
1646 | 1646 | |
1647 | 1647 | $check = (isset($field['check']) && $field['check']) ? |
1648 | - ' ' . $field['check'] : ''; |
|
1648 | + ' '.$field['check'] : ''; |
|
1649 | 1649 | |
1650 | 1650 | $typeDecl = $field['type']->getSQLDeclaration($field, $this); |
1651 | - $columnDef = $typeDecl . $collation . $notnull . $unique . $check; |
|
1651 | + $columnDef = $typeDecl.$collation.$notnull.$unique.$check; |
|
1652 | 1652 | } |
1653 | 1653 | |
1654 | - return $name . ' ' . $columnDef; |
|
1654 | + return $name.' '.$columnDef; |
|
1655 | 1655 | } |
1656 | 1656 | |
1657 | 1657 | /** |
@@ -1664,7 +1664,7 @@ discard block |
||
1664 | 1664 | */ |
1665 | 1665 | private function generateDefaultConstraintName($table, $column) |
1666 | 1666 | { |
1667 | - return 'DF_' . $this->generateIdentifierName($table) . '_' . $this->generateIdentifierName($column); |
|
1667 | + return 'DF_'.$this->generateIdentifierName($table).'_'.$this->generateIdentifierName($column); |
|
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | /** |
@@ -19,9 +19,9 @@ |
||
19 | 19 | |
20 | 20 | namespace Doctrine\DBAL\Query; |
21 | 21 | |
22 | +use Doctrine\DBAL\Connection; |
|
22 | 23 | use Doctrine\DBAL\ParameterType; |
23 | 24 | use Doctrine\DBAL\Query\Expression\CompositeExpression; |
24 | -use Doctrine\DBAL\Connection; |
|
25 | 25 | use function array_key_exists; |
26 | 26 | use function array_keys; |
27 | 27 | use function array_unshift; |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | { |
537 | 537 | $this->type = self::DELETE; |
538 | 538 | |
539 | - if ( ! $delete) { |
|
539 | + if (!$delete) { |
|
540 | 540 | return $this; |
541 | 541 | } |
542 | 542 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | { |
567 | 567 | $this->type = self::UPDATE; |
568 | 568 | |
569 | - if ( ! $update) { |
|
569 | + if (!$update) { |
|
570 | 570 | return $this; |
571 | 571 | } |
572 | 572 | |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | { |
600 | 600 | $this->type = self::INSERT; |
601 | 601 | |
602 | - if ( ! $insert) { |
|
602 | + if (!$insert) { |
|
603 | 603 | return $this; |
604 | 604 | } |
605 | 605 | |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | */ |
758 | 758 | public function set($key, $value) |
759 | 759 | { |
760 | - return $this->add('set', $key .' = ' . $value, true); |
|
760 | + return $this->add('set', $key.' = '.$value, true); |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | /** |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | */ |
789 | 789 | public function where($predicates) |
790 | 790 | { |
791 | - if ( ! (func_num_args() == 1 && $predicates instanceof CompositeExpression)) { |
|
791 | + if (!(func_num_args() == 1 && $predicates instanceof CompositeExpression)) { |
|
792 | 792 | $predicates = new CompositeExpression(CompositeExpression::TYPE_AND, func_get_args()); |
793 | 793 | } |
794 | 794 | |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | */ |
975 | 975 | public function having($having) |
976 | 976 | { |
977 | - if ( ! (func_num_args() == 1 && $having instanceof CompositeExpression)) { |
|
977 | + if (!(func_num_args() == 1 && $having instanceof CompositeExpression)) { |
|
978 | 978 | $having = new CompositeExpression(CompositeExpression::TYPE_AND, func_get_args()); |
979 | 979 | } |
980 | 980 | |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | */ |
1039 | 1039 | public function orderBy($sort, $order = null) |
1040 | 1040 | { |
1041 | - return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), false); |
|
1041 | + return $this->add('orderBy', $sort.' '.(!$order ? 'ASC' : $order), false); |
|
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | /** |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | */ |
1052 | 1052 | public function addOrderBy($sort, $order = null) |
1053 | 1053 | { |
1054 | - return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), true); |
|
1054 | + return $this->add('orderBy', $sort.' '.(!$order ? 'ASC' : $order), true); |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | /** |
@@ -1120,13 +1120,13 @@ discard block |
||
1120 | 1120 | */ |
1121 | 1121 | private function getSQLForSelect() |
1122 | 1122 | { |
1123 | - $query = 'SELECT ' . implode(', ', $this->sqlParts['select']); |
|
1123 | + $query = 'SELECT '.implode(', ', $this->sqlParts['select']); |
|
1124 | 1124 | |
1125 | - $query .= ($this->sqlParts['from'] ? ' FROM ' . implode(', ', $this->getFromClauses()) : '') |
|
1126 | - . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : '') |
|
1127 | - . ($this->sqlParts['groupBy'] ? ' GROUP BY ' . implode(', ', $this->sqlParts['groupBy']) : '') |
|
1128 | - . ($this->sqlParts['having'] !== null ? ' HAVING ' . ((string) $this->sqlParts['having']) : '') |
|
1129 | - . ($this->sqlParts['orderBy'] ? ' ORDER BY ' . implode(', ', $this->sqlParts['orderBy']) : ''); |
|
1125 | + $query .= ($this->sqlParts['from'] ? ' FROM '.implode(', ', $this->getFromClauses()) : '') |
|
1126 | + . ($this->sqlParts['where'] !== null ? ' WHERE '.((string) $this->sqlParts['where']) : '') |
|
1127 | + . ($this->sqlParts['groupBy'] ? ' GROUP BY '.implode(', ', $this->sqlParts['groupBy']) : '') |
|
1128 | + . ($this->sqlParts['having'] !== null ? ' HAVING '.((string) $this->sqlParts['having']) : '') |
|
1129 | + . ($this->sqlParts['orderBy'] ? ' ORDER BY '.implode(', ', $this->sqlParts['orderBy']) : ''); |
|
1130 | 1130 | |
1131 | 1131 | if ($this->isLimitQuery()) { |
1132 | 1132 | return $this->connection->getDatabasePlatform()->modifyLimitQuery( |
@@ -1153,13 +1153,13 @@ discard block |
||
1153 | 1153 | $tableSql = $from['table']; |
1154 | 1154 | $tableReference = $from['table']; |
1155 | 1155 | } else { |
1156 | - $tableSql = $from['table'] . ' ' . $from['alias']; |
|
1156 | + $tableSql = $from['table'].' '.$from['alias']; |
|
1157 | 1157 | $tableReference = $from['alias']; |
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | $knownAliases[$tableReference] = true; |
1161 | 1161 | |
1162 | - $fromClauses[$tableReference] = $tableSql . $this->getSQLForJoins($tableReference, $knownAliases); |
|
1162 | + $fromClauses[$tableReference] = $tableSql.$this->getSQLForJoins($tableReference, $knownAliases); |
|
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | $this->verifyAllAliasesAreKnown($knownAliases); |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | private function verifyAllAliasesAreKnown(array $knownAliases) |
1176 | 1176 | { |
1177 | 1177 | foreach ($this->sqlParts['join'] as $fromAlias => $joins) { |
1178 | - if ( ! isset($knownAliases[$fromAlias])) { |
|
1178 | + if (!isset($knownAliases[$fromAlias])) { |
|
1179 | 1179 | throw QueryException::unknownAlias($fromAlias, array_keys($knownAliases)); |
1180 | 1180 | } |
1181 | 1181 | } |
@@ -1196,9 +1196,9 @@ discard block |
||
1196 | 1196 | */ |
1197 | 1197 | private function getSQLForInsert() |
1198 | 1198 | { |
1199 | - return 'INSERT INTO ' . $this->sqlParts['from']['table'] . |
|
1200 | - ' (' . implode(', ', array_keys($this->sqlParts['values'])) . ')' . |
|
1201 | - ' VALUES(' . implode(', ', $this->sqlParts['values']) . ')'; |
|
1199 | + return 'INSERT INTO '.$this->sqlParts['from']['table']. |
|
1200 | + ' ('.implode(', ', array_keys($this->sqlParts['values'])).')'. |
|
1201 | + ' VALUES('.implode(', ', $this->sqlParts['values']).')'; |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | /** |
@@ -1208,10 +1208,10 @@ discard block |
||
1208 | 1208 | */ |
1209 | 1209 | private function getSQLForUpdate() |
1210 | 1210 | { |
1211 | - $table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : ''); |
|
1212 | - $query = 'UPDATE ' . $table |
|
1213 | - . ' SET ' . implode(", ", $this->sqlParts['set']) |
|
1214 | - . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : ''); |
|
1211 | + $table = $this->sqlParts['from']['table'].($this->sqlParts['from']['alias'] ? ' '.$this->sqlParts['from']['alias'] : ''); |
|
1212 | + $query = 'UPDATE '.$table |
|
1213 | + . ' SET '.implode(", ", $this->sqlParts['set']) |
|
1214 | + . ($this->sqlParts['where'] !== null ? ' WHERE '.((string) $this->sqlParts['where']) : ''); |
|
1215 | 1215 | |
1216 | 1216 | return $query; |
1217 | 1217 | } |
@@ -1223,8 +1223,8 @@ discard block |
||
1223 | 1223 | */ |
1224 | 1224 | private function getSQLForDelete() |
1225 | 1225 | { |
1226 | - $table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : ''); |
|
1227 | - $query = 'DELETE FROM ' . $table . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : ''); |
|
1226 | + $table = $this->sqlParts['from']['table'].($this->sqlParts['from']['alias'] ? ' '.$this->sqlParts['from']['alias'] : ''); |
|
1227 | + $query = 'DELETE FROM '.$table.($this->sqlParts['where'] !== null ? ' WHERE '.((string) $this->sqlParts['where']) : ''); |
|
1228 | 1228 | |
1229 | 1229 | return $query; |
1230 | 1230 | } |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | { |
1274 | 1274 | if ($placeHolder === null) { |
1275 | 1275 | $this->boundCounter++; |
1276 | - $placeHolder = ":dcValue" . $this->boundCounter; |
|
1276 | + $placeHolder = ":dcValue".$this->boundCounter; |
|
1277 | 1277 | } |
1278 | 1278 | $this->setParameter(substr($placeHolder, 1), $value, $type); |
1279 | 1279 | |
@@ -1327,9 +1327,9 @@ discard block |
||
1327 | 1327 | if (array_key_exists($join['joinAlias'], $knownAliases)) { |
1328 | 1328 | throw QueryException::nonUniqueAlias($join['joinAlias'], array_keys($knownAliases)); |
1329 | 1329 | } |
1330 | - $sql .= ' ' . strtoupper($join['joinType']) |
|
1331 | - . ' JOIN ' . $join['joinTable'] . ' ' . $join['joinAlias'] |
|
1332 | - . ' ON ' . ((string) $join['joinCondition']); |
|
1330 | + $sql .= ' '.strtoupper($join['joinType']) |
|
1331 | + . ' JOIN '.$join['joinTable'].' '.$join['joinAlias'] |
|
1332 | + . ' ON '.((string) $join['joinCondition']); |
|
1333 | 1333 | $knownAliases[$join['joinAlias']] = true; |
1334 | 1334 | } |
1335 | 1335 |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | /** |
984 | 984 | * @param array $view |
985 | 985 | * |
986 | - * @return mixed |
|
986 | + * @return boolean |
|
987 | 987 | */ |
988 | 988 | protected function _getPortableViewDefinition($view) |
989 | 989 | { |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | * For databases that don't support subschema/namespaces this method |
1091 | 1091 | * returns the name of the currently connected database. |
1092 | 1092 | * |
1093 | - * @return array |
|
1093 | + * @return string[] |
|
1094 | 1094 | */ |
1095 | 1095 | public function getSchemaSearchPaths() |
1096 | 1096 | { |
@@ -19,10 +19,10 @@ |
||
19 | 19 | |
20 | 20 | namespace Doctrine\DBAL\Schema; |
21 | 21 | |
22 | -use Doctrine\DBAL\Events; |
|
22 | +use Doctrine\DBAL\DBALException; |
|
23 | 23 | use Doctrine\DBAL\Event\SchemaColumnDefinitionEventArgs; |
24 | 24 | use Doctrine\DBAL\Event\SchemaIndexDefinitionEventArgs; |
25 | -use Doctrine\DBAL\DBALException; |
|
25 | +use Doctrine\DBAL\Events; |
|
26 | 26 | use Doctrine\DBAL\Platforms\AbstractPlatform; |
27 | 27 | use function array_filter; |
28 | 28 | use function array_map; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function listTableColumns($table, $database = null) |
177 | 177 | { |
178 | - if ( ! $database) { |
|
178 | + if (!$database) { |
|
179 | 179 | $database = $this->_conn->getDatabase(); |
180 | 180 | } |
181 | 181 | |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | protected function filterAssetNames($assetNames) |
245 | 245 | { |
246 | 246 | $filterExpr = $this->getFilterSchemaAssetsExpression(); |
247 | - if ( ! $filterExpr) { |
|
247 | + if (!$filterExpr) { |
|
248 | 248 | return $assetNames; |
249 | 249 | } |
250 | 250 | |
251 | 251 | return array_values( |
252 | - array_filter($assetNames, function ($assetName) use ($filterExpr) { |
|
252 | + array_filter($assetNames, function($assetName) use ($filterExpr) { |
|
253 | 253 | $assetName = ($assetName instanceof AbstractAsset) ? $assetName->getName() : $assetName; |
254 | 254 | |
255 | 255 | return preg_match($filterExpr, $assetName); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | */ |
451 | 451 | public function createTable(Table $table) |
452 | 452 | { |
453 | - $createFlags = AbstractPlatform::CREATE_INDEXES|AbstractPlatform::CREATE_FOREIGNKEYS; |
|
453 | + $createFlags = AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS; |
|
454 | 454 | $this->_execSql($this->_platform->getCreateTableSQL($table, $createFlags)); |
455 | 455 | } |
456 | 456 | |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | $column = $eventArgs->getColumn(); |
828 | 828 | } |
829 | 829 | |
830 | - if ( ! $defaultPrevented) { |
|
830 | + if (!$defaultPrevented) { |
|
831 | 831 | $column = $this->_getPortableTableColumnDefinition($tableColumn); |
832 | 832 | } |
833 | 833 | |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | * |
858 | 858 | * @return array |
859 | 859 | */ |
860 | - protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null) |
|
860 | + protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null) |
|
861 | 861 | { |
862 | 862 | $result = []; |
863 | 863 | foreach ($tableIndexRows as $tableIndex) { |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | $index = $eventArgs->getIndex(); |
897 | 897 | } |
898 | 898 | |
899 | - if ( ! $defaultPrevented) { |
|
899 | + if (!$defaultPrevented) { |
|
900 | 900 | $index = new Index($data['name'], $data['columns'], $data['unique'], $data['primary'], $data['flags'], $data['options']); |
901 | 901 | } |
902 | 902 | |
@@ -1069,10 +1069,10 @@ discard block |
||
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | $params = $this->_conn->getParams(); |
1072 | - if (! isset($params['defaultTableOptions'])) { |
|
1072 | + if (!isset($params['defaultTableOptions'])) { |
|
1073 | 1073 | $params['defaultTableOptions'] = []; |
1074 | 1074 | } |
1075 | - if (! isset($params['defaultTableOptions']['charset']) && isset($params['charset'])) { |
|
1075 | + if (!isset($params['defaultTableOptions']['charset']) && isset($params['charset'])) { |
|
1076 | 1076 | $params['defaultTableOptions']['charset'] = $params['charset']; |
1077 | 1077 | } |
1078 | 1078 | $schemaConfig->setDefaultTableOptions($params['defaultTableOptions']); |
@@ -249,7 +249,7 @@ |
||
249 | 249 | } |
250 | 250 | |
251 | 251 | return array_values( |
252 | - array_filter($assetNames, function ($assetName) use ($filterExpr) { |
|
252 | + array_filter($assetNames, function ($assetName) use ($filterExpr){ |
|
253 | 253 | $assetName = ($assetName instanceof AbstractAsset) ? $assetName->getName() : $assetName; |
254 | 254 | |
255 | 255 | return preg_match($filterExpr, $assetName); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | * Returns the names of the referencing table columns |
47 | 47 | * the constraint is associated with. |
48 | 48 | * |
49 | - * @return array |
|
49 | + * @return integer[] |
|
50 | 50 | */ |
51 | 51 | public function getColumns(); |
52 | 52 |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * Returns the names of the referencing table columns |
142 | 142 | * the foreign key constraint is associated with. |
143 | 143 | * |
144 | - * @return array |
|
144 | + * @return integer[] |
|
145 | 145 | */ |
146 | 146 | public function getLocalColumns() |
147 | 147 | { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * Returns the names of the referenced table columns |
265 | 265 | * the foreign key constraint is associated with. |
266 | 266 | * |
267 | - * @return array |
|
267 | + * @return integer[] |
|
268 | 268 | */ |
269 | 269 | public function getForeignColumns() |
270 | 270 | { |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * Returns the referential action for UPDATE operations |
334 | 334 | * on the referenced table the foreign key constraint is associated with. |
335 | 335 | * |
336 | - * @return string|null |
|
336 | + * @return string|false |
|
337 | 337 | */ |
338 | 338 | public function onUpdate() |
339 | 339 | { |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * Returns the referential action for DELETE operations |
345 | 345 | * on the referenced table the foreign key constraint is associated with. |
346 | 346 | * |
347 | - * @return string|null |
|
347 | + * @return string|false |
|
348 | 348 | */ |
349 | 349 | public function onDelete() |
350 | 350 | { |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @param string $event Name of the database operation/event to return the referential action for. |
359 | 359 | * |
360 | - * @return string|null |
|
360 | + * @return string|false |
|
361 | 361 | */ |
362 | 362 | private function onEvent($event) |
363 | 363 | { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function __construct(array $localColumnNames, $foreignTableName, array $foreignColumnNames, $name = null, array $options = []) |
87 | 87 | { |
88 | 88 | $this->_setName($name); |
89 | - $identifierConstructorCallback = function ($column) { |
|
89 | + $identifierConstructorCallback = function($column){ |
|
90 | 90 | return new Identifier($column); |
91 | 91 | }; |
92 | 92 | $this->_localColumnNames = $localColumnNames |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | if (isset($this->_options[$event])) { |
365 | 365 | $onEvent = strtoupper($this->_options[$event]); |
366 | 366 | |
367 | - if ( ! in_array($onEvent, ['NO ACTION', 'RESTRICT'])) { |
|
367 | + if (!in_array($onEvent, ['NO ACTION', 'RESTRICT'])) { |
|
368 | 368 | return $onEvent; |
369 | 369 | } |
370 | 370 | } |
@@ -86,7 +86,7 @@ |
||
86 | 86 | public function __construct(array $localColumnNames, $foreignTableName, array $foreignColumnNames, $name = null, array $options = []) |
87 | 87 | { |
88 | 88 | $this->_setName($name); |
89 | - $identifierConstructorCallback = function ($column) { |
|
89 | + $identifierConstructorCallback = function ($column){ |
|
90 | 90 | return new Identifier($column); |
91 | 91 | }; |
92 | 92 | $this->_localColumnNames = $localColumnNames |
@@ -266,7 +266,7 @@ |
||
266 | 266 | /** |
267 | 267 | * Gets all table names, prefixed with a schema name, even the default one if present. |
268 | 268 | * |
269 | - * @return array |
|
269 | + * @return integer[] |
|
270 | 270 | */ |
271 | 271 | public function getTableNames() |
272 | 272 | { |
@@ -19,11 +19,11 @@ |
||
19 | 19 | |
20 | 20 | namespace Doctrine\DBAL\Schema; |
21 | 21 | |
22 | +use Doctrine\DBAL\Platforms\AbstractPlatform; |
|
22 | 23 | use Doctrine\DBAL\Schema\Visitor\CreateSchemaSqlCollector; |
23 | 24 | use Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector; |
24 | 25 | use Doctrine\DBAL\Schema\Visitor\NamespaceVisitor; |
25 | 26 | use Doctrine\DBAL\Schema\Visitor\Visitor; |
26 | -use Doctrine\DBAL\Platforms\AbstractPlatform; |
|
27 | 27 | use function array_keys; |
28 | 28 | use function strpos; |
29 | 29 | use function strtolower; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | array $sequences = [], |
92 | 92 | SchemaConfig $schemaConfig = null, |
93 | 93 | array $namespaces = [] |
94 | - ) { |
|
94 | + ){ |
|
95 | 95 | if ($schemaConfig == null) { |
96 | 96 | $schemaConfig = new SchemaConfig(); |
97 | 97 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | throw SchemaException::tableAlreadyExists($tableName); |
136 | 136 | } |
137 | 137 | |
138 | - if ( ! $table->isInDefaultNamespace($this->getName()) && ! $this->hasNamespace($namespaceName)) { |
|
138 | + if (!$table->isInDefaultNamespace($this->getName()) && !$this->hasNamespace($namespaceName)) { |
|
139 | 139 | $this->createNamespace($namespaceName); |
140 | 140 | } |
141 | 141 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | throw SchemaException::sequenceAlreadyExists($seqName); |
160 | 160 | } |
161 | 161 | |
162 | - if ( ! $sequence->isInDefaultNamespace($this->getName()) && ! $this->hasNamespace($namespaceName)) { |
|
162 | + if (!$sequence->isInDefaultNamespace($this->getName()) && !$this->hasNamespace($namespaceName)) { |
|
163 | 163 | $this->createNamespace($namespaceName); |
164 | 164 | } |
165 | 165 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $name = $this->getUnquotedAssetName($name); |
214 | 214 | |
215 | 215 | if (strpos($name, ".") === false) { |
216 | - $name = $this->getName() . "." . $name; |
|
216 | + $name = $this->getName().".".$name; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | return strtolower($name); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | * |
396 | 396 | * @return \Doctrine\DBAL\Schema\Sequence |
397 | 397 | */ |
398 | - public function createSequence($sequenceName, $allocationSize=1, $initialValue=1) |
|
398 | + public function createSequence($sequenceName, $allocationSize = 1, $initialValue = 1) |
|
399 | 399 | { |
400 | 400 | $seq = new Sequence($sequenceName, $allocationSize, $initialValue); |
401 | 401 | $this->_addSequence($seq); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | - * @param array $columnNames |
|
208 | + * @param integer[] $columnNames |
|
209 | 209 | * @param string|null $indexName |
210 | 210 | * @param array $options |
211 | 211 | * |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | /** |
801 | 801 | * @param string $name |
802 | 802 | * |
803 | - * @return mixed |
|
803 | + * @return string |
|
804 | 804 | */ |
805 | 805 | public function getOption($name) |
806 | 806 | { |
@@ -19,9 +19,9 @@ |
||
19 | 19 | |
20 | 20 | namespace Doctrine\DBAL\Schema; |
21 | 21 | |
22 | -use Doctrine\DBAL\Types\Type; |
|
23 | -use Doctrine\DBAL\Schema\Visitor\Visitor; |
|
24 | 22 | use Doctrine\DBAL\DBALException; |
23 | +use Doctrine\DBAL\Schema\Visitor\Visitor; |
|
24 | +use Doctrine\DBAL\Types\Type; |
|
25 | 25 | use const ARRAY_FILTER_USE_KEY; |
26 | 26 | use function array_filter; |
27 | 27 | use function array_merge; |
@@ -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); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | public function dropIndex($indexName) |
199 | 199 | { |
200 | 200 | $indexName = $this->normalizeIdentifier($indexName); |
201 | - if ( ! $this->hasIndex($indexName)) { |
|
201 | + if (!$this->hasIndex($indexName)) { |
|
202 | 202 | throw SchemaException::indexDoesNotExist($indexName, $this->_name); |
203 | 203 | } |
204 | 204 | unset($this->_indexes[$indexName]); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | return $this; |
244 | 244 | } |
245 | 245 | |
246 | - if ( ! $this->hasIndex($oldIndexName)) { |
|
246 | + if (!$this->hasIndex($oldIndexName)) { |
|
247 | 247 | throw SchemaException::indexDoesNotExist($oldIndexName, $this->_name); |
248 | 248 | } |
249 | 249 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $columnName = $indexColOptions; |
311 | 311 | } |
312 | 312 | |
313 | - if ( ! $this->hasColumn($columnName)) { |
|
313 | + if (!$this->hasColumn($columnName)) { |
|
314 | 314 | throw SchemaException::columnDoesNotExist($columnName, $this->_name); |
315 | 315 | } |
316 | 316 | } |
@@ -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 | |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function renameColumn($oldColumnName, $newColumnName) |
348 | 348 | { |
349 | - throw new DBALException("Table#renameColumn() was removed, because it drops and recreates " . |
|
350 | - "the column instead. There is no fix available, because a schema diff cannot reliably detect if a " . |
|
349 | + throw new DBALException("Table#renameColumn() was removed, because it drops and recreates ". |
|
350 | + "the column instead. There is no fix available, because a schema diff cannot reliably detect if a ". |
|
351 | 351 | "column was renamed or one column was created and another one dropped."); |
352 | 352 | } |
353 | 353 | |
@@ -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,18 +436,18 @@ 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) { |
443 | - if ( ! $foreignTable->hasColumn($columnName)) { |
|
443 | + if (!$foreignTable->hasColumn($columnName)) { |
|
444 | 444 | throw SchemaException::columnDoesNotExist($columnName, $foreignTable->getName()); |
445 | 445 | } |
446 | 446 | } |
447 | 447 | } |
448 | 448 | |
449 | 449 | foreach ($localColumnNames as $columnName) { |
450 | - if ( ! $this->hasColumn($columnName)) { |
|
450 | + if (!$this->hasColumn($columnName)) { |
|
451 | 451 | throw SchemaException::columnDoesNotExist($columnName, $this->_name); |
452 | 452 | } |
453 | 453 | } |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | } |
514 | 514 | } |
515 | 515 | |
516 | - if ((isset($this->_indexes[$indexName]) && ! in_array($indexName, $replacedImplicitIndexes, true)) || |
|
516 | + if ((isset($this->_indexes[$indexName]) && !in_array($indexName, $replacedImplicitIndexes, true)) || |
|
517 | 517 | ($this->_primaryKeyName != false && $indexCandidate->isPrimary()) |
518 | 518 | ) { |
519 | 519 | throw SchemaException::indexAlreadyExists($indexName, $this->_name); |
@@ -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 | } |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | public function getColumn($columnName) |
691 | 691 | { |
692 | 692 | $columnName = $this->normalizeIdentifier($columnName); |
693 | - if ( ! $this->hasColumn($columnName)) { |
|
693 | + if (!$this->hasColumn($columnName)) { |
|
694 | 694 | throw SchemaException::columnDoesNotExist($columnName, $this->_name); |
695 | 695 | } |
696 | 696 | |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | */ |
705 | 705 | public function getPrimaryKey() |
706 | 706 | { |
707 | - if ( ! $this->hasPrimaryKey()) { |
|
707 | + if (!$this->hasPrimaryKey()) { |
|
708 | 708 | return null; |
709 | 709 | } |
710 | 710 | |
@@ -720,8 +720,8 @@ discard block |
||
720 | 720 | */ |
721 | 721 | public function getPrimaryKeyColumns() |
722 | 722 | { |
723 | - if ( ! $this->hasPrimaryKey()) { |
|
724 | - throw new DBALException("Table " . $this->getName() . " has no primary key."); |
|
723 | + if (!$this->hasPrimaryKey()) { |
|
724 | + throw new DBALException("Table ".$this->getName()." has no primary key."); |
|
725 | 725 | } |
726 | 726 | return $this->getPrimaryKey()->getColumns(); |
727 | 727 | } |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | public function getIndex($indexName) |
763 | 763 | { |
764 | 764 | $indexName = $this->normalizeIdentifier($indexName); |
765 | - if ( ! $this->hasIndex($indexName)) { |
|
765 | + if (!$this->hasIndex($indexName)) { |
|
766 | 766 | throw SchemaException::indexDoesNotExist($indexName, $this->_name); |
767 | 767 | } |
768 | 768 |
@@ -659,7 +659,7 @@ |
||
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 | } |
@@ -32,6 +32,7 @@ |
||
32 | 32 | * Accepts a schema namespace name. |
33 | 33 | * |
34 | 34 | * @param string $namespaceName The schema namespace name to accept. |
35 | + * @return void |
|
35 | 36 | */ |
36 | 37 | public function acceptNamespace($namespaceName); |
37 | 38 | } |
@@ -19,10 +19,10 @@ |
||
19 | 19 | |
20 | 20 | namespace Doctrine\DBAL\Schema\Visitor; |
21 | 21 | |
22 | -use Doctrine\DBAL\Schema\Table; |
|
23 | -use Doctrine\DBAL\Schema\TableDiff; |
|
24 | 22 | use Doctrine\DBAL\Schema\ForeignKeyConstraint; |
25 | 23 | use Doctrine\DBAL\Schema\Sequence; |
24 | +use Doctrine\DBAL\Schema\Table; |
|
25 | +use Doctrine\DBAL\Schema\TableDiff; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Visit a SchemaDiff. |