Core Platform Team/Initiative/Stability annotations/newable
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. |
List of classes intended to be "newable".
Data objects
[edit]includes/title/TitleValue.php
includes/Revision/RevisionSlots.php
includes/Revision/MutableRevisionRecord.php
includes/DerivativeRequest.php
includes/MWTimestamp.php
includes/mail/MailAddress.php
includes/session/Token.php
includes/session/SessionId.php
includes/user/LoggedOutEditToken.php
includes/user/UserIdentityValue.php
includes/exception/ErrorPageError.php
includes/exception/MWException.php
includes/FauxRequest.php
includes/libs/Message/MessageValue.php
includes/libs/Message/DataMessageValue.php
includes/libs/Message/ScalarParam.php
includes/libs/Message/ListParam.php
includes/libs/HtmlArmor.php
includes/session/SessionInfo.php
includes/RawMessage.php
includes/api/ApiHelpParamValueMessage.php
includes/api/ApiMessage.php
includes/api/ApiRawMessage.php
includes/language/Message.php
includes/cache/dependency/FileDependency.php
includes/config/GlobalVarConfig.php
includes/libs/StaticArrayWriter.php
includes/libs/StatusValue.php
includes/parser/StripState.php
includes/Status.php
includes/content/TextContent.php
includes/content/WikitextContent.php
includes/content/JavaScriptContent.php
includes/content/CssContent.php
Also: (nearly) all Exceptions!
Wrapper objects
[edit]includes/libs/objectcache/HashBagOStuff.php
includes/libs/objectcache/CachedBagOStuff.php
includes/utils/BatchRowIterator.php
includes/StubObject.php
includes/ListToggle.php
includes/context/DerivativeContext.php
Tolerated, but need an alternative
[edit]These should be changed to not be newable, but alternatives need to be created first. Direct constructor usage will have to go though deprecation.
includes/ApiMain.php - needs factory
includes/media/BitmapMetadataHandler.php - should become a stateless service or use handler pattern
includes/GitInfo.php - should become a stateless service
includes/logging/LogPage.php - should become a stateless service or use command pattern
includes/logging/ManualLogEntry.php - should become a stateless service or use command pattern
includes/poolcounter/PoolCounterWorkViaCallback.php - needs a factory
includes/context/RequestContext.php - needs to be narrowed down, and should use a factory
includes/search/SearchHighlighter.php - should have a factory
includes/TitleArrayFromResult.php - should perhaps be part of TitleFactory
includes/user/User.php - should at least get a factory method for anons
includes/diff/Diff.php: needs a TextDiffGenerator service or a factory
includes/EditPage.php: needs a factory
DiffFormatter may need services, but the caller usually wants to control the specific type. Each could be a service, or we could have a registry for them.
includes/diff/ArrayDiffFormatter.php
includes/diff/UnifiedDiffFormatter.php
includes/diff/TableDiffFormatter.php
includes/diff/InlineDiffFormatter.php
Classes instantiated by extensions that should not be
[edit]Alternatives exist for:
includes/CommentStoreComment.php: FileImporter should use a factory method or mocks when constructing CommentStoreComment in tests.
includes/Revision/SlotRecord.php: Wikibase should use a factory method or mocks when constructing SlotRecords in tests.
includes/Title.php: several extensions need a better way to represent no title.
includes/cache/LinkBatch.php: several extensions should use LinkBatchFactory instead.
includes/interwiki/Interwiki.php JsonConfig: FauxInterwikiLookup
includes/page/Article.php: several extensions should use Article::newFromTitle instead.
includes/page/WikiPage.php: several extensions should use WikiPage::factory instead.
maintenance/includes/FakeMaintenance.php: OpenIDConnect needs to find a better way to run a maintenance script.
includes/filerepo/LocalRepo.php: some extensions should use RepoGroup instead.
includes/MovePage.php: several extensions should use MovePageFactory instead.
includes/parser/Parser.php: several extensions should use ParserFactory instead.
includes/parser/ParserOptions.php: several extensions should use one of the static factory methods instead.