X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FgenerateJsonI18n.php;h=a84f2ae52c789e4c98873d05d0450290728da21b;hb=9e002ecb551aaa41ed9bb474598ffc1c1953a1dc;hp=b9c07fbe4dd4760f52f05548cf241c9484c7e07b;hpb=8195fd3551c484cfe140fd54ac9c16c2d8c4bc4a;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/generateJsonI18n.php b/maintenance/generateJsonI18n.php index b9c07fbe4d..a84f2ae52c 100644 --- a/maintenance/generateJsonI18n.php +++ b/maintenance/generateJsonI18n.php @@ -35,7 +35,7 @@ require_once __DIR__ . '/Maintenance.php'; class GenerateJsonI18n extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Build JSON messages files from a PHP messages file"; + $this->addDescription( 'Build JSON messages files from a PHP messages file' ); $this->addArg( 'phpfile', 'PHP file defining a $messages array', false ); $this->addArg( 'jsondir', 'Directory to write JSON files to', false ); @@ -108,6 +108,7 @@ class GenerateJsonI18n extends Maintenance { if ( !is_readable( $phpfile ) ) { $this->error( "Error reading $phpfile", 1 ); } + $messages = null; include $phpfile; $phpfileContents = file_get_contents( $phpfile ); @@ -131,7 +132,7 @@ class GenerateJsonI18n extends Maintenance { ) ); // Make sure the @metadata key is the first key in the output $langmsgs = array_merge( - array( '@metadata' => array( 'authors' => $authors ) ), + [ '@metadata' => [ 'authors' => $authors ] ], $langmsgs ); @@ -187,7 +188,7 @@ class GenerateJsonI18n extends Maintenance { $matches = null; preg_match_all( '/@author (.*?)$/m', $comment, $matches ); - return $matches && $matches[1] ? $matches[1] : array(); + return $matches && $matches[1] ? $matches[1] : []; } }