class CheckSyntax extends Maintenance {
// List of files we're going to check
- private $mFiles = array(), $mFailures = array(), $mWarnings = array();
- private $mIgnorePaths = array(), $mNoStyleCheckPaths = array();
+ private $mFiles = [], $mFailures = [], $mWarnings = [];
+ private $mIgnorePaths = [], $mNoStyleCheckPaths = [];
public function __construct() {
parent::__construct();
private function buildFileList() {
global $IP;
- $this->mIgnorePaths = array(
- // Compat stuff, explodes on PHP 5.3
- "includes/NamespaceCompat.php$",
- );
+ $this->mIgnorePaths = [
+ ];
- $this->mNoStyleCheckPaths = array(
+ $this->mNoStyleCheckPaths = [
// Third-party code we don't care about
"/activemq_stomp/",
"EmailPage/PHPMailer",
"QPoll/Excel/",
"/geshi/",
"/smarty/",
- );
+ ];
if ( $this->hasOption( 'path' ) ) {
$path = $this->getOption( 'path' );
// Only check files in these directories.
// Don't just put $IP, because the recursive dir thingie goes into all subdirs
- $dirs = array(
+ $dirs = [
$IP . '/includes',
$IP . '/mw-config',
$IP . '/languages',
$IP . '/maintenance',
$IP . '/skins',
- );
+ ];
if ( $this->hasOption( 'with-extensions' ) ) {
$dirs[] = $IP . '/extensions';
}
* @return array Resulting list of changed files
*/
private function getGitModifiedFiles( $path ) {
-
global $wgMaxShellMemory;
if ( !is_dir( "$path/.git" ) ) {
$wgMaxShellMemory = $oldMaxShellMemory;
- $arr = array();
+ $arr = [];
$filename = strtok( $output, "\n" );
while ( $filename !== false ) {
if ( $filename !== '' ) {
return false;
}
foreach ( $this->mIgnorePaths as $regex ) {
- $m = array();
+ $m = [];
if ( preg_match( "~{$regex}~", $file, $m ) ) {
return false;
}
*/
private function checkForMistakes( $file ) {
foreach ( $this->mNoStyleCheckPaths as $regex ) {
- $m = array();
+ $m = [];
if ( preg_match( "~{$regex}~", $file, $m ) ) {
return;
}
}
if ( !isset( $this->mWarnings[$file] ) ) {
- $this->mWarnings[$file] = array();
+ $this->mWarnings[$file] = [];
}
$this->mWarnings[$file][] = $desc;
$this->output( "Warning in file $file: $desc found.\n" );
}
if ( !isset( $this->mWarnings[$file] ) ) {
- $this->mWarnings[$file] = array();
+ $this->mWarnings[$file] = [];
}
$this->mWarnings[$file][] = $desc;
$this->output( "Warning in file $file: $desc found.\n" );