X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2FcheckSyntax.php;h=3910f29d2043f486ffa86e16c92ea85caee1ab84;hp=dabcf85b9fd296101b6fd427e1944a520e5b34d6;hb=d19826aa35b206847a568a4b2c1c9ffaa615fca5;hpb=c45be249965cc0a6740b0ee7b805cb3f4fafba1f diff --git a/maintenance/checkSyntax.php b/maintenance/checkSyntax.php index dabcf85b9f..3910f29d20 100644 --- a/maintenance/checkSyntax.php +++ b/maintenance/checkSyntax.php @@ -31,8 +31,8 @@ require_once __DIR__ . '/Maintenance.php'; 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(); @@ -83,10 +83,10 @@ class CheckSyntax extends Maintenance { private function buildFileList() { global $IP; - $this->mIgnorePaths = array( - ); + $this->mIgnorePaths = [ + ]; - $this->mNoStyleCheckPaths = array( + $this->mNoStyleCheckPaths = [ // Third-party code we don't care about "/activemq_stomp/", "EmailPage/PHPMailer", @@ -98,7 +98,7 @@ class CheckSyntax extends Maintenance { "QPoll/Excel/", "/geshi/", "/smarty/", - ); + ]; if ( $this->hasOption( 'path' ) ) { $path = $this->getOption( 'path' ); @@ -139,13 +139,13 @@ class CheckSyntax extends Maintenance { // 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'; } @@ -168,7 +168,6 @@ class CheckSyntax extends Maintenance { * @return array Resulting list of changed files */ private function getGitModifiedFiles( $path ) { - global $wgMaxShellMemory; if ( !is_dir( "$path/.git" ) ) { @@ -203,7 +202,7 @@ class CheckSyntax extends Maintenance { $wgMaxShellMemory = $oldMaxShellMemory; - $arr = array(); + $arr = []; $filename = strtok( $output, "\n" ); while ( $filename !== false ) { if ( $filename !== '' ) { @@ -227,7 +226,7 @@ class CheckSyntax extends Maintenance { return false; } foreach ( $this->mIgnorePaths as $regex ) { - $m = array(); + $m = []; if ( preg_match( "~{$regex}~", $file, $m ) ) { return false; } @@ -306,7 +305,7 @@ class CheckSyntax extends Maintenance { */ private function checkForMistakes( $file ) { foreach ( $this->mNoStyleCheckPaths as $regex ) { - $m = array(); + $m = []; if ( preg_match( "~{$regex}~", $file, $m ) ) { return; } @@ -327,7 +326,7 @@ class CheckSyntax extends Maintenance { } 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" ); @@ -339,7 +338,7 @@ class CheckSyntax extends Maintenance { } 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" );