PermissionManager::userHas{All,Any}Right: don't specify a variadic param.
authorPetr Pchelko <ppchelko@wikimedia.org>
Thu, 22 Aug 2019 20:38:09 +0000 (13:38 -0700)
committerPetr Pchelko <ppchelko@wikimedia.org>
Fri, 23 Aug 2019 00:46:08 +0000 (17:46 -0700)
Change-Id: Ife9d01be57a4926f4a5efa99661163a391564a6e

includes/Permissions/PermissionManager.php

index bd88c17..e6df7d2 100644 (file)
@@ -1199,11 +1199,12 @@ class PermissionManager {
         * Check if user is allowed to make any action
         *
         * @param UserIdentity $user
-        * @param string[] ...$actions
+        * // TODO: HHVM can't create mocks with variable params @param string ...$actions
         * @return bool True if user is allowed to perform *any* of the given actions
         * @since 1.34
         */
-       public function userHasAnyRight( UserIdentity $user, ...$actions ) {
+       public function userHasAnyRight( UserIdentity $user ) {
+               $actions = array_slice( func_get_args(), 1 );
                foreach ( $actions as $action ) {
                        if ( $this->userHasRight( $user, $action ) ) {
                                return true;
@@ -1216,11 +1217,12 @@ class PermissionManager {
         * Check if user is allowed to make all actions
         *
         * @param UserIdentity $user
-        * @param string[] ...$actions
+        * // TODO: HHVM can't create mocks with variable params @param string ...$actions
         * @return bool True if user is allowed to perform *all* of the given actions
         * @since 1.34
         */
-       public function userHasAllRights( UserIdentity $user, ...$actions ) {
+       public function userHasAllRights( UserIdentity $user ) {
+               $actions = array_slice( func_get_args(), 1 );
                foreach ( $actions as $action ) {
                        if ( !$this->userHasRight( $user, $action ) ) {
                                return false;