Merge pull request #18203 from kamil-tekiela/first-class-callable
Use first class callables
This commit is contained in:
commit
802d8f13b6
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Config;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
use function __;
|
||||
@ -183,7 +184,7 @@ class Validator
|
||||
$result[$key] = [];
|
||||
}
|
||||
|
||||
$errorList = array_map('PhpMyAdmin\Sanitize::sanitizeMessage', (array) $errorList);
|
||||
$errorList = array_map(Sanitize::sanitizeMessage(...), (array) $errorList);
|
||||
$result[$key] = array_merge($result[$key], $errorList);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ use PhpMyAdmin\Template;
|
||||
|
||||
use function array_map;
|
||||
use function explode;
|
||||
use function intval;
|
||||
use function is_string;
|
||||
|
||||
final class ColumnPreferencesController extends AbstractController
|
||||
@ -41,14 +42,14 @@ final class ColumnPreferencesController extends AbstractController
|
||||
// set column order
|
||||
$colorder = $request->getParsedBodyParam('col_order');
|
||||
if (is_string($colorder)) {
|
||||
$propertyValue = array_map('intval', explode(',', $colorder));
|
||||
$propertyValue = array_map(intval(...), explode(',', $colorder));
|
||||
$status = $tableObject->setUiProp(Table::PROP_COLUMN_ORDER, $propertyValue, $tableCreateTime);
|
||||
}
|
||||
|
||||
// set column visibility
|
||||
$colvisib = $request->getParsedBodyParam('col_visib');
|
||||
if ($status === true && is_string($colvisib)) {
|
||||
$propertyValue = array_map('intval', explode(',', $colvisib));
|
||||
$propertyValue = array_map(intval(...), explode(',', $colvisib));
|
||||
$status = $tableObject->setUiProp(Table::PROP_COLUMN_ORDER, $propertyValue, $tableCreateTime);
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ use function in_array;
|
||||
use function is_array;
|
||||
use function mb_strlen;
|
||||
use function sprintf;
|
||||
use function trim;
|
||||
|
||||
final class TrackingController extends AbstractController
|
||||
{
|
||||
@ -118,7 +119,7 @@ final class TrackingController extends AbstractController
|
||||
/** @var string $users */
|
||||
$users = $request->getParsedBodyParam('users', '*');
|
||||
|
||||
$GLOBALS['filter_users'] = array_map('trim', explode(',', $users));
|
||||
$GLOBALS['filter_users'] = array_map(trim(...), explode(',', $users));
|
||||
}
|
||||
|
||||
$dateFrom ??= new DateTimeImmutable();
|
||||
|
||||
@ -19,6 +19,7 @@ use function mb_convert_kana;
|
||||
use function mb_detect_encoding;
|
||||
use function mb_list_encodings;
|
||||
use function recode_string;
|
||||
use function strtolower;
|
||||
use function tempnam;
|
||||
use function unlink;
|
||||
|
||||
@ -340,7 +341,7 @@ class Encoding
|
||||
}
|
||||
|
||||
return array_intersect(
|
||||
array_map('strtolower', mb_list_encodings()),
|
||||
array_map(strtolower(...), mb_list_encodings()),
|
||||
$GLOBALS['cfg']['AvailableCharsets'],
|
||||
);
|
||||
}
|
||||
|
||||
@ -233,8 +233,7 @@ class Privileges
|
||||
) {
|
||||
// Required for proper escaping of ` (backtick) in a column name
|
||||
$grantCols = array_map(
|
||||
/** @param string $val */
|
||||
static fn ($val): string => Util::backquote($val),
|
||||
Util::backquote(...),
|
||||
$GLOBALS[$currentGrant[0]],
|
||||
);
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ use function explode;
|
||||
use function htmlspecialchars;
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function intval;
|
||||
use function is_array;
|
||||
use function is_numeric;
|
||||
use function is_string;
|
||||
@ -1836,7 +1837,7 @@ class Table implements Stringable
|
||||
|
||||
// check if the table has not been modified
|
||||
if ($this->getStatusInfo('Create_time') == $this->uiprefs['CREATE_TIME']) {
|
||||
return array_map('intval', $this->uiprefs[$property]);
|
||||
return array_map(intval(...), $this->uiprefs[$property]);
|
||||
}
|
||||
|
||||
// remove the property, since the table has been modified
|
||||
|
||||
@ -2370,7 +2370,7 @@ class Util
|
||||
$disabled = ini_get('disable_functions');
|
||||
if (is_string($disabled)) {
|
||||
$disabled = explode(',', $disabled);
|
||||
$disabled = array_map(static fn (string $part) => trim($part), $disabled);
|
||||
$disabled = array_map(trim(...), $disabled);
|
||||
|
||||
return ! in_array('error_reporting', $disabled);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ namespace PhpMyAdmin\Utils;
|
||||
use function array_map;
|
||||
use function bin2hex;
|
||||
use function mb_strtolower;
|
||||
use function mb_strtoupper;
|
||||
use function preg_match;
|
||||
use function trim;
|
||||
|
||||
@ -78,7 +79,7 @@ final class Gis
|
||||
'geometrycollection',
|
||||
];
|
||||
if ($upperCase) {
|
||||
return array_map('mb_strtoupper', $gisDataTypes);
|
||||
return array_map(mb_strtoupper(...), $gisDataTypes);
|
||||
}
|
||||
|
||||
return $gisDataTypes;
|
||||
|
||||
@ -668,7 +668,6 @@
|
||||
<code>$uv[$i]</code>
|
||||
<code>$values[$path]</code>
|
||||
<code>$vid</code>
|
||||
<code>(array) $errorList</code>
|
||||
<code><![CDATA[empty($values['Servers/1/controlpass']) ? '' : $values['Servers/1/controlpass']]]></code>
|
||||
<code><![CDATA[empty($values['Servers/1/controluser']) ? '' : $values['Servers/1/controluser']]]></code>
|
||||
<code><![CDATA[empty($values['Servers/1/host']) ? '' : $values['Servers/1/host']]]></code>
|
||||
@ -13217,7 +13216,6 @@
|
||||
<code><![CDATA[$row['Field']]]></code>
|
||||
<code><![CDATA[$row['Type']]]></code>
|
||||
<code><![CDATA[$row['Type']]]></code>
|
||||
<code><![CDATA[$this->uiprefs[$property]]]></code>
|
||||
<code><![CDATA[$trigger['create']]]></code>
|
||||
<code><![CDATA[$trigger['name']]]></code>
|
||||
</MixedArrayAccess>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user