Pass phpcs-strict on maintenance/benchmarks/
authorSiebrand Mazeland <siebrand@kitano.nl>
Tue, 22 Apr 2014 19:58:25 +0000 (21:58 +0200)
committerSiebrand Mazeland <siebrand@kitano.nl>
Tue, 22 Apr 2014 19:58:25 +0000 (21:58 +0200)
Change-Id: I73558930909b35bbc13d0a0ac9368485cb2aa8c4

maintenance/benchmarks/bench_HTTP_HTTPS.php
maintenance/benchmarks/bench_delete_truncate.php
maintenance/benchmarks/bench_if_switch.php
maintenance/benchmarks/bench_strtr_str_replace.php
maintenance/benchmarks/bench_utf8_title_check.php
maintenance/benchmarks/bench_wfBaseConvert.php
maintenance/benchmarks/bench_wfIsWindows.php
maintenance/benchmarks/benchmarkHooks.php
maintenance/benchmarks/benchmarkPurge.php

index 6f800fb..bb7499b 100644 (file)
@@ -31,8 +31,7 @@ require_once __DIR__ . '/Benchmarker.php';
  *
  * @ingroup Benchmark
  */
-class bench_HTTP_HTTPS extends Benchmarker {
-
+class BenchHttpHttps extends Benchmarker {
        public function __construct() {
                parent::__construct();
                $this->mDescription = "Benchmark HTTP request vs HTTPS request.";
@@ -42,7 +41,7 @@ class bench_HTTP_HTTPS extends Benchmarker {
                $this->bench( array(
                        array( 'function' => array( $this, 'getHTTP' ) ),
                        array( 'function' => array( $this, 'getHTTPS' ) ),
-               ));
+               ) );
                print $this->getFormattedResults();
        }
 
@@ -61,5 +60,5 @@ class bench_HTTP_HTTPS extends Benchmarker {
        }
 }
 
-$maintClass = 'bench_HTTP_HTTPS';
+$maintClass = 'BenchHttpHttps';
 require_once RUN_MAINTENANCE_IF_MAIN;
