Complex classes like SQLServerPlatform often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use SQLServerPlatform, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 66 | class SQLServerPlatform extends AbstractPlatform |
||
| 67 | { |
||
| 68 | /** |
||
| 69 | * {@inheritdoc} |
||
| 70 | */ |
||
| 71 | public function getCurrentDateSQL() |
||
| 75 | |||
| 76 | /** |
||
| 77 | * {@inheritdoc} |
||
| 78 | */ |
||
| 79 | public function getCurrentTimeSQL() |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Returns an expression that converts an expression of one data type to another. |
||
| 86 | * |
||
| 87 | * @param string $dataType The target native data type. Alias data types cannot be used. |
||
| 88 | * @param string $expression The SQL expression to convert. |
||
| 89 | * |
||
| 90 | * @return string |
||
| 91 | */ |
||
| 92 | private function getConvertExpression($dataType, $expression) |
||
| 96 | |||
| 97 | /** |
||
| 98 | * {@inheritdoc} |
||
| 99 | */ |
||
| 100 | protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit) |
||
| 110 | |||
| 111 | /** |
||
| 112 | * {@inheritDoc} |
||
| 113 | */ |
||
| 114 | public function getDateDiffExpression($date1, $date2) |
||
| 118 | |||
| 119 | /** |
||
| 120 | * {@inheritDoc} |
||
| 121 | * |
||
| 122 | * Microsoft SQL Server prefers "autoincrement" identity columns |
||
| 123 | * since sequences can only be emulated with a table. |
||
| 124 | */ |
||
| 125 | public function prefersIdentityColumns() |
||
| 129 | |||
| 130 | /** |
||
| 131 | * {@inheritDoc} |
||
| 132 | * |
||
| 133 | * Microsoft SQL Server supports this through AUTO_INCREMENT columns. |
||
| 134 | */ |
||
| 135 | public function supportsIdentityColumns() |
||
| 139 | |||
| 140 | /** |
||
| 141 | * {@inheritDoc} |
||
| 142 | */ |
||
| 143 | public function supportsReleaseSavepoints() |
||
| 147 | |||
| 148 | /** |
||
| 149 | * {@inheritdoc} |
||
| 150 | */ |
||
| 151 | public function supportsSchemas() |
||
| 155 | |||
| 156 | /** |
||
| 157 | * {@inheritdoc} |
||
| 158 | */ |
||
| 159 | public function getDefaultSchemaName() |
||
| 163 | |||
| 164 | /** |
||
| 165 | * {@inheritDoc} |
||
| 166 | */ |
||
| 167 | public function supportsColumnCollation() |
||
| 171 | |||
| 172 | /** |
||
| 173 | * {@inheritDoc} |
||
| 174 | */ |
||
| 175 | public function hasNativeGuidType() |
||
| 179 | |||
| 180 | /** |
||
| 181 | * {@inheritDoc} |
||
| 182 | */ |
||
| 183 | public function getCreateDatabaseSQL($name) |
||
| 187 | |||
| 188 | /** |
||
| 189 | * {@inheritDoc} |
||
| 190 | */ |
||
| 191 | public function getDropDatabaseSQL($name) |
||
| 195 | |||
| 196 | /** |
||
| 197 | * {@inheritDoc} |
||
| 198 | */ |
||
| 199 | public function supportsCreateDropDatabase() |
||
| 203 | |||
| 204 | /** |
||
| 205 | * {@inheritDoc} |
||
| 206 | */ |
||
| 207 | public function getCreateSchemaSQL($schemaName) |
||
| 211 | |||
| 212 | /** |
||
| 213 | * {@inheritDoc} |
||
| 214 | */ |
||
| 215 | public function getDropForeignKeySQL($foreignKey, $table) |
||
| 230 | |||
| 231 | /** |
||
| 232 | * {@inheritDoc} |
||
| 233 | */ |
||
| 234 | public function getDropIndexSQL($index, $table = null) |
||
| 255 | |||
| 256 | /** |
||
| 257 | * {@inheritDoc} |
||
| 258 | */ |
||
| 259 | protected function _getCreateTableSQL($tableName, array $columns, array $options = []) |
||
| 322 | |||
| 323 | /** |
||
| 324 | * {@inheritDoc} |
||
| 325 | */ |
||
| 326 | public function getCreatePrimaryKeySQL(Index $index, $table) |
||
| 335 | |||
| 336 | /** |
||
| 337 | * Returns the SQL statement for creating a column comment. |
||
| 338 | * |
||
| 339 | * SQL Server does not support native column comments, |
||
| 340 | * therefore the extended properties functionality is used |
||
| 341 | * as a workaround to store them. |
||
| 342 | * The property name used to store column comments is "MS_Description" |
||
| 343 | * which provides compatibility with SQL Server Management Studio, |
||
| 344 | * as column comments are stored in the same property there when |
||
| 345 | * specifying a column's "Description" attribute. |
||
| 346 | * |
||
| 347 | * @param string $tableName The quoted table name to which the column belongs. |
||
| 348 | * @param string $columnName The quoted column name to create the comment for. |
||
| 349 | * @param string $comment The column's comment. |
||
| 350 | * |
||
| 351 | * @return string |
||
| 352 | */ |
||
| 353 | protected function getCreateColumnCommentSQL($tableName, $columnName, $comment) |
||
| 375 | |||
| 376 | /** |
||
| 377 | * Returns the SQL snippet for declaring a default constraint. |
||
| 378 | * |
||
| 379 | * @param string $table Name of the table to return the default constraint declaration for. |
||
| 380 | * @param array $column Column definition. |
||
| 381 | * |
||
| 382 | * @return string |
||
| 383 | * |
||
| 384 | * @throws \InvalidArgumentException |
||
| 385 | */ |
||
| 386 | public function getDefaultConstraintDeclarationSQL($table, array $column) |
||
| 400 | |||
| 401 | /** |
||
| 402 | * {@inheritDoc} |
||
| 403 | */ |
||
| 404 | public function getUniqueConstraintDeclarationSQL($name, Index $index) |
||
| 412 | |||
| 413 | /** |
||
| 414 | * {@inheritDoc} |
||
| 415 | */ |
||
| 416 | public function getCreateIndexSQL(Index $index, $table) |
||
| 426 | |||
| 427 | /** |
||
| 428 | * {@inheritDoc} |
||
| 429 | */ |
||
| 430 | protected function getCreateIndexSQLFlags(Index $index) |
||
| 445 | |||
| 446 | /** |
||
| 447 | * Extend unique key constraint with required filters |
||
| 448 | * |
||
| 449 | * @param string $sql |
||
| 450 | * @param \Doctrine\DBAL\Schema\Index $index |
||
| 451 | * |
||
| 452 | * @return string |
||
| 453 | */ |
||
| 454 | private function _appendUniqueConstraintDefinition($sql, Index $index) |
||
| 464 | |||
| 465 | /** |
||
| 466 | * {@inheritDoc} |
||
| 467 | */ |
||
| 468 | public function getAlterTableSQL(TableDiff $diff) |
||
| 626 | |||
| 627 | /** |
||
| 628 | * Returns the SQL clause for adding a default constraint in an ALTER TABLE statement. |
||
| 629 | * |
||
| 630 | * @param string $tableName The name of the table to generate the clause for. |
||
| 631 | * @param Column $column The column to generate the clause for. |
||
| 632 | * |
||
| 633 | * @return string |
||
| 634 | */ |
||
| 635 | private function getAlterTableAddDefaultConstraintClause($tableName, Column $column) |
||
| 642 | |||
| 643 | /** |
||
| 644 | * Returns the SQL clause for dropping an existing default constraint in an ALTER TABLE statement. |
||
| 645 | * |
||
| 646 | * @param string $tableName The name of the table to generate the clause for. |
||
| 647 | * @param string $columnName The name of the column to generate the clause for. |
||
| 648 | * |
||
| 649 | * @return string |
||
| 650 | */ |
||
| 651 | private function getAlterTableDropDefaultConstraintClause($tableName, $columnName) |
||
| 655 | |||
| 656 | /** |
||
| 657 | * Checks whether a column alteration requires dropping its default constraint first. |
||
| 658 | * |
||
| 659 | * Different to other database vendors SQL Server implements column default values |
||
| 660 | * as constraints and therefore changes in a column's default value as well as changes |
||
| 661 | * in a column's type require dropping the default constraint first before being to |
||
| 662 | * alter the particular column to the new definition. |
||
| 663 | * |
||
| 664 | * @param ColumnDiff $columnDiff The column diff to evaluate. |
||
| 665 | * |
||
| 666 | * @return bool True if the column alteration requires dropping its default constraint first, false otherwise. |
||
| 667 | */ |
||
| 668 | private function alterColumnRequiresDropDefaultConstraint(ColumnDiff $columnDiff) |
||
| 692 | |||
| 693 | /** |
||
| 694 | * Returns the SQL statement for altering a column comment. |
||
| 695 | * |
||
| 696 | * SQL Server does not support native column comments, |
||
| 697 | * therefore the extended properties functionality is used |
||
| 698 | * as a workaround to store them. |
||
| 699 | * The property name used to store column comments is "MS_Description" |
||
| 700 | * which provides compatibility with SQL Server Management Studio, |
||
| 701 | * as column comments are stored in the same property there when |
||
| 702 | * specifying a column's "Description" attribute. |
||
| 703 | * |
||
| 704 | * @param string $tableName The quoted table name to which the column belongs. |
||
| 705 | * @param string $columnName The quoted column name to alter the comment for. |
||
| 706 | * @param string $comment The column's comment. |
||
| 707 | * |
||
| 708 | * @return string |
||
| 709 | */ |
||
| 710 | protected function getAlterColumnCommentSQL($tableName, $columnName, $comment) |
||
| 732 | |||
| 733 | /** |
||
| 734 | * Returns the SQL statement for dropping a column comment. |
||
| 735 | * |
||
| 736 | * SQL Server does not support native column comments, |
||
| 737 | * therefore the extended properties functionality is used |
||
| 738 | * as a workaround to store them. |
||
| 739 | * The property name used to store column comments is "MS_Description" |
||
| 740 | * which provides compatibility with SQL Server Management Studio, |
||
| 741 | * as column comments are stored in the same property there when |
||
| 742 | * specifying a column's "Description" attribute. |
||
| 743 | * |
||
| 744 | * @param string $tableName The quoted table name to which the column belongs. |
||
| 745 | * @param string $columnName The quoted column name to drop the comment for. |
||
| 746 | * |
||
| 747 | * @return string |
||
| 748 | */ |
||
| 749 | protected function getDropColumnCommentSQL($tableName, $columnName) |
||
| 770 | |||
| 771 | /** |
||
| 772 | * {@inheritdoc} |
||
| 773 | */ |
||
| 774 | protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) |
||
| 785 | |||
| 786 | /** |
||
| 787 | * Returns the SQL statement for adding an extended property to a database object. |
||
| 788 | * |
||
| 789 | * @param string $name The name of the property to add. |
||
| 790 | * @param string|null $value The value of the property to add. |
||
| 791 | * @param string|null $level0Type The type of the object at level 0 the property belongs to. |
||
| 792 | * @param string|null $level0Name The name of the object at level 0 the property belongs to. |
||
| 793 | * @param string|null $level1Type The type of the object at level 1 the property belongs to. |
||
| 794 | * @param string|null $level1Name The name of the object at level 1 the property belongs to. |
||
| 795 | * @param string|null $level2Type The type of the object at level 2 the property belongs to. |
||
| 796 | * @param string|null $level2Name The name of the object at level 2 the property belongs to. |
||
| 797 | * |
||
| 798 | * @return string |
||
| 799 | * |
||
| 800 | * @link http://msdn.microsoft.com/en-us/library/ms180047%28v=sql.90%29.aspx |
||
| 801 | */ |
||
| 802 | public function getAddExtendedPropertySQL( |
||
| 818 | |||
| 819 | /** |
||
| 820 | * Returns the SQL statement for dropping an extended property from a database object. |
||
| 821 | * |
||
| 822 | * @param string $name The name of the property to drop. |
||
| 823 | * @param string|null $level0Type The type of the object at level 0 the property belongs to. |
||
| 824 | * @param string|null $level0Name The name of the object at level 0 the property belongs to. |
||
| 825 | * @param string|null $level1Type The type of the object at level 1 the property belongs to. |
||
| 826 | * @param string|null $level1Name The name of the object at level 1 the property belongs to. |
||
| 827 | * @param string|null $level2Type The type of the object at level 2 the property belongs to. |
||
| 828 | * @param string|null $level2Name The name of the object at level 2 the property belongs to. |
||
| 829 | * |
||
| 830 | * @return string |
||
| 831 | * |
||
| 832 | * @link http://technet.microsoft.com/en-gb/library/ms178595%28v=sql.90%29.aspx |
||
| 833 | */ |
||
| 834 | public function getDropExtendedPropertySQL( |
||
| 849 | |||
| 850 | /** |
||
| 851 | * Returns the SQL statement for updating an extended property of a database object. |
||
| 852 | * |
||
| 853 | * @param string $name The name of the property to update. |
||
| 854 | * @param string|null $value The value of the property to update. |
||
| 855 | * @param string|null $level0Type The type of the object at level 0 the property belongs to. |
||
| 856 | * @param string|null $level0Name The name of the object at level 0 the property belongs to. |
||
| 857 | * @param string|null $level1Type The type of the object at level 1 the property belongs to. |
||
| 858 | * @param string|null $level1Name The name of the object at level 1 the property belongs to. |
||
| 859 | * @param string|null $level2Type The type of the object at level 2 the property belongs to. |
||
| 860 | * @param string|null $level2Name The name of the object at level 2 the property belongs to. |
||
| 861 | * |
||
| 862 | * @return string |
||
| 863 | * |
||
| 864 | * @link http://msdn.microsoft.com/en-us/library/ms186885%28v=sql.90%29.aspx |
||
| 865 | */ |
||
| 866 | public function getUpdateExtendedPropertySQL( |
||
| 882 | |||
| 883 | /** |
||
| 884 | * {@inheritDoc} |
||
| 885 | */ |
||
| 886 | public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName) |
||
| 890 | |||
| 891 | /** |
||
| 892 | * {@inheritDoc} |
||
| 893 | */ |
||
| 894 | public function getListTablesSQL() |
||
| 900 | |||
| 901 | /** |
||
| 902 | * {@inheritDoc} |
||
| 903 | */ |
||
| 904 | public function getListTableColumnsSQL($table, $database = null) |
||
| 933 | |||
| 934 | /** |
||
| 935 | * {@inheritDoc} |
||
| 936 | */ |
||
| 937 | public function getListTableForeignKeysSQL($table, $database = null) |
||
| 955 | |||
| 956 | /** |
||
| 957 | * {@inheritDoc} |
||
| 958 | */ |
||
| 959 | public function getListTableIndexesSQL($table, $currentDatabase = null) |
||
| 978 | |||
| 979 | /** |
||
| 980 | * {@inheritDoc} |
||
| 981 | */ |
||
| 982 | public function getCreateViewSQL($name, $sql) |
||
| 986 | |||
| 987 | /** |
||
| 988 | * {@inheritDoc} |
||
| 989 | */ |
||
| 990 | public function getListViewsSQL($database) |
||
| 994 | |||
| 995 | /** |
||
| 996 | * Returns the where clause to filter schema and table name in a query. |
||
| 997 | * |
||
| 998 | * @param string $table The full qualified name of the table. |
||
| 999 | * @param string $schemaColumn The name of the column to compare the schema to in the where clause. |
||
| 1000 | * @param string $tableColumn The name of the column to compare the table to in the where clause. |
||
| 1001 | * |
||
| 1002 | * @return string |
||
| 1003 | */ |
||
| 1004 | private function getTableWhereClause($table, $schemaColumn, $tableColumn) |
||
| 1017 | |||
| 1018 | /** |
||
| 1019 | * {@inheritDoc} |
||
| 1020 | */ |
||
| 1021 | public function getDropViewSQL($name) |
||
| 1025 | |||
| 1026 | /** |
||
| 1027 | * {@inheritDoc} |
||
| 1028 | * |
||
| 1029 | * @deprecated Use application-generated UUIDs instead |
||
| 1030 | */ |
||
| 1031 | public function getGuidExpression() |
||
| 1035 | |||
| 1036 | /** |
||
| 1037 | * {@inheritDoc} |
||
| 1038 | */ |
||
| 1039 | public function getLocateExpression($str, $substr, $startPos = false) |
||
| 1047 | |||
| 1048 | /** |
||
| 1049 | * {@inheritDoc} |
||
| 1050 | */ |
||
| 1051 | public function getModExpression($expression1, $expression2) |
||
| 1055 | |||
| 1056 | /** |
||
| 1057 | * {@inheritDoc} |
||
| 1058 | */ |
||
| 1059 | public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = false) |
||
| 1099 | |||
| 1100 | /** |
||
| 1101 | * {@inheritDoc} |
||
| 1102 | */ |
||
| 1103 | public function getConcatExpression() |
||
| 1109 | |||
| 1110 | /** |
||
| 1111 | * {@inheritDoc} |
||
| 1112 | */ |
||
| 1113 | public function getListDatabasesSQL() |
||
| 1117 | |||
| 1118 | /** |
||
| 1119 | * {@inheritDoc} |
||
| 1120 | */ |
||
| 1121 | public function getListNamespacesSQL() |
||
| 1125 | |||
| 1126 | /** |
||
| 1127 | * {@inheritDoc} |
||
| 1128 | */ |
||
| 1129 | public function getSubstringExpression($value, $from, $length = null) |
||
| 1137 | |||
| 1138 | /** |
||
| 1139 | * {@inheritDoc} |
||
| 1140 | */ |
||
| 1141 | public function getLengthExpression($column) |
||
| 1145 | |||
| 1146 | /** |
||
| 1147 | * {@inheritDoc} |
||
| 1148 | */ |
||
| 1149 | public function getSetTransactionIsolationSQL($level) |
||
| 1153 | |||
| 1154 | /** |
||
| 1155 | * {@inheritDoc} |
||
| 1156 | */ |
||
| 1157 | public function getIntegerTypeDeclarationSQL(array $field) |
||
| 1161 | |||
| 1162 | /** |
||
| 1163 | * {@inheritDoc} |
||
| 1164 | */ |
||
| 1165 | public function getBigIntTypeDeclarationSQL(array $field) |
||
| 1169 | |||
| 1170 | /** |
||
| 1171 | * {@inheritDoc} |
||
| 1172 | */ |
||
| 1173 | public function getSmallIntTypeDeclarationSQL(array $field) |
||
| 1177 | |||
| 1178 | /** |
||
| 1179 | * {@inheritDoc} |
||
| 1180 | */ |
||
| 1181 | public function getGuidTypeDeclarationSQL(array $field) |
||
| 1185 | |||
| 1186 | /** |
||
| 1187 | * {@inheritDoc} |
||
| 1188 | */ |
||
| 1189 | protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) |
||
| 1193 | |||
| 1194 | /** |
||
| 1195 | * {@inheritdoc} |
||
| 1196 | */ |
||
| 1197 | protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) |
||
| 1201 | |||
| 1202 | /** |
||
| 1203 | * {@inheritdoc} |
||
| 1204 | */ |
||
| 1205 | public function getBinaryMaxLength() |
||
| 1209 | |||
| 1210 | /** |
||
| 1211 | * {@inheritDoc} |
||
| 1212 | */ |
||
| 1213 | public function getClobTypeDeclarationSQL(array $field) |
||
| 1217 | |||
| 1218 | /** |
||
| 1219 | * {@inheritDoc} |
||
| 1220 | */ |
||
| 1221 | protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) |
||
| 1225 | |||
| 1226 | /** |
||
| 1227 | * {@inheritDoc} |
||
| 1228 | */ |
||
| 1229 | public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) |
||
| 1233 | |||
| 1234 | /** |
||
| 1235 | * {@inheritDoc} |
||
| 1236 | */ |
||
| 1237 | public function getDateTypeDeclarationSQL(array $fieldDeclaration) |
||
| 1241 | |||
| 1242 | /** |
||
| 1243 | * {@inheritDoc} |
||
| 1244 | */ |
||
| 1245 | public function getTimeTypeDeclarationSQL(array $fieldDeclaration) |
||
| 1249 | |||
| 1250 | /** |
||
| 1251 | * {@inheritDoc} |
||
| 1252 | */ |
||
| 1253 | public function getBooleanTypeDeclarationSQL(array $field) |
||
| 1257 | |||
| 1258 | /** |
||
| 1259 | * {@inheritDoc} |
||
| 1260 | */ |
||
| 1261 | protected function doModifyLimitQuery($query, $limit, $offset = null) |
||
| 1305 | |||
| 1306 | /** |
||
| 1307 | * Remove ORDER BY clauses in subqueries - they're not supported by SQL Server. |
||
| 1308 | * Caveat: will leave ORDER BY in TOP N subqueries. |
||
| 1309 | * |
||
| 1310 | * @param string $query |
||
| 1311 | * @return string |
||
| 1312 | */ |
||
| 1313 | private function scrubInnerOrderBy($query) |
||
| 1352 | |||
| 1353 | /** |
||
| 1354 | * Check an ORDER BY clause to see if it is in a TOP N query or subquery. |
||
| 1355 | * |
||
| 1356 | * @param string $query The query |
||
| 1357 | * @param int $currentPosition Start position of ORDER BY clause |
||
| 1358 | * @return bool true if ORDER BY is in a TOP N query, false otherwise |
||
| 1359 | */ |
||
| 1360 | private function isOrderByInTopNSubquery($query, $currentPosition) |
||
| 1383 | |||
| 1384 | /** |
||
| 1385 | * {@inheritDoc} |
||
| 1386 | */ |
||
| 1387 | public function supportsLimitOffset() |
||
| 1391 | |||
| 1392 | /** |
||
| 1393 | * {@inheritDoc} |
||
| 1394 | */ |
||
| 1395 | public function convertBooleans($item) |
||
| 1409 | |||
| 1410 | /** |
||
| 1411 | * {@inheritDoc} |
||
| 1412 | */ |
||
| 1413 | public function getCreateTemporaryTableSnippetSQL() |
||
| 1417 | |||
| 1418 | /** |
||
| 1419 | * {@inheritDoc} |
||
| 1420 | */ |
||
| 1421 | public function getTemporaryTableName($tableName) |
||
| 1425 | |||
| 1426 | /** |
||
| 1427 | * {@inheritDoc} |
||
| 1428 | */ |
||
| 1429 | public function getDateTimeFormatString() |
||
| 1433 | |||
| 1434 | /** |
||
| 1435 | * {@inheritDoc} |
||
| 1436 | */ |
||
| 1437 | public function getDateFormatString() |
||
| 1441 | |||
| 1442 | /** |
||
| 1443 | * {@inheritDoc} |
||
| 1444 | */ |
||
| 1445 | public function getTimeFormatString() |
||
| 1449 | |||
| 1450 | /** |
||
| 1451 | * {@inheritDoc} |
||
| 1452 | */ |
||
| 1453 | public function getDateTimeTzFormatString() |
||
| 1457 | |||
| 1458 | /** |
||
| 1459 | * {@inheritDoc} |
||
| 1460 | */ |
||
| 1461 | public function getName() |
||
| 1465 | |||
| 1466 | /** |
||
| 1467 | * {@inheritDoc} |
||
| 1468 | */ |
||
| 1469 | protected function initializeDoctrineTypeMappings() |
||
| 1499 | |||
| 1500 | /** |
||
| 1501 | * {@inheritDoc} |
||
| 1502 | */ |
||
| 1503 | public function createSavePoint($savepoint) |
||
| 1507 | |||
| 1508 | /** |
||
| 1509 | * {@inheritDoc} |
||
| 1510 | */ |
||
| 1511 | public function releaseSavePoint($savepoint) |
||
| 1515 | |||
| 1516 | /** |
||
| 1517 | * {@inheritDoc} |
||
| 1518 | */ |
||
| 1519 | public function rollbackSavePoint($savepoint) |
||
| 1523 | |||
| 1524 | /** |
||
| 1525 | * {@inheritdoc} |
||
| 1526 | */ |
||
| 1527 | public function getForeignKeyReferentialActionSQL($action) |
||
| 1536 | |||
| 1537 | /** |
||
| 1538 | * {@inheritDoc} |
||
| 1539 | */ |
||
| 1540 | public function appendLockHint($fromClause, $lockMode) |
||
| 1556 | |||
| 1557 | /** |
||
| 1558 | * {@inheritDoc} |
||
| 1559 | */ |
||
| 1560 | public function getForUpdateSQL() |
||
| 1564 | |||
| 1565 | /** |
||
| 1566 | * {@inheritDoc} |
||
| 1567 | */ |
||
| 1568 | protected function getReservedKeywordsClass() |
||
| 1572 | |||
| 1573 | /** |
||
| 1574 | * {@inheritDoc} |
||
| 1575 | */ |
||
| 1576 | public function quoteSingleIdentifier($str) |
||
| 1580 | |||
| 1581 | /** |
||
| 1582 | * {@inheritDoc} |
||
| 1583 | */ |
||
| 1584 | public function getTruncateTableSQL($tableName, $cascade = false) |
||
| 1590 | |||
| 1591 | /** |
||
| 1592 | * {@inheritDoc} |
||
| 1593 | */ |
||
| 1594 | public function getBlobTypeDeclarationSQL(array $field) |
||
| 1598 | |||
| 1599 | /** |
||
| 1600 | * {@inheritDoc} |
||
| 1601 | */ |
||
| 1602 | public function getDefaultValueDeclarationSQL($field) |
||
| 1628 | |||
| 1629 | /** |
||
| 1630 | * {@inheritdoc} |
||
| 1631 | * |
||
| 1632 | * Modifies column declaration order as it differs in Microsoft SQL Server. |
||
| 1633 | */ |
||
| 1634 | public function getColumnDeclarationSQL($name, array $field) |
||
| 1656 | |||
| 1657 | /** |
||
| 1658 | * Returns a unique default constraint name for a table and column. |
||
| 1659 | * |
||
| 1660 | * @param string $table Name of the table to generate the unique default constraint name for. |
||
| 1661 | * @param string $column Name of the column in the table to generate the unique default constraint name for. |
||
| 1662 | * |
||
| 1663 | * @return string |
||
| 1664 | */ |
||
| 1665 | private function generateDefaultConstraintName($table, $column) |
||
| 1669 | |||
| 1670 | /** |
||
| 1671 | * Returns a hash value for a given identifier. |
||
| 1672 | * |
||
| 1673 | * @param string $identifier Identifier to generate a hash value for. |
||
| 1674 | * |
||
| 1675 | * @return string |
||
| 1676 | */ |
||
| 1677 | private function generateIdentifierName($identifier) |
||
| 1684 | } |
||
| 1685 |
This error can happen if you refactor code and forget to move the variable initialization.
Let’s take a look at a simple example:
The above code is perfectly fine. Now imagine that we re-order the statements:
In that case,
$xwould be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.