Skip to content

Commit

Permalink
Replace global keyword with $GLOBALS
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Mar 7, 2022
1 parent 0339dc0 commit 1438cb2
Show file tree
Hide file tree
Showing 311 changed files with 6,005 additions and 6,924 deletions.
10 changes: 6 additions & 4 deletions index.php
Expand Up @@ -35,9 +35,11 @@

require AUTOLOAD_FILE;

global $containerBuilder;

Common::run();

$dispatcher = Routing::getDispatcher();
Routing::callControllerForRoute(Common::getRequest(), Routing::getCurrentRoute(), $dispatcher, $containerBuilder);
Routing::callControllerForRoute(
Common::getRequest(),
Routing::getCurrentRoute(),
Routing::getDispatcher(),
$GLOBALS['containerBuilder']
);
7 changes: 2 additions & 5 deletions js/messages.php
Expand Up @@ -6,9 +6,6 @@
use PhpMyAdmin\Controllers\JavaScriptMessagesController;
use PhpMyAdmin\OutputBuffering;

/** @psalm-suppress InvalidGlobal */
global $containerBuilder;

if (! defined('ROOT_PATH')) {
// phpcs:disable PSR1.Files.SideEffects
define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
Expand Down Expand Up @@ -47,7 +44,7 @@
// Cache output in client - the nocache query parameter makes sure that this file is reloaded when config changes.
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');

$isMinimumCommon = true;
$GLOBALS['isMinimumCommon'] = true;
// phpcs:disable PSR1.Files.SideEffects
define('PMA_PATH_TO_BASEDIR', '../');
define('PMA_NO_SESSION', true);
Expand All @@ -63,5 +60,5 @@
});

/** @var JavaScriptMessagesController $controller */
$controller = $containerBuilder->get(JavaScriptMessagesController::class);
$controller = $GLOBALS['containerBuilder']->get(JavaScriptMessagesController::class);
$controller();
14 changes: 5 additions & 9 deletions libraries/classes/BrowseForeigners.php
Expand Up @@ -39,14 +39,12 @@ class BrowseForeigners
*/
public function __construct(Template $template)
{
global $cfg;

$this->template = $template;

$this->limitChars = (int) $cfg['LimitChars'];
$this->maxRows = (int) $cfg['MaxRows'];
$this->repeatCells = (int) $cfg['RepeatCells'];
$this->showAll = (bool) $cfg['ShowAll'];
$this->limitChars = (int) $GLOBALS['cfg']['LimitChars'];
$this->maxRows = (int) $GLOBALS['cfg']['MaxRows'];
$this->repeatCells = (int) $GLOBALS['cfg']['RepeatCells'];
$this->showAll = (bool) $GLOBALS['cfg']['ShowAll'];
}

/**
Expand All @@ -71,8 +69,6 @@ private function getHtmlForOneKey(
int $indexByDescription,
string $currentValue
): array {
global $theme;

$horizontalCount++;
$output = '';

Expand Down Expand Up @@ -126,7 +122,7 @@ private function getHtmlForOneKey(
]);

$output .= '<td width="20%"><img src="'
. ($theme instanceof Theme ? $theme->getImgPath('spacer.png') : '')
. ($GLOBALS['theme'] instanceof Theme ? $GLOBALS['theme']->getImgPath('spacer.png') : '')
. '" alt="" width="1" height="1"></td>';

$output .= $this->template->render('table/browse_foreigners/column_element', [
Expand Down
10 changes: 4 additions & 6 deletions libraries/classes/Command/CacheWarmupCommand.php
Expand Up @@ -118,13 +118,11 @@ private function warmUpTwigCache(
string $environment,
bool $writeReplacements
): int {
global $cfg, $config, $dbi;

$output->writeln('Warming up the twig cache', OutputInterface::VERBOSITY_VERBOSE);
$config = new Config(CONFIG_FILE);
$cfg['environment'] = $environment;
$config->set('environment', $cfg['environment']);
$dbi = new DatabaseInterface(new DbiDummy());
$GLOBALS['config'] = new Config(CONFIG_FILE);
$GLOBALS['cfg']['environment'] = $environment;
$GLOBALS['config']->set('environment', $GLOBALS['cfg']['environment']);
$GLOBALS['dbi'] = new DatabaseInterface(new DbiDummy());
$tmpDir = ROOT_PATH . 'twig-templates';
$twig = Template::getTwigEnvironment($tmpDir);

Expand Down

0 comments on commit 1438cb2

Please sign in to comment.