index ea22b6d..ed3fe5c 100644 (file)
@@ -29,7 +29,6 @@ require_once __DIR__ . '/Benchmarker.php';
  * @ingroup Benchmark
  */
 class BenchmarkDeleteTruncate extends Benchmarker {
-
        public function __construct() {
                parent::__construct();
                $this->mDescription = "Benchmarks SQL DELETE vs SQL TRUNCATE.";
index 80fd962..698a0f0 100644 (file)
@@ -31,8 +31,7 @@ require_once __DIR__ . '/Benchmarker.php';
  *
  * @ingroup Maintenance
  */
-class bench_if_switch extends Benchmarker {
-
+class BenchIfSwitch extends Benchmarker {
        public function __construct() {
                parent::__construct();
                $this->mDescription = "Benchmark if elseif... versus switch case.";
@@ -42,55 +41,71 @@ class bench_if_switch extends Benchmarker {
                $this->bench( array(
                        array( 'function' => array( $this, 'doElseIf' ) ),
                        array( 'function' => array( $this, 'doSwitch' ) ),
-               ));
+               ) );
                print $this->getFormattedResults();
        }
 
        // bench function 1
        function doElseIf() {
                $a = 'z';
-               if( $a == 'a') {}
-               elseif( $a == 'b') {}
-               elseif( $a == 'c') {}
-               elseif( $a == 'd') {}
-               elseif( $a == 'e') {}
-               elseif( $a == 'f') {}
-               elseif( $a == 'g') {}
-               elseif( $a == 'h') {}
-               elseif( $a == 'i') {}
-               elseif( $a == 'j') {}
-               elseif( $a == 'k') {}
-               elseif( $a == 'l') {}
-               elseif( $a == 'm') {}
-               elseif( $a == 'n') {}
-               elseif( $a == 'o') {}
-               elseif( $a == 'p') {}
-               else {}
+               if ( $a == 'a' ) {
+               } elseif ( $a == 'b' ) {
+               } elseif ( $a == 'c' ) {
+               } elseif ( $a == 'd' ) {
+               } elseif ( $a == 'e' ) {
+               } elseif ( $a == 'f' ) {
+               } elseif ( $a == 'g' ) {
+               } elseif ( $a == 'h' ) {
+               } elseif ( $a == 'i' ) {
+               } elseif ( $a == 'j' ) {
+               } elseif ( $a == 'k' ) {
+               } elseif ( $a == 'l' ) {
+               } elseif ( $a == 'm' ) {
+               } elseif ( $a == 'n' ) {
+               } elseif ( $a == 'o' ) {
+               } elseif ( $a == 'p' ) {
+               } else {
+               }
        }
 
        // bench function 2
        function doSwitch() {
                $a = 'z';
-               switch( $a ) {
-                       case 'b': break;
-                       case 'c': break;
-                       case 'd': break;
-                       case 'e': break;
-                       case 'f': break;
-                       case 'g': break;
-                       case 'h': break;
-                       case 'i': break;
-                       case 'j': break;
-                       case 'k': break;
-                       case 'l': break;
-                       case 'm': break;
-                       case 'n': break;
-                       case 'o': break;
-                       case 'p': break;
+               switch ( $a ) {
+                       case 'b':
+                               break;
+                       case 'c':
+                               break;
+                       case 'd':
+                               break;
+                       case 'e':
+                               break;
+                       case 'f':
+                               break;
+                       case 'g':
+                               break;
+                       case 'h':
+                               break;
+                       case 'i':
+                               break;
+                       case 'j':
+                               break;
+                       case 'k':
+                               break;
+                       case 'l':
+                               break;
+                       case 'm':
+                               break;
+                       case 'n':
+                               break;
+                       case 'o':
+                               break;
+                       case 'p':
+                               break;
                        default:
                }
        }
 }
 
-$maintClass = 'bench_if_switch';
+$maintClass = 'BenchIfSwitch';
 require_once RUN_MAINTENANCE_IF_MAIN;
index 76b5e3c..99e9cfd 100644 (file)
@@ -38,8 +38,7 @@ function bfNormalizeTitleStrReplace( $str ) {
  *
  * @ingroup Benchmark
  */
-class bench_strtr_str_replace extends Benchmarker {
-
+class BenchStrtrStrReplace extends Benchmarker {
        public function __construct() {
                parent::__construct();
                $this->mDescription = "Benchmark for strtr() vs str_replace().";
@@ -70,8 +69,7 @@ class bench_strtr_str_replace extends Benchmarker {
        function benchstr_replace_indirect() {
                bfNormalizeTitleStrReplace( "[[MediaWiki:Some_random_test_page]]" );
        }
-
 }
 
-$maintClass = 'bench_strtr_str_replace';
+$maintClass = 'BenchStrtrStrReplace';
 require_once RUN_MAINTENANCE_IF_MAIN;
index 078293e..1c31256 100644 (file)
@@ -29,8 +29,7 @@ require_once __DIR__ . '/Benchmarker.php';
  *
  * @ingroup Benchmark
  */
-class bench_utf8_title_check extends Benchmarker {
-
+class BenchUtf8TitleCheck extends Benchmarker {
        private $canRun;
 
        private $data;
@@ -38,6 +37,7 @@ class bench_utf8_title_check extends Benchmarker {
        public function __construct() {
                parent::__construct();
 
+               // @codingStandardsIgnoreStart Ignore long line warnings.
                $this->data = array(
                        "",
                        "United States of America", // 7bit ASCII
@@ -59,11 +59,13 @@ class bench_utf8_title_check extends Benchmarker {
                        . "Sara%20Sidle%7CSofia%20Curtis%7CS%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e%7CWallace%20Langham%7C"
                        . "Warrick%20Brown%7CWendy%20Simms%7C%C3%89tats-Unis"
                );
+               // @codingStandardsIgnoreEnd
 
                $this->canRun = function_exists ( 'mb_check_encoding' );
 
                if ( $this->canRun ) {
-                       $this->mDescription = "Benchmark for using a regexp vs. mb_check_encoding to check for UTF-8 encoding.";
+                       $this->mDescription = "Benchmark for using a regexp vs. mb_check_encoding " .
+                               "to check for UTF-8 encoding.";
                        mb_internal_encoding( 'UTF-8' );
                } else {
                        $this->mDescription = "CANNOT RUN benchmark using mb_check_encoding: function not available.";
@@ -119,8 +121,7 @@ class bench_utf8_title_check extends Benchmarker {
        function use_mb_check_encoding( $s ) {
                $this->isutf8 = mb_check_encoding( $s, 'UTF-8' );
        }
-
 }
 
-$maintClass = 'bench_utf8_title_check';
+$maintClass = 'BenchUtf8TitleCheck';
 require_once RUN_MAINTENANCE_IF_MAIN;
index f8a2156..d08a0b0 100644 (file)
@@ -29,8 +29,7 @@ require_once __DIR__ . '/Benchmarker.php';
  *
  * @ingroup Benchmark
  */
-class bench_wfBaseConvert extends Benchmarker {
-
+class BenchWfBaseConvert extends Benchmarker {
        public function __construct() {
                parent::__construct();
                $this->mDescription = "Benchmark for wfBaseConvert.";
@@ -73,5 +72,5 @@ class bench_wfBaseConvert extends Benchmarker {
        }
 }
 
-$maintClass = 'bench_wfBaseConvert';
+$maintClass = 'BenchWfBaseConvert';
 require_once RUN_MAINTENANCE_IF_MAIN;
index 76cea2c..b5cb025 100644 (file)
@@ -31,8 +31,7 @@ require_once __DIR__ . '/Benchmarker.php';
  *
  * @ingroup Benchmark
  */
-class bench_wfIsWindows extends Benchmarker {
-
+class BenchWfIsWindows extends Benchmarker {
        public function __construct() {
                parent::__construct();
                $this->mDescription = "Benchmark for wfIsWindows.";
@@ -65,5 +64,5 @@ class bench_wfIsWindows extends Benchmarker {
        }
 }
 
-$maintClass = 'bench_wfIsWindows';
+$maintClass = 'BenchWfIsWindows';
 require_once RUN_MAINTENANCE_IF_MAIN;
index 59d3bdf..bb7af2b 100644 (file)
@@ -29,7 +29,6 @@ require_once __DIR__ . '/Benchmarker.php';
  * @ingroup Benchmark
  */
 class BenchmarkHooks extends Benchmarker {
-
        public function __construct() {
                parent::__construct();
                $this->mDescription = 'Benchmark MediaWiki Hooks.';
index 1797358..dcaacab 100644 (file)
@@ -29,7 +29,6 @@ require_once __DIR__ . '/Benchmarker.php';
  * @ingroup Benchmark
  */
 class BenchmarkPurge extends Benchmarker {
-
        public function __construct() {
                parent::__construct();
                $this->mDescription = "Benchmark the Squid purge functions.";