Skip to content

Commit f097aeb

Browse files
committed
refactor: replace $field with $fields
1 parent 1dd2e96 commit f097aeb

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

system/Database/Forge.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,14 @@ public function addUniqueKey($key, string $keyName = '')
351351
/**
352352
* Add Field
353353
*
354-
* @param array<string, array|string>|string $field
354+
* @param array<string, array|string>|string $fields Field array or Field string
355355
*
356356
* @return Forge
357357
*/
358-
public function addField($field)
358+
public function addField($fields)
359359
{
360-
if (is_string($field)) {
361-
if ($field === 'id') {
360+
if (is_string($fields)) {
361+
if ($fields === 'id') {
362362
$this->addField([
363363
'id' => [
364364
'type' => 'INT',
@@ -368,19 +368,19 @@ public function addField($field)
368368
]);
369369
$this->addKey('id', true);
370370
} else {
371-
if (strpos($field, ' ') === false) {
371+
if (strpos($fields, ' ') === false) {
372372
throw new InvalidArgumentException('Field information is required for that operation.');
373373
}
374374

375-
$fieldName = explode(' ', $field, 2)[0];
375+
$fieldName = explode(' ', $fields, 2)[0];
376376
$fieldName = trim($fieldName, '`\'"');
377377

378-
$this->fields[$fieldName] = $field;
378+
$this->fields[$fieldName] = $fields;
379379
}
380380
}
381381

382-
if (is_array($field)) {
383-
foreach ($field as $name => $attributes) {
382+
if (is_array($fields)) {
383+
foreach ($fields as $name => $attributes) {
384384
if (is_string($attributes)) {
385385
$this->addField($attributes);
386386

@@ -720,19 +720,19 @@ public function renameTable(string $tableName, string $newTableName)
720720
}
721721

722722
/**
723-
* @param array<string, array|string>|string $field
723+
* @param array<string, array|string>|string $fields Field array or Field string
724724
*
725725
* @throws DatabaseException
726726
*/
727-
public function addColumn(string $table, $field): bool
727+
public function addColumn(string $table, $fields): bool
728728
{
729729
// Work-around for literal column definitions
730730
if (! is_array($field)) {
731-
$field = [$field];
731+
$fields = [$fields];
732732
}
733733

734-
foreach (array_keys($field) as $name) {
735-
$this->addField([$name => $field[$name]]);
734+
foreach (array_keys($fields) as $name) {
735+
$this->addField([$name => $fields[$name]]);
736736
}
737737

738738
$sqls = $this->_alterTable('ADD', $this->db->DBPrefix . $table, $this->_processFields());
@@ -777,19 +777,19 @@ public function dropColumn(string $table, $columnNames)
777777
}
778778

779779
/**
780-
* @param array<string, array|string>|string $field
780+
* @param array<string, array|string>|string $fields Field array or Field string
781781
*
782782
* @throws DatabaseException
783783
*/
784-
public function modifyColumn(string $table, $field): bool
784+
public function modifyColumn(string $table, $fields): bool
785785
{
786786
// Work-around for literal column definitions
787787
if (! is_array($field)) {
788-
$field = [$field];
788+
$fields = [$fields];
789789
}
790790

791-
foreach (array_keys($field) as $name) {
792-
$this->addField([$name => $field[$name]]);
791+
foreach (array_keys($fields) as $name) {
792+
$this->addField([$name => $fields[$name]]);
793793
}
794794

795795
if ($this->fields === []) {

0 commit comments

Comments
 (0)