Skip to content

Commit 9ff08aa

Browse files
Merge pull request #17427 from mauriciofauth/global-keyword
Replace `global` keyword with `$GLOBALS`
2 parents 0339dc0 + 1438cb2 commit 9ff08aa

File tree

311 files changed

+6005
-6924
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

311 files changed

+6005
-6924
lines changed

index.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@
3535

3636
require AUTOLOAD_FILE;
3737

38-
global $containerBuilder;
39-
4038
Common::run();
4139

42-
$dispatcher = Routing::getDispatcher();
43-
Routing::callControllerForRoute(Common::getRequest(), Routing::getCurrentRoute(), $dispatcher, $containerBuilder);
40+
Routing::callControllerForRoute(
41+
Common::getRequest(),
42+
Routing::getCurrentRoute(),
43+
Routing::getDispatcher(),
44+
$GLOBALS['containerBuilder']
45+
);

js/messages.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
use PhpMyAdmin\Controllers\JavaScriptMessagesController;
77
use PhpMyAdmin\OutputBuffering;
88

9-
/** @psalm-suppress InvalidGlobal */
10-
global $containerBuilder;
11-
129
if (! defined('ROOT_PATH')) {
1310
// phpcs:disable PSR1.Files.SideEffects
1411
define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
@@ -47,7 +44,7 @@
4744
// Cache output in client - the nocache query parameter makes sure that this file is reloaded when config changes.
4845
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');
4946

50-
$isMinimumCommon = true;
47+
$GLOBALS['isMinimumCommon'] = true;
5148
// phpcs:disable PSR1.Files.SideEffects
5249
define('PMA_PATH_TO_BASEDIR', '../');
5350
define('PMA_NO_SESSION', true);
@@ -63,5 +60,5 @@
6360
});
6461

6562
/** @var JavaScriptMessagesController $controller */
66-
$controller = $containerBuilder->get(JavaScriptMessagesController::class);
63+
$controller = $GLOBALS['containerBuilder']->get(JavaScriptMessagesController::class);
6764
$controller();

libraries/classes/BrowseForeigners.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,12 @@ class BrowseForeigners
3939
*/
4040
public function __construct(Template $template)
4141
{
42-
global $cfg;
43-
4442
$this->template = $template;
4543

46-
$this->limitChars = (int) $cfg['LimitChars'];
47-
$this->maxRows = (int) $cfg['MaxRows'];
48-
$this->repeatCells = (int) $cfg['RepeatCells'];
49-
$this->showAll = (bool) $cfg['ShowAll'];
44+
$this->limitChars = (int) $GLOBALS['cfg']['LimitChars'];
45+
$this->maxRows = (int) $GLOBALS['cfg']['MaxRows'];
46+
$this->repeatCells = (int) $GLOBALS['cfg']['RepeatCells'];
47+
$this->showAll = (bool) $GLOBALS['cfg']['ShowAll'];
5048
}
5149

5250
/**
@@ -71,8 +69,6 @@ private function getHtmlForOneKey(
7169
int $indexByDescription,
7270
string $currentValue
7371
): array {
74-
global $theme;
75-
7672
$horizontalCount++;
7773
$output = '';
7874

@@ -126,7 +122,7 @@ private function getHtmlForOneKey(
126122
]);
127123

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

132128
$output .= $this->template->render('table/browse_foreigners/column_element', [

libraries/classes/Command/CacheWarmupCommand.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,11 @@ private function warmUpTwigCache(
118118
string $environment,
119119
bool $writeReplacements
120120
): int {
121-
global $cfg, $config, $dbi;
122-
123121
$output->writeln('Warming up the twig cache', OutputInterface::VERBOSITY_VERBOSE);
124-
$config = new Config(CONFIG_FILE);
125-
$cfg['environment'] = $environment;
126-
$config->set('environment', $cfg['environment']);
127-
$dbi = new DatabaseInterface(new DbiDummy());
122+
$GLOBALS['config'] = new Config(CONFIG_FILE);
123+
$GLOBALS['cfg']['environment'] = $environment;
124+
$GLOBALS['config']->set('environment', $GLOBALS['cfg']['environment']);
125+
$GLOBALS['dbi'] = new DatabaseInterface(new DbiDummy());
128126
$tmpDir = ROOT_PATH . 'twig-templates';
129127
$twig = Template::getTwigEnvironment($tmpDir);
130128

0 commit comments

Comments
 (0)