jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/375926 )

Change subject: Change Namespace from MediaWiki to Wikimedia
......................................................................


Change Namespace from MediaWiki to Wikimedia

Change-Id: I5da00343715d799d386bb44a77e54a2e08736a69
---
M composer.json
C src/MediaWiki/Functions.php
R src/Wikimedia/Functions.php
M tests/FunctionsTest.php
4 files changed, 17 insertions(+), 39 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/composer.json b/composer.json
index 9d4fd69..82c117d 100644
--- a/composer.json
+++ b/composer.json
@@ -15,7 +15,8 @@
        ],
        "autoload": {
                "files": [
-                       "src/Functions.php"
+                       "src/MediaWiki/Functions.php",
+                       "src/Wikimedia/Functions.php"
                ]
        },
        "require": {
diff --git a/src/Functions.php b/src/MediaWiki/Functions.php
similarity index 74%
copy from src/Functions.php
copy to src/MediaWiki/Functions.php
index 4c27b7e..e54e056 100644
--- a/src/Functions.php
+++ b/src/MediaWiki/Functions.php
@@ -26,37 +26,14 @@
  * @param bool $end Whether to restore warnings
  */
 function suppressWarnings( $end = false ) {
-       static $suppressCount = 0;
-       static $originalLevel = false;
-
-       if ( $end ) {
-               if ( $suppressCount ) {
-                       --$suppressCount;
-                       if ( !$suppressCount ) {
-                               error_reporting( $originalLevel );
-                       }
-               }
-       } else {
-               if ( !$suppressCount ) {
-                       $originalLevel = error_reporting( E_ALL & ~(
-                                       E_WARNING |
-                                       E_NOTICE |
-                                       E_USER_WARNING |
-                                       E_USER_NOTICE |
-                                       E_DEPRECATED |
-                                       E_USER_DEPRECATED |
-                                       E_STRICT
-                               ) );
-               }
-               ++$suppressCount;
-       }
+       \Wikimedia\suppressWarnings( $end );
 }
 
 /**
  * Restore error level to previous value
  */
 function restoreWarnings() {
-       suppressWarnings( true );
+       \Wikimedia\suppressWarnings( true );
 }
 
 /**
diff --git a/src/Functions.php b/src/Wikimedia/Functions.php
similarity index 98%
rename from src/Functions.php
rename to src/Wikimedia/Functions.php
index 4c27b7e..0d79a07 100644
--- a/src/Functions.php
+++ b/src/Wikimedia/Functions.php
@@ -18,7 +18,7 @@
  * @file
  */
 
-namespace MediaWiki;
+namespace Wikimedia;
 
 /**
  * Reference-counted warning suppression
diff --git a/tests/FunctionsTest.php b/tests/FunctionsTest.php
index 2f57f31..9a822c0 100644
--- a/tests/FunctionsTest.php
+++ b/tests/FunctionsTest.php
@@ -26,9 +26,9 @@
         */
        public function testWarningSuppression() {
                $a = [];
-               MediaWiki\suppressWarnings();
+               \Wikimedia\suppressWarnings();
                $a['unsetkey'];
-               MediaWiki\restoreWarnings();
+               \Wikimedia\restoreWarnings();
                // No warnings generated
                $this->assertTrue( true );
        }
@@ -42,7 +42,7 @@
        }
 
        /**
-        * Ensure that MediaWiki\quietCall calls the callback function with the
+        * Ensure that Wikimedia\quietCall calls the callback function with the
         * correct parameters, that it returns the callback's return value, and
         * that warnings (if any) are suppressed.
         */
@@ -52,31 +52,31 @@
                };
 
                $this->assertEquals(
-                       MediaWiki\quietCall( 'filemtime', __FILE__ ),
+                       \Wikimedia\quietCall( 'filemtime', __FILE__ ),
                        filemtime( __FILE__ ),
-                       'MediaWiki\quietCall() with built-in function'
+                       'with built-in function'
                );
 
                $this->assertEquals(
-                       MediaWiki\quietCall( 
'FunctionsTest::dummyStaticMethod', 24 ),
+                       \Wikimedia\quietCall( 
'FunctionsTest::dummyStaticMethod', 24 ),
                        self::dummyStaticMethod( 24 ),
-                       'MediaWiki\quietCall() with static method'
+                       'with static method'
                );
 
                $this->assertEquals(
-                       MediaWiki\quietCall( [ $this, 'dummyInstanceMethod' ], 
24 ),
+                       \Wikimedia\quietCall( [ $this, 'dummyInstanceMethod' ], 
24 ),
                        $this->dummyInstanceMethod( 24 ),
-                       'MediaWiki\quietCall() with instance method'
+                       'with instance method'
                );
 
                $this->assertEquals(
-                       MediaWiki\quietCall( $double, 24 ),
+                       \Wikimedia\quietCall( $double, 24 ),
                        $double( 24 ),
-                       'MediaWiki\quietCall() with closure'
+                       'with closure'
                );
 
                $this->assertFalse(
-                       MediaWiki\quietCall( 'filemtime', 
'/this/file/does/not/exist' )
+                       \Wikimedia\quietCall( 'filemtime', 
'/this/file/does/not/exist' )
                );
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/375926
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5da00343715d799d386bb44a77e54a2e08736a69
Gerrit-PatchSet: 9
Gerrit-Project: at-ease
Gerrit-Branch: master
Gerrit-Owner: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to