Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316301

Change subject: Relax phpdoc of PermissionError to match actual usage
......................................................................

Relax phpdoc of PermissionError to match actual usage

Change-Id: I8ed4a6f2f038fe70084ab673300e24af97e935db
---
M includes/OutputPage.php
M includes/exception/PermissionsError.php
2 files changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/01/316301/1

diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index a69c0e6..5da15b8 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -2390,7 +2390,7 @@
        /**
         * Output a standard permission error page
         *
-        * @param array $errors Error message keys
+        * @param array $errors Error message keys or [key, param...] arrays
         * @param string $action Action that was denied or null if unknown
         */
        public function showPermissionsErrorPage( array $errors, $action = null 
) {
diff --git a/includes/exception/PermissionsError.php 
b/includes/exception/PermissionsError.php
index bd0b120..67fd9dc 100644
--- a/includes/exception/PermissionsError.php
+++ b/includes/exception/PermissionsError.php
@@ -29,12 +29,17 @@
        public $permission, $errors;
 
        /**
-        * @param string $permission A permission name.
-        * @param string[] $errors Error message keys
+        * @param string|null $permission A permission name or null if unknown
+        * @param array $errors Error message keys or [key, param...] arrays; 
must not be empty if
+        *   $permission is null
         */
        public function __construct( $permission, $errors = [] ) {
                global $wgLang;
 
+               if ( $permission === null && !$errors ) {
+                       throw new \LogicException( __METHOD__ . ': $permission 
and $errors cannot both be empty' );
+               }
+
                $this->permission = $permission;
 
                if ( !count( $errors ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ed4a6f2f038fe70084ab673300e24af97e935db
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>

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

Reply via email to