deprecatePublicProperty( 'permission', '1.43' ); $this->deprecatePublicPropertyFallback( 'errors', '1.43', function () { return $this->status->toLegacyErrorArray(); }, function ( $errors ) { $this->status = PermissionStatus::newEmpty(); foreach ( $errors as $error ) { if ( is_array( $error ) ) { // @phan-suppress-next-line PhanParamTooFewUnpack $this->status->fatal( ...$error ); } else { $this->status->fatal( $error ); } } } ); if ( is_array( $status ) ) { $errors = $status; $status = PermissionStatus::newEmpty(); foreach ( $errors as $error ) { if ( is_array( $error ) ) { // @phan-suppress-next-line PhanParamTooFewUnpack $status->fatal( ...$error ); } else { $status->fatal( $error ); } } } elseif ( !( $status instanceof PermissionStatus ) ) { throw new \InvalidArgumentException( __METHOD__ . ': $status must be PermissionStatus or array, got ' . get_debug_type( $status ) ); } if ( $permission === null && $status->isGood() ) { throw new \InvalidArgumentException( __METHOD__ . ': $permission and $status cannot both be empty' ); } $this->permission = $permission; if ( $status->isGood() ) { $status = MediaWikiServices::getInstance() ->getPermissionManager() // @phan-suppress-next-line PhanTypeMismatchArgumentNullable Null on permission is check when used here ->newFatalPermissionDeniedStatus( $this->permission, RequestContext::getMain() ); } $this->status = $status; // Give the parent class something to work with parent::__construct( 'permissionserrors', $status->getMessages()[0] ); } public function report( $action = self::SEND_OUTPUT ) { global $wgOut; $wgOut->showPermissionStatus( $this->status, $this->permission ); if ( $action === self::SEND_OUTPUT ) { $wgOut->output(); } } } /** @deprecated class alias since 1.44 */ class_alias( PermissionsError::class, 'PermissionsError' );