Deprecate more methods dealing with legacy error arrays

* PermissionStatus::toLegacyErrorArray() (soft-deprecated)
* OutputPage::showPermissionsErrorPage() (hard-deprecated)
* OutputPage::formatPermissionsErrorMessage() (hard-deprecated)

Depends-On: I5493deb8b72f499ecd46b8093b5fffbb12e7c246
Depends-On: Iee1dd844d36037982b9927e95d7519da87251ca1
Depends-On: Ic217af5f9766ae2d7850597a4aec1a890d58766f
Depends-On: I62c324b656ab4262fd3f4e252057802a5367f8f9
Change-Id: Ia2d590779176ae060a0567a143697436230c67a9
This commit is contained in:
Bartosz Dziewoński 2024-08-09 12:27:38 +02:00
parent 1fcb1073f3
commit 3d40cde987
4 changed files with 7 additions and 0 deletions

View file

@ -347,6 +347,7 @@ because of Phabricator reports.
been deprecated in favor of new method StatusValue::getMessages().
* PermissionManager::getPermissionErrors() has been deprecated in favor
of getPermissionStatus().
* PermissionStatus::toLegacyErrorArray() is deprecated with no replacement.
* (T166010) All PHP code in MediaWiki is slowly being moved to be in a class
namespace as appropriate, so that we can use PSR-4 auto-loading, which will
speed up general code loading of MediaWiki. The old global namespace class
@ -464,6 +465,8 @@ because of Phabricator reports.
* OutputPage::showFatalError() is deprecated, use showErrorPage() instead.
* OutputPage::showPermissionsErrorPage() is deprecated,
use showPermissionStatus() instead.
* OutputPage::formatPermissionsErrorMessage(), deprecated since 1.36,
now emits deprecation warnings. Use formatPermissionStatus() instead.
* LoadBalancer::getConnectionRef(), deprecated since 1.39, now emits deprecation
warnings. Use ::getConnection() instead.
* DBAccessObjectUtils::getDBOptions() is deprecated, use

View file

@ -3158,6 +3158,7 @@ class OutputPage extends ContextSource {
* @param string|null $action Action that was denied or null if unknown
*/
public function showPermissionsErrorPage( array $errors, $action = null ) {
wfDeprecated( __METHOD__, '1.43' );
foreach ( $errors as $key => $error ) {
$errors[$key] = (array)$error;
}
@ -3299,6 +3300,7 @@ class OutputPage extends ContextSource {
* @return-taint tainted
*/
public function formatPermissionsErrorMessage( array $errors, $action = null ) {
wfDeprecated( __METHOD__, '1.36' );
return $this->formatPermissionInternal(
// @phan-suppress-next-line PhanParamTooFewUnpack Elements of $errors already annotated as non-empty
array_map( fn ( $err ) => $this->msg( ...$err ), $errors ),

View file

@ -93,6 +93,7 @@ class PermissionStatus extends StatusValue {
/**
* Returns this permission status in legacy error array format.
*
* @deprecated since 1.43
* @see PermissionManager::getPermissionErrors()
*
* @return array[]

View file

@ -3290,6 +3290,7 @@ class OutputPageTest extends MediaWikiIntegrationTestCase {
*/
public function testFormatPermissionsErrorMessage( PermissionStatus $status, string $expected ) {
$this->overrideConfigValue( MainConfigNames::LanguageCode, 'qqx' );
$this->filterDeprecated( '/OutputPage::formatPermissionsErrorMessage was deprecated/' );
// Unlike formatPermissionStatus, this method doesn't accept good statuses
$actual = $status->isGood() ? '' :