Merge "Add type hint against LinkTarget"
[lhc/web/wiklou.git] / maintenance / benchmarks / bench_utf8_title_check.php
index 1c31256..bdb197f 100644 (file)
@@ -61,14 +61,13 @@ class BenchUtf8TitleCheck extends Benchmarker {
                );
                // @codingStandardsIgnoreEnd
 
-               $this->canRun = function_exists ( 'mb_check_encoding' );
+               $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.";
-                       mb_internal_encoding( 'UTF-8' );
+                       $this->addDescription( "Benchmark for using a regexp vs. mb_check_encoding " .
+                               "to check for UTF-8 encoding." );
                } else {
-                       $this->mDescription = "CANNOT RUN benchmark using mb_check_encoding: function not available.";
+                       $this->addDescription( 'CANNOT RUN benchmark using mb_check_encoding: function not available.' );
                }
        }
 
@@ -76,24 +75,24 @@ class BenchUtf8TitleCheck extends Benchmarker {
                if ( !$this->canRun ) {
                        return;
                }
-               $benchmarks = array();
-               foreach ($this->data as $val) {
-                       $benchmarks[] = array(
-                               'function' => array( $this, 'use_regexp' ),
-                               'args' => array( rawurldecode ( $val ) )
-                       );
-                       $benchmarks[] = array(
-                               'function' => array( $this, 'use_regexp_non_capturing' ),
-                               'args' => array( rawurldecode ( $val ) )
-                       );
-                       $benchmarks[] = array(
-                               'function' => array( $this, 'use_regexp_once_only' ),
-                               'args' => array( rawurldecode ( $val ) )
-                       );
-                       $benchmarks[] = array(
-                               'function' => array( $this, 'use_mb_check_encoding' ),
-                               'args' => array( rawurldecode ( $val ) )
-                       );
+               $benchmarks = [];
+               foreach ( $this->data as $val ) {
+                       $benchmarks[] = [
+                               'function' => [ $this, 'use_regexp' ],
+                               'args' => [ rawurldecode( $val ) ]
+                       ];
+                       $benchmarks[] = [
+                               'function' => [ $this, 'use_regexp_non_capturing' ],
+                               'args' => [ rawurldecode( $val ) ]
+                       ];
+                       $benchmarks[] = [
+                               'function' => [ $this, 'use_regexp_once_only' ],
+                               'args' => [ rawurldecode( $val ) ]
+                       ];
+                       $benchmarks[] = [
+                               'function' => [ $this, 'use_mb_check_encoding' ],
+                               'args' => [ rawurldecode( $val ) ]
+                       ];
                }
                $this->bench( $benchmarks );
                print $this->getFormattedResults();
@@ -103,19 +102,19 @@ class BenchUtf8TitleCheck extends Benchmarker {
 
        function use_regexp( $s ) {
                $this->isutf8 = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
-                               '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
+                       '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
        }
 
        function use_regexp_non_capturing( $s ) {
                // Same as above with a non-capturing subgroup.
                $this->isutf8 = preg_match( '/^(?:[\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
-                               '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
+                       '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
        }
 
        function use_regexp_once_only( $s ) {
                // Same as above with a once-only subgroup.
                $this->isutf8 = preg_match( '/^(?>[\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
-                               '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
+                       '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
        }
 
        function use_mb_check_encoding( $s ) {