Improve boolean conditions with arrays (#18417)
* Remove empty() on array Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Remove boolean count() Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> --------- Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
64b0fd54c7
commit
4ec3b99ba3
@ -12,7 +12,6 @@ use PhpMyAdmin\Charsets\Collation;
|
||||
|
||||
use function __;
|
||||
use function array_keys;
|
||||
use function count;
|
||||
use function explode;
|
||||
use function is_string;
|
||||
use function ksort;
|
||||
@ -74,7 +73,7 @@ class Charsets
|
||||
private static function loadCharsets(DatabaseInterface $dbi, bool $disableIs): void
|
||||
{
|
||||
/* Data already loaded */
|
||||
if (count(self::$charsets) > 0) {
|
||||
if (self::$charsets !== []) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -106,7 +105,7 @@ class Charsets
|
||||
private static function loadCollations(DatabaseInterface $dbi, bool $disableIs): void
|
||||
{
|
||||
/* Data already loaded */
|
||||
if (count(self::$collations) > 0) {
|
||||
if (self::$collations !== []) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@ namespace PhpMyAdmin\Charsets;
|
||||
|
||||
use function __;
|
||||
use function _pgettext;
|
||||
use function count;
|
||||
use function explode;
|
||||
use function implode;
|
||||
|
||||
@ -238,7 +237,7 @@ final class Collation
|
||||
$result .= ' (' . $variant . ')';
|
||||
}
|
||||
|
||||
if (count($suffixes) > 0) {
|
||||
if ($suffixes !== []) {
|
||||
$result .= ', ' . implode(', ', $suffixes);
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,6 @@ use function __;
|
||||
use function array_flip;
|
||||
use function array_keys;
|
||||
use function array_search;
|
||||
use function count;
|
||||
use function explode;
|
||||
use function function_exists;
|
||||
use function gettype;
|
||||
@ -155,7 +154,7 @@ class FormDisplay
|
||||
}
|
||||
|
||||
// save forms
|
||||
if (count($this->forms) > 0) {
|
||||
if ($this->forms !== []) {
|
||||
return $this->save(array_keys($this->forms), $allowPartialSave);
|
||||
}
|
||||
|
||||
@ -187,7 +186,7 @@ class FormDisplay
|
||||
$errors = Validator::validate($this->configFile, $paths, $values, false);
|
||||
|
||||
// change error keys from canonical paths to work paths
|
||||
if (is_array($errors) && count($errors) > 0) {
|
||||
if (is_array($errors) && $errors !== []) {
|
||||
$this->errors = [];
|
||||
foreach ($errors as $path => $errorList) {
|
||||
$workPath = array_search($path, $this->systemPaths);
|
||||
|
||||
@ -15,7 +15,6 @@ use PhpMyAdmin\Config\Settings\Transformations;
|
||||
|
||||
use function __;
|
||||
use function array_map;
|
||||
use function count;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
@ -3548,7 +3547,7 @@ final class Settings
|
||||
return (string) $settings['NavigationTreeTableSeparator'];
|
||||
}
|
||||
|
||||
if (count($settings['NavigationTreeTableSeparator']) > 0) {
|
||||
if ($settings['NavigationTreeTableSeparator'] !== []) {
|
||||
$navigationTreeTableSeparator = [];
|
||||
/** @var mixed $separator */
|
||||
foreach ($settings['NavigationTreeTableSeparator'] as $separator) {
|
||||
|
||||
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Config\Settings;
|
||||
|
||||
use function count;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
|
||||
@ -1382,7 +1381,7 @@ final class Server
|
||||
if (isset($server['only_db'])) {
|
||||
if (! is_array($server['only_db'])) {
|
||||
$onlyDb = (string) $server['only_db'];
|
||||
} elseif (count($server['only_db']) > 0) {
|
||||
} elseif ($server['only_db'] !== []) {
|
||||
$onlyDb = [];
|
||||
/** @var mixed $database */
|
||||
foreach ($server['only_db'] as $database) {
|
||||
|
||||
@ -1669,7 +1669,7 @@ class Relation
|
||||
// an array
|
||||
$resRel = $this->getForeigners($db, $table);
|
||||
|
||||
$haveRel = count($resRel) > 0;
|
||||
$haveRel = $resRel !== [];
|
||||
}
|
||||
|
||||
return [$resRel, $haveRel];
|
||||
|
||||
@ -125,7 +125,7 @@ final class ExportController extends AbstractController
|
||||
|
||||
$exportList = Plugins::getExport($exportType, isset($GLOBALS['single_table']));
|
||||
|
||||
if (empty($exportList)) {
|
||||
if ($exportList === []) {
|
||||
$this->response->addHTML(Message::error(
|
||||
__('Could not load export plugins, please check your installation!'),
|
||||
)->getDisplay());
|
||||
|
||||
@ -55,7 +55,7 @@ final class ImportController extends AbstractController
|
||||
|
||||
$importList = Plugins::getImport('database');
|
||||
|
||||
if (empty($importList)) {
|
||||
if ($importList === []) {
|
||||
$this->response->addHTML(Message::error(__(
|
||||
'Could not load import plugins, please check your installation!',
|
||||
))->getDisplay());
|
||||
|
||||
@ -41,7 +41,7 @@ final class DropFormController extends AbstractController
|
||||
|
||||
foreach ($selected as $selectedValue) {
|
||||
$current = $selectedValue;
|
||||
if (! empty($views) && in_array($current, $views)) {
|
||||
if ($views !== [] && in_array($current, $views)) {
|
||||
$fullQueryViews .= (empty($fullQueryViews) ? 'DROP VIEW ' : ', ')
|
||||
. Util::backquote(htmlspecialchars($current));
|
||||
} else {
|
||||
|
||||
@ -58,7 +58,7 @@ final class DropTableController extends AbstractController
|
||||
$this->relationCleanup->table($GLOBALS['db'], $selected[$i]);
|
||||
$current = $selected[$i];
|
||||
|
||||
if (! empty($views) && in_array($current, $views)) {
|
||||
if ($views !== [] && in_array($current, $views)) {
|
||||
$sqlQueryViews .= (empty($sqlQueryViews) ? 'DROP VIEW ' : ', ') . Util::backquote($current);
|
||||
} else {
|
||||
$GLOBALS['sql_query'] .= (empty($GLOBALS['sql_query']) ? 'DROP TABLE ' : ', ')
|
||||
|
||||
@ -145,7 +145,7 @@ final class FavoriteTableController extends AbstractController
|
||||
): array {
|
||||
$favoriteInstanceTables = $favoriteInstance->getTables();
|
||||
|
||||
if (empty($favoriteInstanceTables) && isset($favoriteTables[$user])) {
|
||||
if ($favoriteInstanceTables === [] && isset($favoriteTables[$user])) {
|
||||
foreach ($favoriteTables[$user] as $value) {
|
||||
$favoriteInstance->add($value['db'], $value['table']);
|
||||
}
|
||||
|
||||
@ -17,7 +17,6 @@ use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\UserPreferences;
|
||||
|
||||
use function __;
|
||||
use function count;
|
||||
use function in_array;
|
||||
use function is_string;
|
||||
use function json_decode;
|
||||
@ -77,7 +76,7 @@ class ErrorReportController extends AbstractController
|
||||
|
||||
$reportData = $this->errorReport->getData($exceptionType);
|
||||
// report if and only if there were 'actual' errors.
|
||||
if (count($reportData) > 0) {
|
||||
if ($reportData !== []) {
|
||||
$serverResponse = $this->errorReport->send($reportData);
|
||||
if (! is_string($serverResponse)) {
|
||||
$success = false;
|
||||
|
||||
@ -65,7 +65,7 @@ final class ExportController extends AbstractController
|
||||
|
||||
$exportList = Plugins::getExport('server', isset($GLOBALS['single_table']));
|
||||
|
||||
if (empty($exportList)) {
|
||||
if ($exportList === []) {
|
||||
$this->response->addHTML(Message::error(
|
||||
__('Could not load export plugins, please check your installation!'),
|
||||
)->getDisplay());
|
||||
|
||||
@ -51,7 +51,7 @@ final class ImportController extends AbstractController
|
||||
|
||||
$importList = Plugins::getImport('server');
|
||||
|
||||
if (empty($importList)) {
|
||||
if ($importList === []) {
|
||||
$this->response->addHTML(Message::error(__(
|
||||
'Could not load import plugins, please check your installation!',
|
||||
))->getDisplay());
|
||||
|
||||
@ -96,7 +96,7 @@ class ExportController extends AbstractController
|
||||
|
||||
$exportList = Plugins::getExport('table', isset($GLOBALS['single_table']));
|
||||
|
||||
if (empty($exportList)) {
|
||||
if ($exportList === []) {
|
||||
$this->response->addHTML(Message::error(
|
||||
__('Could not load export plugins, please check your installation!'),
|
||||
)->getDisplay());
|
||||
|
||||
@ -16,7 +16,6 @@ use PhpMyAdmin\Util;
|
||||
|
||||
use function __;
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
use function is_array;
|
||||
use function mb_strtolower;
|
||||
use function preg_match;
|
||||
@ -298,7 +297,7 @@ class FindReplaceController extends AbstractController
|
||||
. ' SET ' . Util::backquote($column);
|
||||
|
||||
if (is_array($toReplace)) {
|
||||
if (count($toReplace) > 0) {
|
||||
if ($toReplace !== []) {
|
||||
$sqlQuery .= ' = CASE';
|
||||
foreach ($toReplace as $row) {
|
||||
$sqlQuery .= "\n WHEN " . Util::backquote($column)
|
||||
|
||||
@ -62,7 +62,7 @@ final class ImportController extends AbstractController
|
||||
|
||||
$importList = Plugins::getImport('table');
|
||||
|
||||
if (empty($importList)) {
|
||||
if ($importList === []) {
|
||||
$this->response->addHTML(Message::error(__(
|
||||
'Could not load import plugins, please check your installation!',
|
||||
))->getDisplay());
|
||||
|
||||
@ -245,7 +245,7 @@ class OperationsController extends AbstractController
|
||||
$GLOBALS['tbl_collation'],
|
||||
);
|
||||
|
||||
if (count($GLOBALS['table_alters']) > 0) {
|
||||
if ($GLOBALS['table_alters'] !== []) {
|
||||
$GLOBALS['sql_query'] = 'ALTER TABLE '
|
||||
. Util::backquote($GLOBALS['table']);
|
||||
$GLOBALS['sql_query'] .= "\r\n" . implode("\r\n", $GLOBALS['table_alters']);
|
||||
|
||||
@ -132,7 +132,7 @@ final class MoveColumnsController extends AbstractController
|
||||
array_splice($columnNames, $i, 0, $column);
|
||||
}
|
||||
|
||||
if (empty($changes) && ! isset($_REQUEST['preview_sql'])) { // should never happen
|
||||
if ($changes === [] && ! isset($_REQUEST['preview_sql'])) { // should never happen
|
||||
$this->response->setRequestStatus(false);
|
||||
|
||||
return;
|
||||
|
||||
@ -38,7 +38,7 @@ final class ReservedWordCheckController extends AbstractController
|
||||
$reservedKeywordsNames[] = trim($GLOBALS['table']);
|
||||
}
|
||||
|
||||
if (count($reservedKeywordsNames) === 0) {
|
||||
if ($reservedKeywordsNames === []) {
|
||||
$this->response->setRequestStatus(false);
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ final class SaveController extends AbstractController
|
||||
$adjustPrivileges[$_POST['field_orig'][$i]] = $_POST['field_name'][$i];
|
||||
}
|
||||
|
||||
if (count($changes) > 0 || isset($_POST['preview_sql'])) {
|
||||
if ($changes !== [] || isset($_POST['preview_sql'])) {
|
||||
// Builds the primary keys statements and updates the table
|
||||
$keyQuery = '';
|
||||
/**
|
||||
@ -145,7 +145,7 @@ final class SaveController extends AbstractController
|
||||
|
||||
// If there is a request for SQL previewing.
|
||||
if (isset($_POST['preview_sql'])) {
|
||||
Core::previewSQL(count($changes) > 0 ? $sqlQuery : '');
|
||||
Core::previewSQL($changes !== [] ? $sqlQuery : '');
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ class CentralColumns
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($existingCols)) {
|
||||
if ($existingCols !== []) {
|
||||
$existingCols = implode(',', array_unique($existingCols));
|
||||
$message = Message::notice(
|
||||
sprintf(
|
||||
@ -421,7 +421,7 @@ class CentralColumns
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($colNotExist)) {
|
||||
if ($colNotExist !== []) {
|
||||
$colNotExist = implode(',', array_unique($colNotExist));
|
||||
$message = Message::notice(
|
||||
sprintf(
|
||||
|
||||
@ -671,7 +671,7 @@ class Qbe
|
||||
}
|
||||
|
||||
if (
|
||||
(empty($this->prevCriteria)
|
||||
($this->prevCriteria === []
|
||||
|| ! isset($this->prevCriteria[$columnIndex]))
|
||||
|| $this->prevCriteria[$columnIndex] != $tmpCriteria
|
||||
) {
|
||||
@ -1158,7 +1158,7 @@ class Qbe
|
||||
}
|
||||
}
|
||||
|
||||
if (count($veryGood) > 0) {
|
||||
if ($veryGood !== []) {
|
||||
$candidateColumns = $veryGood;
|
||||
// Candidates restricted in index+where
|
||||
} else {
|
||||
@ -1222,7 +1222,7 @@ class Qbe
|
||||
}
|
||||
}
|
||||
|
||||
if (count($foreignTables)) {
|
||||
if ($foreignTables !== []) {
|
||||
$candidateColumns = $foreignTables;
|
||||
}
|
||||
|
||||
@ -1387,7 +1387,7 @@ class Qbe
|
||||
// Tables that can not be combined with the table cluster
|
||||
// which includes master table
|
||||
$unfinalized = array_diff($searchTables, array_keys($finalized));
|
||||
if (count($unfinalized) > 0) {
|
||||
if ($unfinalized !== []) {
|
||||
// We need to look for intermediary tables to JOIN unfinalized tables
|
||||
// Heuristic to chose intermediary tables is to look for tables
|
||||
// having relationships with unfinalized tables
|
||||
@ -1425,7 +1425,7 @@ class Qbe
|
||||
}
|
||||
|
||||
// We are done if no unfinalized tables anymore
|
||||
if (count($tempUnfinalized) === 0) {
|
||||
if ($tempUnfinalized === []) {
|
||||
break 3;
|
||||
}
|
||||
}
|
||||
@ -1434,7 +1434,7 @@ class Qbe
|
||||
|
||||
$unfinalized = array_diff($searchTables, array_keys($finalized));
|
||||
// If there are still unfinalized tables
|
||||
if (count($unfinalized) > 0) {
|
||||
if ($unfinalized !== []) {
|
||||
// Add these tables as cartesian product before joined tables
|
||||
$join .= implode(
|
||||
', ',
|
||||
@ -1700,21 +1700,21 @@ class Qbe
|
||||
array|null $indexColumns,
|
||||
): array {
|
||||
// now we want to find the best.
|
||||
if (isset($uniqueColumns) && count($uniqueColumns) > 0) {
|
||||
if (isset($uniqueColumns) && $uniqueColumns !== []) {
|
||||
$candidateColumns = $uniqueColumns;
|
||||
$needSort = 1;
|
||||
|
||||
return [$candidateColumns, $needSort];
|
||||
}
|
||||
|
||||
if (isset($indexColumns) && count($indexColumns) > 0) {
|
||||
if (isset($indexColumns) && $indexColumns !== []) {
|
||||
$candidateColumns = $indexColumns;
|
||||
$needSort = 1;
|
||||
|
||||
return [$candidateColumns, $needSort];
|
||||
}
|
||||
|
||||
if (isset($whereClauseColumns) && count($whereClauseColumns) > 0) {
|
||||
if (isset($whereClauseColumns) && $whereClauseColumns !== []) {
|
||||
$candidateColumns = $whereClauseColumns;
|
||||
$needSort = 0;
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ class Routines
|
||||
*/
|
||||
// FIXME: this must be simpler than that
|
||||
if (
|
||||
! count($GLOBALS['errors'])
|
||||
$GLOBALS['errors'] === []
|
||||
&& ( ! empty($_POST['editor_process_add'])
|
||||
|| ! empty($_POST['editor_process_edit'])
|
||||
|| (empty($_REQUEST['add_item']) && empty($_REQUEST['edit_item'])
|
||||
@ -179,7 +179,7 @@ class Routines
|
||||
$routineQuery = $this->getQueryFromRequest();
|
||||
|
||||
// set by getQueryFromRequest()
|
||||
if (! count($errors)) {
|
||||
if ($errors === []) {
|
||||
// Execute the created query
|
||||
if (! empty($_POST['editor_process_edit'])) {
|
||||
if (! in_array($_POST['item_original_type'], ['PROCEDURE', 'FUNCTION'], true)) {
|
||||
@ -245,7 +245,7 @@ class Routines
|
||||
}
|
||||
}
|
||||
|
||||
if (count($errors)) {
|
||||
if ($errors !== []) {
|
||||
$GLOBALS['message'] = Message::error(
|
||||
__(
|
||||
'One or more errors have occurred while processing your request:',
|
||||
@ -1100,7 +1100,7 @@ class Routines
|
||||
if ($routine['item_type'] === 'PROCEDURE') {
|
||||
$queries[] = 'CALL ' . Util::backquote($routine['item_name'])
|
||||
. '(' . implode(', ', $args) . ");\n";
|
||||
if (count($endQuery)) {
|
||||
if ($endQuery !== []) {
|
||||
$queries[] = 'SELECT ' . implode(', ', $endQuery) . ";\n";
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -35,7 +35,6 @@ use function array_shift;
|
||||
use function array_slice;
|
||||
use function basename;
|
||||
use function closelog;
|
||||
use function count;
|
||||
use function defined;
|
||||
use function explode;
|
||||
use function implode;
|
||||
@ -689,7 +688,7 @@ class DatabaseInterface implements DbalInterface
|
||||
$databases = $this->fetchResult($sql, 'SCHEMA_NAME', null, $connectionType);
|
||||
|
||||
$mysqlError = $this->getError($connectionType);
|
||||
if (! count($databases) && isset($GLOBALS['errno'])) {
|
||||
if ($databases === [] && isset($GLOBALS['errno'])) {
|
||||
Generator::mysqlDie($mysqlError, $sql);
|
||||
}
|
||||
|
||||
|
||||
@ -260,7 +260,7 @@ class ErrorReport
|
||||
'allowed_to_send_error_reports' => $this->config->get('SendErrorReports') !== 'never',
|
||||
];
|
||||
|
||||
if (! empty($reportData)) {
|
||||
if ($reportData !== []) {
|
||||
$datas['hidden_fields'] = Url::getHiddenFields($reportData, '', true);
|
||||
}
|
||||
|
||||
|
||||
@ -761,7 +761,7 @@ class Generator
|
||||
|
||||
if ($sqlQuery === '') {
|
||||
$formattedSql = '';
|
||||
} elseif (count($errors)) {
|
||||
} elseif ($errors !== []) {
|
||||
$formattedSql = htmlspecialchars($sqlQuery);
|
||||
} else {
|
||||
$formattedSql = self::formatSql($sqlQuery, true);
|
||||
|
||||
@ -651,7 +651,7 @@ class Normalization
|
||||
$dropCols = false;
|
||||
$error = false;
|
||||
$headText = '<h3>' . __('The third step of normalization is complete.') . '</h3>';
|
||||
if (count($newTables) === 0) {
|
||||
if ($newTables === []) {
|
||||
return ['legendText' => __('End of step'), 'headText' => $headText, 'queryError' => false];
|
||||
}
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ class Pdf extends TCPDF
|
||||
*/
|
||||
public function _putpages(): void
|
||||
{
|
||||
if (count($this->alias) > 0) {
|
||||
if ($this->alias !== []) {
|
||||
$nbPages = count($this->pages);
|
||||
for ($n = 1; $n <= $nbPages; $n++) {
|
||||
$this->pages[$n] = strtr($this->pages[$n], $this->alias);
|
||||
|
||||
@ -19,7 +19,6 @@ use PhpMyAdmin\Util;
|
||||
use PhpMyAdmin\Version;
|
||||
|
||||
use function __;
|
||||
use function count;
|
||||
use function htmlspecialchars;
|
||||
use function is_array;
|
||||
use function mb_substr;
|
||||
@ -247,7 +246,7 @@ class ExportXml extends ExportPlugin
|
||||
. '" collation="' . htmlspecialchars($dbCollation) . '" charset="' . htmlspecialchars($dbCharset)
|
||||
. '">' . "\n";
|
||||
|
||||
if (count($tables) === 0) {
|
||||
if ($tables === []) {
|
||||
$tables[] = $table;
|
||||
}
|
||||
|
||||
|
||||
@ -712,7 +712,7 @@ class ImportCsv extends AbstractImportCsv
|
||||
// check to see if {filename} as table exist
|
||||
$nameArray = preg_grep('/' . $importFileName . '/isU', $result);
|
||||
// if no use filename as table name
|
||||
if ($nameArray === false || count($nameArray) === 0) {
|
||||
if ($nameArray === false || $nameArray === []) {
|
||||
return $importFileName;
|
||||
}
|
||||
|
||||
@ -787,7 +787,7 @@ class ImportCsv extends AbstractImportCsv
|
||||
}
|
||||
|
||||
foreach ($tmp as $val) {
|
||||
if (count($fields) > 0) {
|
||||
if ($fields !== []) {
|
||||
$sqlTemplate .= ', ';
|
||||
}
|
||||
|
||||
|
||||
@ -133,6 +133,7 @@ class ImportMediawiki extends ImportPlugin
|
||||
$lastChunkLine = $bufferLines[--$fullBufferLinesCount];
|
||||
}
|
||||
|
||||
$curTempLine = [];
|
||||
for ($lineNr = 0; $lineNr < $fullBufferLinesCount; ++$lineNr) {
|
||||
$curBufferLine = trim($bufferLines[$lineNr]);
|
||||
|
||||
@ -206,7 +207,7 @@ class ImportMediawiki extends ImportPlugin
|
||||
// Check begin row or end table
|
||||
|
||||
// Add current line to the values storage
|
||||
if (! empty($curTempLine)) {
|
||||
if ($curTempLine !== []) {
|
||||
// If the current line contains header cells
|
||||
// ( marked with '!' ),
|
||||
// it will be marked as table header
|
||||
@ -339,7 +340,7 @@ class ImportMediawiki extends ImportPlugin
|
||||
*/
|
||||
private function setTableHeaders(array &$tableHeaders, array $tableRow): void
|
||||
{
|
||||
if (! empty($tableHeaders)) {
|
||||
if ($tableHeaders !== []) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -239,7 +239,7 @@ class ImportShp extends ImportPlugin
|
||||
}
|
||||
}
|
||||
|
||||
if (count($rows) === 0) {
|
||||
if ($rows === []) {
|
||||
$GLOBALS['error'] = true;
|
||||
$GLOBALS['message'] = Message::error(
|
||||
__('The imported file does not contain any data!'),
|
||||
|
||||
@ -11,7 +11,6 @@ use PhpMyAdmin\FieldMetadata;
|
||||
use PhpMyAdmin\Plugins\TransformationsPlugin;
|
||||
|
||||
use function __;
|
||||
use function count;
|
||||
use function fclose;
|
||||
use function feof;
|
||||
use function fgets;
|
||||
@ -98,8 +97,13 @@ abstract class ExternalTransformationsPlugin extends TransformationsPlugin
|
||||
//$allowed_programs[0] = '/usr/local/bin/tidy';
|
||||
//$allowed_programs[1] = '/usr/local/bin/validate';
|
||||
|
||||
// no-op when no allowed programs
|
||||
if (count($allowedPrograms) === 0) {
|
||||
/**
|
||||
* no-op when no allowed programs
|
||||
*
|
||||
* @psalm-suppress RedundantCondition
|
||||
* @phpstan-ignore-next-line
|
||||
*/
|
||||
if ($allowedPrograms === []) {
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
|
||||
@ -184,7 +184,7 @@ class RecentFavoriteTable
|
||||
*/
|
||||
public function getHtmlList(): string
|
||||
{
|
||||
if (count($this->tables)) {
|
||||
if ($this->tables !== []) {
|
||||
if ($this->tableType === 'recent') {
|
||||
$tables = [];
|
||||
foreach ($this->tables as $table) {
|
||||
|
||||
@ -6,7 +6,6 @@ namespace PhpMyAdmin\Replication;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
|
||||
use function count;
|
||||
use function explode;
|
||||
use function sprintf;
|
||||
|
||||
@ -141,7 +140,7 @@ final class ReplicationInfo
|
||||
{
|
||||
$this->primaryInfo = ['status' => false];
|
||||
|
||||
if (count($this->primaryStatus) > 0) {
|
||||
if ($this->primaryStatus !== []) {
|
||||
$this->primaryInfo['status'] = true;
|
||||
}
|
||||
|
||||
@ -163,7 +162,7 @@ final class ReplicationInfo
|
||||
{
|
||||
$this->replicaInfo = ['status' => false];
|
||||
|
||||
if (count($this->replicaStatus) > 0) {
|
||||
if ($this->replicaStatus !== []) {
|
||||
$this->replicaInfo['status'] = true;
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ class Session
|
||||
if (! empty(ini_get('session.auto_start')) && session_name() !== 'phpMyAdmin' && ! empty(session_id())) {
|
||||
// Do not delete the existing non empty session, it might be used by
|
||||
// other applications; instead just close it.
|
||||
if (empty($_SESSION)) {
|
||||
if ($_SESSION === []) {
|
||||
// Ignore errors as this might have been destroyed in other
|
||||
// request meanwhile
|
||||
@session_destroy();
|
||||
|
||||
@ -100,7 +100,7 @@ class ConfigGenerator
|
||||
return sprintf('$cfg[\'blowfish_secret\'] = \sodium_hex2bin(\'%s\');%s', sodium_bin2hex($secret), $eol);
|
||||
}
|
||||
|
||||
if (! is_array($varValue) || empty($varValue)) {
|
||||
if (! is_array($varValue) || $varValue === []) {
|
||||
return "\$cfg['" . $varName . "'] = "
|
||||
. var_export($varValue, true) . ';' . $eol;
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ class Sql
|
||||
// and the true error message to the query executor
|
||||
|
||||
return (isset($statementInfo->parser)
|
||||
&& count($statementInfo->parser->errors) === 0)
|
||||
&& $statementInfo->parser->errors === [])
|
||||
&& ($_SESSION['tmpval']['max_rows'] !== 'all')
|
||||
&& ! ($statementInfo->isExport
|
||||
|| $statementInfo->isAnalyse)
|
||||
|
||||
@ -657,11 +657,11 @@ class Table implements Stringable
|
||||
$checkQuery = 'SELECT ';
|
||||
|
||||
$uniqueFields = $this->getUniqueColumns(true, false);
|
||||
if (count($uniqueFields) > 0) {
|
||||
if ($uniqueFields !== []) {
|
||||
$fieldsToSelect = implode(', ', $uniqueFields);
|
||||
} else {
|
||||
$indexedCols = $this->getIndexedColumns(true, false);
|
||||
if (count($indexedCols) > 0) {
|
||||
if ($indexedCols !== []) {
|
||||
$fieldsToSelect = implode(', ', $indexedCols);
|
||||
} else {
|
||||
$fieldsToSelect = '*';
|
||||
|
||||
@ -115,7 +115,7 @@ final class Search
|
||||
$fullWhereClause[] = $whereClause;
|
||||
}
|
||||
|
||||
if (! empty($fullWhereClause)) {
|
||||
if ($fullWhereClause !== []) {
|
||||
return ' WHERE ' . implode(' AND ', $fullWhereClause);
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ final class Search
|
||||
}
|
||||
|
||||
$wheres = [];
|
||||
if (! empty($values)) {
|
||||
if ($values !== []) {
|
||||
$wheres[] = $backquotedName . ' ' . $funcType
|
||||
. ' (' . implode(',', $values) . ')';
|
||||
}
|
||||
|
||||
@ -2024,7 +2024,7 @@ class Util
|
||||
}
|
||||
|
||||
// is there at least one "in use" table?
|
||||
if (count($sotCache) > 0) {
|
||||
if ($sotCache !== []) {
|
||||
$tblGroupSql = '';
|
||||
$whereAdded = false;
|
||||
if (
|
||||
@ -2073,7 +2073,7 @@ class Util
|
||||
}
|
||||
}
|
||||
|
||||
if (count($names) > 0) {
|
||||
if ($names !== []) {
|
||||
$tables += $GLOBALS['dbi']->getTablesFull($db, $names);
|
||||
}
|
||||
|
||||
|
||||
@ -6850,11 +6850,6 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Plugins/Transformations/Abs/DateFormatTransformationsPlugin.php
|
||||
|
||||
-
|
||||
message: "#^Strict comparison using \\=\\=\\= between 0 and 0 will always evaluate to true\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php
|
||||
|
||||
-
|
||||
message: "#^Unreachable statement \\- code above always terminates\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -10323,22 +10323,14 @@
|
||||
<MixedArrayAccess>
|
||||
<code>$table[2][0]</code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code>$curTempLine[]</code>
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$GLOBALS['timeout_passed']]]></code>
|
||||
<code>$cell</code>
|
||||
<code>$cell</code>
|
||||
<code>$curTempTableHeaders</code>
|
||||
<code>$curTempTable[]</code>
|
||||
</MixedAssignment>
|
||||
<PossiblyUndefinedArrayOffset>
|
||||
<code>$cellData[1]</code>
|
||||
</PossiblyUndefinedArrayOffset>
|
||||
<PossiblyUndefinedVariable>
|
||||
<code>$curTempLine</code>
|
||||
</PossiblyUndefinedVariable>
|
||||
<PossiblyUnusedReturnValue>
|
||||
<code>string[]</code>
|
||||
</PossiblyUnusedReturnValue>
|
||||
|
||||
@ -61,7 +61,7 @@ abstract class AbstractNetworkTestCase extends AbstractTestCase
|
||||
->with()
|
||||
->will($this->returnValue(false));
|
||||
|
||||
if (count($param) > 0) {
|
||||
if ($param !== []) {
|
||||
if (is_array($param[0])) {
|
||||
if (is_array($param[0][0]) && count($param) === 1) {
|
||||
$param = $param[0];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user