toLegacyErrorArray(); } if ( $permission === null && !$errors ) { throw new \InvalidArgumentException( __METHOD__ . ': $permission and $errors cannot both be empty' ); } $this->permission = $permission; if ( !count( $errors ) ) { $errors = MediaWikiServices::getInstance() ->getPermissionManager() // @phan-suppress-next-line PhanTypeMismatchArgumentNullable Null on permission is check when used here ->newFatalPermissionDeniedStatus( $this->permission, RequestContext::getMain() ) ->toLegacyErrorArray(); } $this->errors = $errors; // Give the parent class something to work with parent::__construct( 'permissionserrors', Message::newFromSpecifier( $errors[0] ) ); } public function report( $action = self::SEND_OUTPUT ) { global $wgOut; $wgOut->showPermissionsErrorPage( $this->errors, $this->permission ); if ( $action === self::SEND_OUTPUT ) { $wgOut->output(); } } }