MediaWiki
REL1_35
CodeCleanerGlobalsPass.inc
Go to the documentation of this file.
1
<?php
36
class
CodeCleanerGlobalsPass
extends
\Psy\CodeCleaner\CodeCleanerPass {
37
private
static
$superglobals
= [
38
'GLOBALS'
,
'_SERVER'
,
'_ENV'
,
'_FILES'
,
'_COOKIE'
,
'_POST'
,
'_GET'
,
'_SESSION'
39
];
40
41
public
function
beforeTraverse
( array $nodes ) {
42
$names = [];
43
foreach
( array_diff( array_keys(
$GLOBALS
), self::$superglobals ) as $name ) {
44
array_push( $names,
new
\PhpParser\Node\Expr\Variable( $name ) );
45
}
46
47
array_unshift( $nodes,
new
\PhpParser\Node\Stmt\Global_( $names ) );
48
49
return
$nodes;
50
}
51
}
$GLOBALS
$GLOBALS['IP']
Definition
ComposerHookHandler.php:7
CodeCleanerGlobalsPass
Prefix the real command with a bunch of 'global $VAR;' commands, one for each global.
Definition
CodeCleanerGlobalsPass.inc:36
CodeCleanerGlobalsPass\beforeTraverse
beforeTraverse(array $nodes)
Definition
CodeCleanerGlobalsPass.inc:41
CodeCleanerGlobalsPass\$superglobals
static $superglobals
Definition
CodeCleanerGlobalsPass.inc:37
maintenance
CodeCleanerGlobalsPass.inc
Generated on Sat Apr 6 2024 00:08:23 for MediaWiki by
1.9.8