Skip to content

Commit e1e4913

Browse files
authored
[12.x] add generics to array types for Schema Grammars (#55314)
1 parent 8448fa2 commit e1e4913

File tree

6 files changed

+25
-67
lines changed

6 files changed

+25
-67
lines changed

src/Illuminate/Database/Schema/Grammars/Grammar.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function compileForeignKeys($schema, $table)
169169
*
170170
* @param \Illuminate\Database\Schema\Blueprint $blueprint
171171
* @param \Illuminate\Support\Fluent $command
172-
* @return array|string
172+
* @return list<string>|string
173173
*/
174174
public function compileRenameColumn(Blueprint $blueprint, Fluent $command)
175175
{
@@ -185,7 +185,7 @@ public function compileRenameColumn(Blueprint $blueprint, Fluent $command)
185185
*
186186
* @param \Illuminate\Database\Schema\Blueprint $blueprint
187187
* @param \Illuminate\Support\Fluent $command
188-
* @return array|string
188+
* @return list<string>|string
189189
*
190190
* @throws \RuntimeException
191191
*/
@@ -427,8 +427,8 @@ protected function hasCommand(Blueprint $blueprint, $name)
427427
* Add a prefix to an array of values.
428428
*
429429
* @param string $prefix
430-
* @param array $values
431-
* @return array
430+
* @param array<string> $values
431+
* @return array<string>
432432
*/
433433
public function prefixArray($prefix, array $values)
434434
{

src/Illuminate/Database/Schema/Grammars/MariaDbGrammar.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77

88
class MariaDbGrammar extends MySqlGrammar
99
{
10-
/**
11-
* Compile a rename column command.
12-
*
13-
* @param \Illuminate\Database\Schema\Blueprint $blueprint
14-
* @param \Illuminate\Support\Fluent $command
15-
* @return array|string
16-
*/
10+
/** @inheritDoc */
1711
public function compileRenameColumn(Blueprint $blueprint, Fluent $command)
1812
{
1913
if (version_compare($this->connection->getServerVersion(), '10.5.2', '<')) {

src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,7 @@ public function compileAutoIncrementStartingValues(Blueprint $blueprint, Fluent
331331
}
332332
}
333333

334-
/**
335-
* Compile a rename column command.
336-
*
337-
* @param \Illuminate\Database\Schema\Blueprint $blueprint
338-
* @param \Illuminate\Support\Fluent $command
339-
* @return array|string
340-
*/
334+
/** @inheritDoc */
341335
public function compileRenameColumn(Blueprint $blueprint, Fluent $command)
342336
{
343337
$isMaria = $this->connection->isMaria();
@@ -396,13 +390,7 @@ protected function compileLegacyRenameColumn(Blueprint $blueprint, Fluent $comma
396390
);
397391
}
398392

399-
/**
400-
* Compile a change column command into a series of SQL statements.
401-
*
402-
* @param \Illuminate\Database\Schema\Blueprint $blueprint
403-
* @param \Illuminate\Support\Fluent $command
404-
* @return array|string
405-
*/
393+
/** @inheritDoc */
406394
public function compileChange(Blueprint $blueprint, Fluent $command)
407395
{
408396
$column = $command->column;
@@ -650,7 +638,7 @@ public function compileRenameIndex(Blueprint $blueprint, Fluent $command)
650638
/**
651639
* Compile the SQL needed to drop all tables.
652640
*
653-
* @param array $tables
641+
* @param array<string> $tables
654642
* @return string
655643
*/
656644
public function compileDropAllTables($tables)
@@ -661,7 +649,7 @@ public function compileDropAllTables($tables)
661649
/**
662650
* Compile the SQL needed to drop all views.
663651
*
664-
* @param array $views
652+
* @param array<string> $views
665653
* @return string
666654
*/
667655
public function compileDropAllViews($views)
@@ -707,8 +695,8 @@ public function compileTableComment(Blueprint $blueprint, Fluent $command)
707695
/**
708696
* Quote-escape the given tables, views, or types.
709697
*
710-
* @param array $names
711-
* @return array
698+
* @param array<string> $names
699+
* @return array<string>
712700
*/
713701
public function escapeNames($names)
714702
{

src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,7 @@ public function compileAutoIncrementStartingValues(Blueprint $blueprint, Fluent
277277
}
278278
}
279279

280-
/**
281-
* Compile a change column command into a series of SQL statements.
282-
*
283-
* @param \Illuminate\Database\Schema\Blueprint $blueprint
284-
* @param \Illuminate\Support\Fluent $command
285-
* @return array|string
286-
*/
280+
/** @inheritDoc */
287281
public function compileChange(Blueprint $blueprint, Fluent $command)
288282
{
289283
$column = $command->column;
@@ -465,7 +459,7 @@ public function compileDropIfExists(Blueprint $blueprint, Fluent $command)
465459
/**
466460
* Compile the SQL needed to drop all tables.
467461
*
468-
* @param array $tables
462+
* @param array<string> $tables
469463
* @return string
470464
*/
471465
public function compileDropAllTables($tables)
@@ -476,7 +470,7 @@ public function compileDropAllTables($tables)
476470
/**
477471
* Compile the SQL needed to drop all views.
478472
*
479-
* @param array $views
473+
* @param array<string> $views
480474
* @return string
481475
*/
482476
public function compileDropAllViews($views)
@@ -487,7 +481,7 @@ public function compileDropAllViews($views)
487481
/**
488482
* Compile the SQL needed to drop all types.
489483
*
490-
* @param array $types
484+
* @param array<string> $types
491485
* @return string
492486
*/
493487
public function compileDropAllTypes($types)
@@ -498,7 +492,7 @@ public function compileDropAllTypes($types)
498492
/**
499493
* Compile the SQL needed to drop all domains.
500494
*
501-
* @param array $domains
495+
* @param array<string> $domains
502496
* @return string
503497
*/
504498
public function compileDropAllDomains($domains)
@@ -684,8 +678,8 @@ public function compileTableComment(Blueprint $blueprint, Fluent $command)
684678
/**
685679
* Quote-escape the given tables, views, or types.
686680
*
687-
* @param array $names
688-
* @return array
681+
* @param array<string> $names
682+
* @return array<string>
689683
*/
690684
public function escapeNames($names)
691685
{
@@ -1231,7 +1225,7 @@ protected function modifyStoredAs(Blueprint $blueprint, Fluent $column)
12311225
*
12321226
* @param \Illuminate\Database\Schema\Blueprint $blueprint
12331227
* @param \Illuminate\Support\Fluent $column
1234-
* @return string|array|null
1228+
* @return string|list<string>|null
12351229
*/
12361230
protected function modifyGeneratedAs(Blueprint $blueprint, Fluent $column)
12371231
{

src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ public function compileAdd(Blueprint $blueprint, Fluent $command)
319319
*
320320
* @param \Illuminate\Database\Schema\Blueprint $blueprint
321321
* @param \Illuminate\Support\Fluent $command
322-
* @return array|string
322+
* @return list<string>|string
323323
*/
324324
public function compileAlter(Blueprint $blueprint, Fluent $command)
325325
{
@@ -370,13 +370,7 @@ public function compileAlter(Blueprint $blueprint, Fluent $command)
370370
], $indexes, [$foreignKeyConstraintsEnabled ? $this->compileEnableForeignKeyConstraints() : null]));
371371
}
372372

373-
/**
374-
* Compile a change column command into a series of SQL statements.
375-
*
376-
* @param \Illuminate\Database\Schema\Blueprint $blueprint
377-
* @param \Illuminate\Support\Fluent $command
378-
* @return array|string
379-
*/
373+
/** @inheritDoc */
380374
public function compileChange(Blueprint $blueprint, Fluent $command)
381375
{
382376
// Handled on table alteration...
@@ -526,7 +520,7 @@ public function compileRebuild($schema = null)
526520
*
527521
* @param \Illuminate\Database\Schema\Blueprint $blueprint
528522
* @param \Illuminate\Support\Fluent $command
529-
* @return array|null
523+
* @return list<string>|null
530524
*/
531525
public function compileDropColumn(Blueprint $blueprint, Fluent $command)
532526
{

src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,7 @@ public function compileAdd(Blueprint $blueprint, Fluent $command)
226226
);
227227
}
228228

229-
/**
230-
* Compile a rename column command.
231-
*
232-
* @param \Illuminate\Database\Schema\Blueprint $blueprint
233-
* @param \Illuminate\Support\Fluent $command
234-
* @return array|string
235-
*/
229+
/** @inheritDoc */
236230
public function compileRenameColumn(Blueprint $blueprint, Fluent $command)
237231
{
238232
return sprintf("sp_rename %s, %s, N'COLUMN'",
@@ -241,13 +235,7 @@ public function compileRenameColumn(Blueprint $blueprint, Fluent $command)
241235
);
242236
}
243237

244-
/**
245-
* Compile a change column command into a series of SQL statements.
246-
*
247-
* @param \Illuminate\Database\Schema\Blueprint $blueprint
248-
* @param \Illuminate\Support\Fluent $command
249-
* @return array|string
250-
*/
238+
/** @inheritDoc */
251239
public function compileChange(Blueprint $blueprint, Fluent $command)
252240
{
253241
return [
@@ -1033,7 +1021,7 @@ protected function modifyPersisted(Blueprint $blueprint, Fluent $column)
10331021
/**
10341022
* Quote the given string literal.
10351023
*
1036-
* @param string|array $value
1024+
* @param string|array<string> $value
10371025
* @return string
10381026
*/
10391027
public function quoteString($value)

0 commit comments

Comments
 (0)