Skip to content

Commit

Permalink
fix docbloc (#19071)
Browse files Browse the repository at this point in the history
* fix docbloc

* doc bloc : apply proposed changes

* Update src/Migration.php

---------

Co-authored-by: Cédric Anne <[email protected]>
  • Loading branch information
SebSept and cedric-anne authored Mar 6, 2025
1 parent 1bdc49a commit 12f8c28
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -3712,7 +3712,7 @@
$ignoreErrors[] = [
'message' => '#^Call to function is_array\\(\\) with array will always evaluate to true\\.$#',
'identifier' => 'function.alreadyNarrowedType',
'count' => 3,
'count' => 2,
'path' => __DIR__ . '/src/Migration.php',
];
$ignoreErrors[] = [
Expand Down
6 changes: 0 additions & 6 deletions src/CommonDropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ abstract class CommonDropdown extends CommonDBTM

public static $rightname = 'dropdown';


/**
* @since 0.85
*
* @param $nb
**/
public static function getTypeName($nb = 0)
{
return _n('Dropdown', 'Dropdowns', $nb);
Expand Down
16 changes: 6 additions & 10 deletions src/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ public function displayError(string $message): void
}

/**
* Define field's format
* Get formated SQL field
*
* @param string $type can be bool, char, string, integer, date, datetime, text, longtext or autoincrement
* @param string $type can be "bool"|"boolean", "char"|"character", "str"|"string", "int"|"integer", "date", "time", "timestamp"|"datetime", "text"|"mediumtext"|"longtext", "autoincrement", "fkey", "json", or a complete type definition like "decimal(20,4) NOT NULL DEFAULT '0.0000'"
* @param string $default_value new field's default value,
* if a specific default value needs to be used
* @param boolean $nodefault No default value (false by default)
Expand Down Expand Up @@ -382,9 +382,9 @@ private function fieldFormat($type, $default_value, $nodefault = false): string
* @param string $table Table name
* @param string $field Field name
* @param string $type Field type, @see Migration::fieldFormat()
* @param array $options Options:
* - update : if not empty = value of $field (must be protected)
* - condition : if needed
* @param array{update?: string, condition?: string, value?: string, nodefault?: bool, comment?: string, first?: string, after?: string, null?: bool} $options
* - update : value to set after field creation (update query)
* - condition : sql condition to apply for update query
* - value : default_value new field's default value, if a specific default value needs to be used
* - nodefault : do not define default value (default false)
* - comment : comment to be added during field creation
Expand All @@ -408,11 +408,7 @@ public function addField($table, $field, $type, $options = [])
$params['first'] = '';
$params['null'] = false;

if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
$params = array_merge($params, $options);

$format = $this->fieldFormat($type, $params['value'], $params['nodefault']);

Expand Down

0 comments on commit 12f8c28

Please sign in to comment.