Skip to content

Commit e4b18a4

Browse files
authored
Merge pull request #3392 from LukasVitek/fix/Table_createIndex
fixed annotations of parameter $columns in Table
2 parents 2b8513d + 438b052 commit e4b18a4

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

lib/Doctrine/DBAL/Schema/Table.php

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
use function array_filter;
1010
use function array_merge;
1111
use function in_array;
12-
use function is_numeric;
13-
use function is_string;
1412
use function preg_match;
1513
use function strlen;
1614
use function strtolower;
@@ -100,16 +98,16 @@ protected function _getMaxIdentifierLength()
10098
/**
10199
* Sets the Primary Key.
102100
*
103-
* @param mixed[][] $columns
101+
* @param string[] $columnNames
104102
* @param string|bool $indexName
105103
*
106104
* @return self
107105
*/
108-
public function setPrimaryKey(array $columns, $indexName = false)
106+
public function setPrimaryKey(array $columnNames, $indexName = false)
109107
{
110-
$this->_addIndex($this->_createIndex($columns, $indexName ?: 'primary', true, true));
108+
$this->_addIndex($this->_createIndex($columnNames, $indexName ?: 'primary', true, true));
111109

112-
foreach ($columns as $columnName) {
110+
foreach ($columnNames as $columnName) {
113111
$column = $this->getColumn($columnName);
114112
$column->setNotnull(true);
115113
}
@@ -118,7 +116,7 @@ public function setPrimaryKey(array $columns, $indexName = false)
118116
}
119117

120118
/**
121-
* @param mixed[][] $columnNames
119+
* @param string[] $columnNames
122120
* @param string|null $indexName
123121
* @param string[] $flags
124122
* @param mixed[] $options
@@ -168,7 +166,7 @@ public function dropIndex($indexName)
168166
}
169167

170168
/**
171-
* @param mixed[][] $columnNames
169+
* @param string[] $columnNames
172170
* @param string|null $indexName
173171
* @param mixed[] $options
174172
*
@@ -236,15 +234,15 @@ public function renameIndex($oldIndexName, $newIndexName = null)
236234
/**
237235
* Checks if an index begins in the order of the given columns.
238236
*
239-
* @param mixed[][] $columnsNames
237+
* @param string[] $columnNames
240238
*
241239
* @return bool
242240
*/
243-
public function columnsAreIndexed(array $columnsNames)
241+
public function columnsAreIndexed(array $columnNames)
244242
{
245243
foreach ($this->getIndexes() as $index) {
246244
/** @var $index Index */
247-
if ($index->spansColumns($columnsNames)) {
245+
if ($index->spansColumns($columnNames)) {
248246
return true;
249247
}
250248
}
@@ -253,12 +251,12 @@ public function columnsAreIndexed(array $columnsNames)
253251
}
254252

255253
/**
256-
* @param mixed[][] $columnNames
257-
* @param string $indexName
258-
* @param bool $isUnique
259-
* @param bool $isPrimary
260-
* @param string[] $flags
261-
* @param mixed[] $options
254+
* @param string[] $columnNames
255+
* @param string $indexName
256+
* @param bool $isUnique
257+
* @param bool $isPrimary
258+
* @param string[] $flags
259+
* @param mixed[] $options
262260
*
263261
* @return Index
264262
*
@@ -270,11 +268,7 @@ private function _createIndex(array $columnNames, $indexName, $isUnique, $isPrim
270268
throw SchemaException::indexNameInvalid($indexName);
271269
}
272270

273-
foreach ($columnNames as $columnName => $indexColOptions) {
274-
if (is_numeric($columnName) && is_string($indexColOptions)) {
275-
$columnName = $indexColOptions;
276-
}
277-
271+
foreach ($columnNames as $columnName) {
278272
if (! $this->hasColumn($columnName)) {
279273
throw SchemaException::columnDoesNotExist($columnName, $this->_name);
280274
}

0 commit comments

Comments
 (0)