User is not @newable in 1.36
Bug: T257464 Change-Id: I0d78cfb18166f46a65a65755ca2bef57d504a0b3
This commit is contained in:
parent
b86cc09298
commit
80027cdbbc
3 changed files with 31 additions and 8 deletions
|
|
@ -83,6 +83,9 @@ because of Phabricator reports.
|
|||
* …
|
||||
|
||||
=== Deprecations in 1.36 ===
|
||||
* The User class, which was marked as @newable in 1.35, is no longer newable,
|
||||
meaning that it is no longer safe to manually call the constructor via
|
||||
`new User`. Instead, use the UserFactory service.
|
||||
* …
|
||||
|
||||
=== Other changes in 1.36 ===
|
||||
|
|
|
|||
|
|
@ -51,10 +51,7 @@ use Wikimedia\ScopedCallback;
|
|||
* for rendering normal pages are set in the cookie to minimize use
|
||||
* of the database.
|
||||
*
|
||||
* @newable
|
||||
* @note marked as newable in 1.35 because the canonical way to construct an
|
||||
* anonymous (IP) user is to call the constructor directly. A factory
|
||||
* method for that purpose should be added to TitleFactory, see T257464.
|
||||
* @newable in 1.35 only, the constructor is @internal since 1.36
|
||||
*/
|
||||
class User implements IDBAccessObject, UserIdentity {
|
||||
use ProtectedHookAccessorTrait;
|
||||
|
|
@ -222,9 +219,11 @@ class User implements IDBAccessObject, UserIdentity {
|
|||
|
||||
/**
|
||||
* Lightweight constructor for an anonymous user.
|
||||
* Use the User::newFrom* factory functions for other kinds of users.
|
||||
*
|
||||
* @stable to call
|
||||
* @stable to call since 1.35
|
||||
* @internal since 1.36, use the UserFactory service instead
|
||||
*
|
||||
* @see MediaWiki\User\UserFactory
|
||||
*
|
||||
* @see newFromName()
|
||||
* @see newFromId()
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ use User;
|
|||
/**
|
||||
* Creates User objects.
|
||||
*
|
||||
* For now, there is nothing interesting in this class. It is meant for preventing static User
|
||||
* For now, there is nothing much interesting in this class. It was meant for preventing static User
|
||||
* methods causing problems in unit tests.
|
||||
*
|
||||
* @since 1.35
|
||||
|
|
@ -49,6 +49,9 @@ class UserFactory implements IDBAccessObject {
|
|||
|
||||
/**
|
||||
* @see User::newFromName
|
||||
*
|
||||
* @since 1.35
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $validate Validation strategy, one of the UserNameUtils::RIGOR_*
|
||||
* constants. For no validation, use UserNameUtils::RIGOR_NONE.
|
||||
|
|
@ -62,7 +65,10 @@ class UserFactory implements IDBAccessObject {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns new anonymous User.
|
||||
* Returns a new anonymous User
|
||||
*
|
||||
* @since 1.36
|
||||
*
|
||||
* @param string|null $ip (optional)
|
||||
* @return User
|
||||
*/
|
||||
|
|
@ -81,6 +87,9 @@ class UserFactory implements IDBAccessObject {
|
|||
|
||||
/**
|
||||
* @see User::newFromId
|
||||
*
|
||||
* @since 1.35
|
||||
*
|
||||
* @param int $id
|
||||
* @return User
|
||||
*/
|
||||
|
|
@ -90,6 +99,9 @@ class UserFactory implements IDBAccessObject {
|
|||
|
||||
/**
|
||||
* @see User::newFromActorId
|
||||
*
|
||||
* @since 1.35
|
||||
*
|
||||
* @param int $actorId
|
||||
* @return User
|
||||
*/
|
||||
|
|
@ -99,6 +111,9 @@ class UserFactory implements IDBAccessObject {
|
|||
|
||||
/**
|
||||
* @see User::newFromIdentity
|
||||
*
|
||||
* @since 1.35
|
||||
*
|
||||
* @param UserIdentity $userIdentity
|
||||
* @return User
|
||||
*/
|
||||
|
|
@ -116,6 +131,9 @@ class UserFactory implements IDBAccessObject {
|
|||
|
||||
/**
|
||||
* @see User::newFromAnyId
|
||||
*
|
||||
* @since 1.35
|
||||
*
|
||||
* @param ?int $userId
|
||||
* @param ?string $userName
|
||||
* @param ?int $actorId
|
||||
|
|
@ -133,6 +151,9 @@ class UserFactory implements IDBAccessObject {
|
|||
|
||||
/**
|
||||
* @see User::newFromConfirmationCode
|
||||
*
|
||||
* @since 1.35
|
||||
*
|
||||
* @param string $confirmationCode
|
||||
* @param int $flags
|
||||
* @return User|null
|
||||
|
|
|
|||
Loading…
Reference in a new issue