aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--includes/CommentFormatter/CommentFormatter.php10
-rw-r--r--includes/CommentFormatter/CommentParser.php4
-rw-r--r--includes/CommentStore/CommentStore.php2
-rw-r--r--includes/CommentStore/CommentStoreComment.php4
-rw-r--r--includes/GlobalFunctions.php2
-rw-r--r--includes/HookContainer/HookContainer.php2
-rw-r--r--includes/HookContainer/HookRunner.php2
-rw-r--r--includes/MediaWikiServices.php2
-rw-r--r--includes/Message/Message.php2
-rw-r--r--includes/Output/OutputPage.php6
-rw-r--r--includes/OutputTransform/Stages/HandleTOCMarkers.php4
-rw-r--r--includes/Permissions/Authority.php14
-rw-r--r--includes/Permissions/GrantsInfo.php2
-rw-r--r--includes/Permissions/PermissionManager.php2
-rw-r--r--includes/Permissions/SimpleAuthority.php14
-rw-r--r--includes/Permissions/UltimateAuthority.php14
-rw-r--r--includes/Permissions/UserAuthority.php14
-rw-r--r--includes/ResourceLoader/FileModule.php6
-rw-r--r--includes/ResourceLoader/ForeignApiModule.php2
-rw-r--r--includes/ResourceLoader/ForeignResourceManager.php6
-rw-r--r--includes/ResourceLoader/Module.php2
-rw-r--r--includes/ResourceLoader/ResourceLoader.php6
-rw-r--r--includes/ResourceLoader/SiteModule.php2
-rw-r--r--includes/ResourceLoader/SkinModule.php4
-rw-r--r--includes/ResourceLoader/WikiModule.php2
-rw-r--r--includes/Rest/Handler/Helper/PageContentHelper.php2
-rw-r--r--includes/Rest/Handler/Helper/RevisionContentHelper.php2
-rw-r--r--includes/Rest/Handler/PageHistoryCountHandler.php22
-rw-r--r--includes/Revision/RenderedRevision.php2
-rw-r--r--includes/Revision/RevisionAccessException.php2
-rw-r--r--includes/Revision/RevisionArchiveRecord.php6
-rw-r--r--includes/Revision/RevisionFactory.php4
-rw-r--r--includes/Revision/RevisionLookup.php2
-rw-r--r--includes/Revision/RevisionRecord.php14
-rw-r--r--includes/Revision/RevisionRenderer.php4
-rw-r--r--includes/Revision/RevisionStore.php38
-rw-r--r--includes/Revision/RevisionStoreCacheRecord.php2
-rw-r--r--includes/Revision/RevisionStoreRecord.php4
-rw-r--r--includes/Settings/Config/ConfigBuilder.php4
-rw-r--r--includes/Settings/Config/ConfigBuilderBase.php4
-rw-r--r--includes/Settings/SettingsBuilder.php2
-rw-r--r--includes/Settings/SettingsBuilderException.php2
-rw-r--r--includes/Settings/Source/FileSource.php2
-rw-r--r--includes/Storage/DerivedPageDataUpdater.php6
-rw-r--r--includes/Storage/EditResultBuilder.php2
-rw-r--r--includes/Storage/NameTableStore.php4
-rw-r--r--includes/Storage/PageUpdater.php2
-rw-r--r--includes/Storage/RevisionSlotsUpdate.php4
-rw-r--r--includes/actions/Action.php2
-rw-r--r--includes/actions/pagers/HistoryPager.php10
-rw-r--r--includes/api/ApiAuthManagerHelper.php4
-rw-r--r--includes/api/ApiBase.php8
-rw-r--r--includes/api/ApiEditPage.php18
-rw-r--r--includes/api/ApiFormatRaw.php2
-rw-r--r--includes/api/ApiMain.php4
-rw-r--r--includes/api/ApiMessage.php4
-rw-r--r--includes/api/ApiMessageTrait.php2
-rw-r--r--includes/api/ApiModuleManager.php2
-rw-r--r--includes/api/ApiOptions.php4
-rw-r--r--includes/api/ApiQueryAllDeletedRevisions.php2
-rw-r--r--includes/api/ApiQueryAllRevisions.php2
-rw-r--r--includes/api/ApiQueryBacklinksprop.php2
-rw-r--r--includes/api/ApiQueryBase.php2
-rw-r--r--includes/api/ApiQueryDeletedRevisions.php2
-rw-r--r--includes/api/ApiQueryRevisions.php2
-rw-r--r--includes/api/ApiQueryRevisionsBase.php22
-rw-r--r--includes/api/ApiRawMessage.php2
-rw-r--r--includes/api/ApiUsageException.php4
-rw-r--r--includes/api/IApiMessage.php2
-rw-r--r--includes/api/SearchApi.php2
-rw-r--r--includes/auth/AuthManager.php4
-rw-r--r--includes/auth/CreateFromLoginAuthenticationRequest.php2
-rw-r--r--includes/auth/Throttler.php2
-rw-r--r--includes/block/AbstractBlock.php2
-rw-r--r--includes/block/CompositeBlock.php2
-rw-r--r--includes/block/DatabaseBlockStore.php2
-rw-r--r--includes/cache/GenderCache.php6
-rw-r--r--includes/cache/LinkCache.php6
-rw-r--r--includes/changetags/ChangeTags.php22
-rw-r--r--includes/changetags/ChangeTagsStore.php6
-rw-r--r--includes/content/AbstractContent.php2
-rw-r--r--includes/content/CodeContentHandler.php4
-rw-r--r--includes/content/Content.php2
-rw-r--r--includes/content/ContentHandler.php28
-rw-r--r--includes/content/Renderer/ContentParseParams.php2
-rw-r--r--includes/content/TextContent.php2
-rw-r--r--includes/content/WikitextContent.php2
-rw-r--r--includes/context/RequestContext.php2
-rw-r--r--includes/db/CloneDatabase.php2
-rw-r--r--includes/debug/DeprecatablePropertyArray.php2
-rw-r--r--includes/debug/DeprecationHelper.php4
-rw-r--r--includes/debug/logger/ConsoleLogger.php4
-rw-r--r--includes/debug/logger/LegacySpi.php2
-rw-r--r--includes/debug/logger/LogCapturingSpi.php2
-rw-r--r--includes/deferred/SearchUpdate.php2
-rw-r--r--includes/diff/DifferenceEngineSlotDiffRenderer.php2
-rw-r--r--includes/diff/SlotDiffRenderer.php4
-rw-r--r--includes/diff/TextSlotDiffRenderer.php2
-rw-r--r--includes/diff/UnsupportedSlotDiffRenderer.php2
-rw-r--r--includes/editpage/EditPage.php2
-rw-r--r--includes/editpage/TextConflictHelper.php4
-rw-r--r--includes/exception/LocalizedException.php2
-rw-r--r--includes/exception/MWExceptionRenderer.php2
-rw-r--r--includes/exception/UserBlockedError.php2
-rw-r--r--includes/externalstore/ExternalStoreAccess.php4
-rw-r--r--includes/externalstore/ExternalStoreFactory.php2
-rw-r--r--includes/filerepo/FileBackendDBRepoWrapper.php2
-rw-r--r--includes/filerepo/FileRepo.php4
-rw-r--r--includes/filerepo/LocalRepo.php2
-rw-r--r--includes/filerepo/file/ArchivedFile.php4
-rw-r--r--includes/filerepo/file/File.php6
-rw-r--r--includes/filerepo/file/ForeignAPIFile.php4
-rw-r--r--includes/filerepo/file/ForeignDBFile.php2
-rw-r--r--includes/filerepo/file/LocalFile.php8
-rw-r--r--includes/gallery/ImageGalleryBase.php4
-rw-r--r--includes/gallery/PackedImageGallery.php2
-rw-r--r--includes/gallery/SlideshowImageGallery.php2
-rw-r--r--includes/htmlform/CodexHTMLForm.php2
-rw-r--r--includes/htmlform/HTMLForm.php2
-rw-r--r--includes/htmlform/OOUIHTMLForm.php2
-rw-r--r--includes/htmlform/VFormHTMLForm.php2
-rw-r--r--includes/http/GuzzleHttpRequest.php2
-rw-r--r--includes/http/HttpRequestFactory.php2
-rw-r--r--includes/http/MWHttpRequest.php2
-rw-r--r--includes/http/Telemetry.php2
-rw-r--r--includes/import/ImportableOldRevisionImporter.php6
-rw-r--r--includes/import/WikiImporterFactory.php2
-rw-r--r--includes/installer/ConnectionStatus.php2
-rw-r--r--includes/installer/DatabaseUpdater.php4
-rw-r--r--includes/installer/InstallException.php2
-rw-r--r--includes/interwiki/InterwikiLookupAdapter.php2
-rw-r--r--includes/jobqueue/JobSpecification.php2
-rw-r--r--includes/jobqueue/jobs/CategoryMembershipChangeJob.php2
-rw-r--r--includes/json/JsonCodec.php2
-rw-r--r--includes/json/JsonDeserializer.php4
-rw-r--r--includes/language/Language.php20
-rw-r--r--includes/language/MessageCache.php8
-rw-r--r--includes/language/TrivialLanguageConverter.php2
-rw-r--r--includes/languages/LanguageFi.php2
-rw-r--r--includes/libs/Message/DataMessageValue.php4
-rw-r--r--includes/libs/ParamValidator/TypeDef.php2
-rw-r--r--includes/libs/ParamValidator/ValidationException.php2
-rw-r--r--includes/libs/Stats/OutputFormats.php2
-rw-r--r--includes/libs/WRStats/LimitOperation.php2
-rw-r--r--includes/libs/WRStats/WRStatsRateLimiter.php6
-rw-r--r--includes/libs/filebackend/FSFileBackend.php2
-rw-r--r--includes/libs/filebackend/FileBackend.php2
-rw-r--r--includes/libs/filebackend/FileBackendMultiWrite.php2
-rw-r--r--includes/libs/filebackend/FileBackendStore.php4
-rw-r--r--includes/libs/lockmanager/ScopedLock.php2
-rw-r--r--includes/libs/mime/MimeAnalyzer.php2
-rw-r--r--includes/libs/objectcache/BagOStuff.php4
-rw-r--r--includes/libs/objectcache/CachedBagOStuff.php4
-rw-r--r--includes/libs/objectcache/MediumSpecificBagOStuff.php4
-rw-r--r--includes/libs/objectcache/MultiWriteBagOStuff.php4
-rw-r--r--includes/libs/objectcache/WANObjectCache.php6
-rw-r--r--includes/libs/rdbms/ServerInfo.php2
-rw-r--r--includes/libs/rdbms/database/DBConnRef.php16
-rw-r--r--includes/libs/rdbms/database/Database.php18
-rw-r--r--includes/libs/rdbms/database/IDatabase.php2
-rw-r--r--includes/libs/rdbms/database/IDatabaseForOwner.php2
-rw-r--r--includes/libs/rdbms/database/IMaintainableDatabase.php12
-rw-r--r--includes/libs/rdbms/database/Query.php2
-rw-r--r--includes/libs/rdbms/database/TransactionManager.php8
-rw-r--r--includes/libs/rdbms/exception/DBConnectionError.php2
-rw-r--r--includes/libs/rdbms/exception/DBError.php2
-rw-r--r--includes/libs/rdbms/exception/DBExpectedError.php2
-rw-r--r--includes/libs/rdbms/exception/DBLanguageError.php2
-rw-r--r--includes/libs/rdbms/exception/DBTransactionError.php2
-rw-r--r--includes/libs/rdbms/lbfactory/ILBFactory.php4
-rw-r--r--includes/libs/rdbms/lbfactory/LBFactory.php4
-rw-r--r--includes/libs/rdbms/loadbalancer/ILoadBalancer.php2
-rw-r--r--includes/libs/rdbms/loadbalancer/LoadBalancer.php4
-rw-r--r--includes/libs/rdbms/platform/SQLPlatform.php4
-rw-r--r--includes/libs/redis/RedisConnectionPool.php2
-rw-r--r--includes/linker/Linker.php4
-rw-r--r--includes/logging/LogEventsList.php2
-rw-r--r--includes/logging/LogFormatter.php2
-rw-r--r--includes/logging/LogPager.php6
-rw-r--r--includes/logging/ManualLogEntry.php2
-rw-r--r--includes/logging/RightsLogFormatter.php2
-rw-r--r--includes/mail/EmailUserFactory.php2
-rw-r--r--includes/objectcache/SqlBagOStuff.php6
-rw-r--r--includes/page/Article.php4
-rw-r--r--includes/page/File/BadFileLookup.php2
-rw-r--r--includes/page/ImageHistoryPseudoPager.php2
-rw-r--r--includes/page/MergeHistory.php4
-rw-r--r--includes/page/MergeHistoryFactory.php2
-rw-r--r--includes/page/MovePage.php4
-rw-r--r--includes/page/PageAssertionException.php2
-rw-r--r--includes/page/PageCommandFactory.php2
-rw-r--r--includes/page/WikiPage.php22
-rw-r--r--includes/pager/IndexPager.php4
-rw-r--r--includes/pager/TablePager.php2
-rw-r--r--includes/parser/CoreParserFunctions.php2
-rw-r--r--includes/parser/DateFormatter.php2
-rw-r--r--includes/parser/MagicWord.php2
-rw-r--r--includes/parser/MagicWordArray.php2
-rw-r--r--includes/parser/Parser.php4
-rw-r--r--includes/parser/ParserCache.php2
-rw-r--r--includes/parser/ParserOptions.php2
-rw-r--r--includes/parser/Preprocessor.php2
-rw-r--r--includes/parser/Preprocessor_Hash.php2
-rw-r--r--includes/parser/RevisionOutputCache.php8
-rw-r--r--includes/parser/StripState.php2
-rw-r--r--includes/password/Password.php2
-rw-r--r--includes/password/PasswordFactory.php2
-rw-r--r--includes/poolcounter/PoolCounterWork.php2
-rw-r--r--includes/preferences/DefaultPreferencesFactory.php10
-rw-r--r--includes/preferences/MultiTitleFilter.php2
-rw-r--r--includes/preferences/MultiUsernameFilter.php2
-rw-r--r--includes/profiler/Profiler.php2
-rw-r--r--includes/recentchanges/CategoryMembershipChange.php2
-rw-r--r--includes/recentchanges/ChangesList.php8
-rw-r--r--includes/recentchanges/RecentChange.php4
-rw-r--r--includes/revisiondelete/RevisionDeleteUser.php6
-rw-r--r--includes/search/FauxSearchResult.php4
-rw-r--r--includes/search/Hook/SearchResultProvideThumbnailHook.php2
-rw-r--r--includes/search/SearchEngine.php4
-rw-r--r--includes/search/SearchResult.php2
-rw-r--r--includes/search/SearchResultThumbnailProvider.php2
-rw-r--r--includes/search/SearchSuggestion.php4
-rw-r--r--includes/search/searchwidgets/BasicSearchResultSetWidget.php4
-rw-r--r--includes/search/searchwidgets/FullSearchResultWidget.php2
-rw-r--r--includes/session/MetadataMergeException.php2
-rw-r--r--includes/session/SessionManager.php10
-rw-r--r--includes/session/SessionManagerInterface.php4
-rw-r--r--includes/skins/QuickTemplate.php2
-rw-r--r--includes/skins/SkinFactory.php2
-rw-r--r--includes/specialpage/SpecialPage.php7
-rw-r--r--includes/specialpage/SpecialPageFactory.php4
-rw-r--r--includes/specialpage/SpecialRedirectWithAction.php2
-rw-r--r--includes/specials/SpecialAllPages.php6
-rw-r--r--includes/specials/SpecialBlock.php4
-rw-r--r--includes/specials/SpecialChangeContentModel.php2
-rw-r--r--includes/specials/SpecialEditWatchlist.php16
-rw-r--r--includes/specials/SpecialLog.php2
-rw-r--r--includes/specials/SpecialMute.php2
-rw-r--r--includes/specials/SpecialPageLanguage.php2
-rw-r--r--includes/specials/SpecialPreferences.php4
-rw-r--r--includes/specials/SpecialRecentChanges.php12
-rw-r--r--includes/specials/SpecialUndelete.php2
-rw-r--r--includes/specials/SpecialUpload.php10
-rw-r--r--includes/specials/SpecialUserRights.php14
-rw-r--r--includes/specials/SpecialVersion.php2
-rw-r--r--includes/specials/forms/UploadForm.php12
-rw-r--r--includes/specials/helpers/ImportReporter.php2
-rw-r--r--includes/specials/pagers/AllMessagesTablePager.php2
-rw-r--r--includes/specials/pagers/ContribsPager.php16
-rw-r--r--includes/title/Title.php2
-rw-r--r--includes/title/TitleFactory.php2
-rw-r--r--includes/upload/UploadBase.php2
-rw-r--r--includes/upload/UploadFromChunks.php2
-rw-r--r--includes/upload/UploadFromStash.php2
-rw-r--r--includes/upload/UploadStash.php2
-rw-r--r--includes/upload/exception/UploadStashException.php2
-rw-r--r--includes/user/BotPassword.php2
-rw-r--r--includes/user/BotPasswordStore.php4
-rw-r--r--includes/user/CentralId/CentralIdLookupFactory.php4
-rw-r--r--includes/user/TalkPageNotificationManager.php6
-rw-r--r--includes/user/User.php16
-rw-r--r--includes/user/UserGroupManager.php4
-rw-r--r--includes/user/UserTimeCorrection.php2
-rw-r--r--includes/utils/MWRestrictions.php2
-rw-r--r--includes/utils/MWTimestamp.php6
-rw-r--r--includes/watchlist/WatchlistManager.php4
-rw-r--r--includes/xml/Xml.php2
-rw-r--r--maintenance/findBadBlobs.php2
-rw-r--r--maintenance/includes/Maintenance.php2
-rw-r--r--tests/phpunit/MediaWikiIntegrationTestCase.php16
-rw-r--r--tests/phpunit/MediaWikiTestCaseTrait.php2
-rw-r--r--tests/phpunit/ResourceLoaderTestCase.php6
-rw-r--r--tests/phpunit/includes/Output/OutputPageTest.php6
-rw-r--r--tests/phpunit/includes/Permissions/PermissionManagerTest.php2
-rw-r--r--tests/phpunit/includes/ResourceLoader/ResourceLoaderTest.php2
-rw-r--r--tests/phpunit/includes/ResourceLoader/WikiModuleTest.php2
-rw-r--r--tests/phpunit/includes/Revision/MutableRevisionRecordTest.php2
-rw-r--r--tests/phpunit/includes/Revision/RenderedRevisionTest.php2
-rw-r--r--tests/phpunit/includes/Revision/RevisionArchiveRecordTest.php2
-rw-r--r--tests/phpunit/includes/Revision/RevisionStoreRecordTest.php2
-rw-r--r--tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php4
-rw-r--r--tests/phpunit/includes/Storage/RevisionSlotsUpdateTest.php2
-rw-r--r--tests/phpunit/includes/Storage/SqlBlobStoreTest.php4
-rw-r--r--tests/phpunit/includes/actions/ActionEntryPointTest.php2
-rw-r--r--tests/phpunit/includes/actions/ActionTest.php8
-rw-r--r--tests/phpunit/includes/api/ApiBlockTest.php2
-rw-r--r--tests/phpunit/includes/api/ApiMainTest.php2
-rw-r--r--tests/phpunit/includes/api/ApiOptionsTest.php2
-rw-r--r--tests/phpunit/includes/api/ApiStashEditTest.php4
-rw-r--r--tests/phpunit/includes/api/ApiTestCase.php10
-rw-r--r--tests/phpunit/includes/api/ApiTestContext.php2
-rw-r--r--tests/phpunit/includes/api/ApiUserrightsTest.php4
-rw-r--r--tests/phpunit/includes/api/RandomImageGenerator.php2
-rw-r--r--tests/phpunit/includes/api/query/ApiQueryTestBase.php4
-rw-r--r--tests/phpunit/includes/cache/LinkCacheTest.php2
-rw-r--r--tests/phpunit/includes/content/CssContentTest.php2
-rw-r--r--tests/phpunit/includes/content/FallbackContentTest.php2
-rw-r--r--tests/phpunit/includes/content/TextContentTest.php2
-rw-r--r--tests/phpunit/includes/filerepo/AuthenticatedFileEntryPointTest.php2
-rw-r--r--tests/phpunit/includes/filerepo/Thumbnail404EntryPointTest.php2
-rw-r--r--tests/phpunit/includes/filerepo/ThumbnailEntryPointTest.php2
-rw-r--r--tests/phpunit/includes/libs/serialization/SerializationTestTrait.php2
-rw-r--r--tests/phpunit/includes/libs/serialization/SerializationTestUtils.php2
-rw-r--r--tests/phpunit/includes/logging/DatabaseLogEntryTest.php4
-rw-r--r--tests/phpunit/includes/media/SvgHandlerTest.php2
-rw-r--r--tests/phpunit/includes/page/ArticleTest.php2
-rw-r--r--tests/phpunit/includes/page/WikiPageDbTest.php2
-rw-r--r--tests/phpunit/includes/parser/MagicWordFactoryTest.php2
-rw-r--r--tests/phpunit/includes/parser/ParserCacheTest.php8
-rw-r--r--tests/phpunit/includes/parser/ParserOptionsTest.php2
-rw-r--r--tests/phpunit/includes/parser/RevisionOutputCacheTest.php4
-rw-r--r--tests/phpunit/includes/poolcounter/PoolWorkArticleViewCurrentTest.php2
-rw-r--r--tests/phpunit/includes/poolcounter/PoolWorkArticleViewOldTest.php2
-rw-r--r--tests/phpunit/includes/poolcounter/PoolWorkArticleViewTest.php2
-rw-r--r--tests/phpunit/includes/recentchanges/CategoryMembershipChangeTest.php2
-rw-r--r--tests/phpunit/includes/search/PrefixSearchTest.php2
-rw-r--r--tests/phpunit/includes/search/SearchEnginePrefixTest.php2
-rw-r--r--tests/phpunit/includes/search/SearchResultThumbnailProviderTest.php2
-rw-r--r--tests/phpunit/includes/session/SessionBackendTest.php2
-rw-r--r--tests/phpunit/includes/session/TestUtils.php2
-rw-r--r--tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php4
-rw-r--r--tests/phpunit/includes/specials/ContribsPagerTest.php2
-rw-r--r--tests/phpunit/includes/specials/SpecialPageExecutor.php8
-rw-r--r--tests/phpunit/includes/specials/SpecialPageTestBase.php4
-rw-r--r--tests/phpunit/includes/specials/SpecialRecentChangesTest.php6
-rw-r--r--tests/phpunit/includes/specials/redirects/SpecialTalkPageTest.php2
-rw-r--r--tests/phpunit/includes/title/NamespaceInfoTest.php2
-rw-r--r--tests/phpunit/includes/user/TalkPageNotificationManagerTest.php2
-rw-r--r--tests/phpunit/includes/user/UserGroupManagerTest.php6
-rw-r--r--tests/phpunit/integration/includes/CommentFormatter/CommentFormatterTest.php4
-rw-r--r--tests/phpunit/integration/includes/CommentFormatter/RowCommentFormatterTest.php2
-rw-r--r--tests/phpunit/integration/includes/Permissions/RateLimiterTest.php2
-rw-r--r--tests/phpunit/integration/includes/Rest/Handler/HTMLHandlerTestTrait.php4
-rw-r--r--tests/phpunit/integration/includes/Rest/Handler/Helper/HtmlOutputRendererHelperTest.php2
-rw-r--r--tests/phpunit/integration/includes/Rest/Handler/Helper/PageContentHelperTest.php2
-rw-r--r--tests/phpunit/integration/includes/Rest/Handler/Helper/RevisionContentHelperTest.php2
-rw-r--r--tests/phpunit/integration/includes/Rest/Handler/RevisionSourceHandlerTest.php2
-rw-r--r--tests/phpunit/integration/includes/parser/Parsoid/HtmlToContentTransformTest.php2
-rw-r--r--tests/phpunit/maintenance/DumpAsserter.php4
-rw-r--r--tests/phpunit/mocks/permissions/MockAuthorityTrait.php4
-rw-r--r--tests/phpunit/suites/ParserIntegrationTest.php2
-rw-r--r--tests/phpunit/suites/ParserTestTopLevelSuite.php2
-rw-r--r--tests/phpunit/suites/SuiteEventsTrait.php2
-rw-r--r--tests/phpunit/unit/includes/Message/MessageFormatterFactoryTest.php2
-rw-r--r--tests/phpunit/unit/includes/Rest/Handler/ActionModuleBasedHandlerTestTrait.php2
-rw-r--r--tests/phpunit/unit/includes/Rest/Handler/HandlerTestTrait.php14
-rw-r--r--tests/phpunit/unit/includes/Rest/Handler/SearchHandlerTest.php2
-rw-r--r--tests/phpunit/unit/includes/Revision/SlotRoleRegistryTest.php2
-rw-r--r--tests/phpunit/unit/includes/auth/AuthenticationProviderTestTrait.php10
-rw-r--r--tests/phpunit/unit/includes/block/BlockUtilsTest.php2
-rw-r--r--tests/phpunit/unit/includes/libs/ParamValidator/TypeDefTest.php2
-rw-r--r--tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php2
-rw-r--r--tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php2
-rw-r--r--tests/phpunit/unit/includes/mail/EmailUserTest.php14
-rw-r--r--tests/phpunit/unit/includes/page/DeletePageTest.php16
-rw-r--r--tests/phpunit/unit/includes/page/UndeletePageTest.php8
-rw-r--r--tests/phpunit/unit/includes/parser/MagicWordArrayTest.php6
-rw-r--r--tests/phpunit/unit/includes/session/SessionProviderTestTrait.php10
-rw-r--r--tests/phpunit/unit/includes/watchlist/WatchedItemQueryServiceUnitTest.php2
359 files changed, 746 insertions, 741 deletions
diff --git a/includes/CommentFormatter/CommentFormatter.php b/includes/CommentFormatter/CommentFormatter.php
index 5c888d4c11e2..bfe76ecd3a30 100644
--- a/includes/CommentFormatter/CommentFormatter.php
+++ b/includes/CommentFormatter/CommentFormatter.php
@@ -48,7 +48,7 @@ class CommentFormatter {
* wiki), as used by WikiMap.
* @return string
*/
- public function format( string $comment, LinkTarget $selfLinkTarget = null,
+ public function format( string $comment, ?LinkTarget $selfLinkTarget = null,
$samePage = false, $wikiId = false
) {
return $this->formatInternal( $comment, true, false, false,
@@ -69,7 +69,7 @@ class CommentFormatter {
* @param bool $useParentheses
* @return string
*/
- public function formatBlock( string $comment, LinkTarget $selfLinkTarget = null,
+ public function formatBlock( string $comment, ?LinkTarget $selfLinkTarget = null,
$samePage = false, $wikiId = false, $useParentheses = true
) {
return $this->formatInternal( $comment, true, true, $useParentheses,
@@ -94,7 +94,7 @@ class CommentFormatter {
* wiki), as used by WikiMap.
* @return string
*/
- public function formatLinksUnsafe( string $comment, LinkTarget $selfLinkTarget = null,
+ public function formatLinksUnsafe( string $comment, ?LinkTarget $selfLinkTarget = null,
$samePage = false, $wikiId = false
) {
$parser = $this->parserFactory->create();
@@ -115,7 +115,7 @@ class CommentFormatter {
* wiki), as used by WikiMap.
* @return string
*/
- public function formatLinks( string $comment, LinkTarget $selfLinkTarget = null,
+ public function formatLinks( string $comment, ?LinkTarget $selfLinkTarget = null,
$samePage = false, $wikiId = false
) {
return $this->formatInternal( $comment, false, false, false,
@@ -165,7 +165,7 @@ class CommentFormatter {
* wiki), as used by WikiMap.
* @return string[]
*/
- public function formatStrings( $strings, LinkTarget $selfLinkTarget = null,
+ public function formatStrings( $strings, ?LinkTarget $selfLinkTarget = null,
$samePage = false, $wikiId = false
) {
$parser = $this->parserFactory->create();
diff --git a/includes/CommentFormatter/CommentParser.php b/includes/CommentFormatter/CommentParser.php
index 5fee33510e27..58756e653eb8 100644
--- a/includes/CommentFormatter/CommentParser.php
+++ b/includes/CommentFormatter/CommentParser.php
@@ -113,7 +113,7 @@ class CommentParser {
* @param bool $enableSectionLinks
* @return string
*/
- public function preprocess( string $comment, LinkTarget $selfLinkTarget = null,
+ public function preprocess( string $comment, ?LinkTarget $selfLinkTarget = null,
$samePage = false, $wikiId = false, $enableSectionLinks = true
) {
return $this->preprocessInternal( $comment, false, $selfLinkTarget,
@@ -130,7 +130,7 @@ class CommentParser {
* @param bool $enableSectionLinks
* @return string
*/
- public function preprocessUnsafe( $comment, LinkTarget $selfLinkTarget = null,
+ public function preprocessUnsafe( $comment, ?LinkTarget $selfLinkTarget = null,
$samePage = false, $wikiId = false, $enableSectionLinks = true
) {
return $this->preprocessInternal( $comment, true, $selfLinkTarget,
diff --git a/includes/CommentStore/CommentStore.php b/includes/CommentStore/CommentStore.php
index 50191b3d2cf8..7c4688007f71 100644
--- a/includes/CommentStore/CommentStore.php
+++ b/includes/CommentStore/CommentStore.php
@@ -277,7 +277,7 @@ class CommentStore {
* Ignored if $comment is a CommentStoreComment.
* @return CommentStoreComment
*/
- public function createComment( IDatabase $dbw, $comment, array $data = null ) {
+ public function createComment( IDatabase $dbw, $comment, ?array $data = null ) {
$comment = CommentStoreComment::newUnsavedComment( $comment, $data );
# Truncate comment in a Unicode-sensitive manner
diff --git a/includes/CommentStore/CommentStoreComment.php b/includes/CommentStore/CommentStoreComment.php
index 5aadee6a8a5e..cff6a0ed5781 100644
--- a/includes/CommentStore/CommentStoreComment.php
+++ b/includes/CommentStore/CommentStoreComment.php
@@ -54,7 +54,7 @@ class CommentStoreComment {
* @param Message|null $message
* @param array|null $data
*/
- public function __construct( $id, string $text, Message $message = null, array $data = null ) {
+ public function __construct( $id, string $text, ?Message $message = null, ?array $data = null ) {
$this->id = (int)$id;
$this->text = $text;
$this->message = $message
@@ -74,7 +74,7 @@ class CommentStoreComment {
* Ignored if $comment is a CommentStoreComment.
* @return CommentStoreComment
*/
- public static function newUnsavedComment( $comment, array $data = null ) {
+ public static function newUnsavedComment( $comment, ?array $data = null ) {
if ( $comment instanceof CommentStoreComment ) {
return $comment;
}
diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 64f19e9782c7..f59d486e5731 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -1641,7 +1641,7 @@ function wfMerge(
string $mine,
string $yours,
?string &$simplisticMergeAttempt,
- string &$mergeLeftovers = null
+ ?string &$mergeLeftovers = null
): bool {
global $wgDiff3;
diff --git a/includes/HookContainer/HookContainer.php b/includes/HookContainer/HookContainer.php
index 79ec955b6d62..7fed84399f0d 100644
--- a/includes/HookContainer/HookContainer.php
+++ b/includes/HookContainer/HookContainer.php
@@ -642,7 +642,7 @@ class HookContainer implements SalvageableService {
*
* @return void
*/
- private function checkDeprecation( string $hook, $handler, array $deprecationInfo = null ): void {
+ private function checkDeprecation( string $hook, $handler, ?array $deprecationInfo = null ): void {
if ( !$deprecationInfo ) {
$deprecatedHooks = $this->registry->getDeprecatedHooks();
$deprecationInfo = $deprecatedHooks->getDeprecationInfo( $hook );
diff --git a/includes/HookContainer/HookRunner.php b/includes/HookContainer/HookRunner.php
index 97cb5cf06205..0f1e85305643 100644
--- a/includes/HookContainer/HookRunner.php
+++ b/includes/HookContainer/HookRunner.php
@@ -3429,7 +3429,7 @@ class HookRunner implements
);
}
- public function onSearchResultProvideThumbnail( array $pageIdentities, &$thumbnails, int $size = null ) {
+ public function onSearchResultProvideThumbnail( array $pageIdentities, &$thumbnails, ?int $size = null ) {
return $this->container->run(
'SearchResultProvideThumbnail',
[ $pageIdentities, &$thumbnails, $size ]
diff --git a/includes/MediaWikiServices.php b/includes/MediaWikiServices.php
index 4485238fa384..b1c7a142abf5 100644
--- a/includes/MediaWikiServices.php
+++ b/includes/MediaWikiServices.php
@@ -415,7 +415,7 @@ class MediaWikiServices extends ServiceContainer {
* @param string $quick Set this to "quick" to allow expensive resources to be re-used.
* See SalvageableService for details.
*/
- public static function resetGlobalInstance( Config $bootstrapConfig = null, $quick = '' ) {
+ public static function resetGlobalInstance( ?Config $bootstrapConfig = null, $quick = '' ) {
if ( self::$instance === null ) {
// no global instance yet, nothing to reset
return;
diff --git a/includes/Message/Message.php b/includes/Message/Message.php
index 4595356a51b8..20b22fc0f553 100644
--- a/includes/Message/Message.php
+++ b/includes/Message/Message.php
@@ -243,7 +243,7 @@ class Message implements Stringable, MessageSpecifier, Serializable {
* @param array $params Message parameters
* @param Language|null $language [optional] Language to use (defaults to current user language).
*/
- public function __construct( $key, $params = [], Language $language = null ) {
+ public function __construct( $key, $params = [], ?Language $language = null ) {
if ( $key instanceof MessageSpecifier ) {
if ( $params ) {
throw new InvalidArgumentException(
diff --git a/includes/Output/OutputPage.php b/includes/Output/OutputPage.php
index 544353cde024..16af9cc10d2f 100644
--- a/includes/Output/OutputPage.php
+++ b/includes/Output/OutputPage.php
@@ -2156,7 +2156,7 @@ class OutputPage extends ContextSource {
* @since 1.32
*/
public function addWikiTextAsInterface(
- $text, $linestart = true, PageReference $title = null
+ $text, $linestart = true, ?PageReference $title = null
) {
$title ??= $this->getTitle();
if ( $title === null ) {
@@ -2206,7 +2206,7 @@ class OutputPage extends ContextSource {
* @since 1.32
*/
public function addWikiTextAsContent(
- $text, $linestart = true, PageReference $title = null
+ $text, $linestart = true, ?PageReference $title = null
) {
$title ??= $this->getTitle();
if ( !$title ) {
@@ -3407,7 +3407,7 @@ class OutputPage extends ContextSource {
* @return string
* @return-taint tainted
*/
- public function formatPermissionStatus( PermissionStatus $status, string $action = null ): string {
+ public function formatPermissionStatus( PermissionStatus $status, ?string $action = null ): string {
if ( $status->isGood() ) {
return '';
}
diff --git a/includes/OutputTransform/Stages/HandleTOCMarkers.php b/includes/OutputTransform/Stages/HandleTOCMarkers.php
index 8d8a54ecb1d3..f4c3e0c90e8c 100644
--- a/includes/OutputTransform/Stages/HandleTOCMarkers.php
+++ b/includes/OutputTransform/Stages/HandleTOCMarkers.php
@@ -148,7 +148,7 @@ class HandleTOCMarkers extends ContentTextTransformStage {
* @param Language|null $lang Language for the toc title, defaults to user language
* @return string Full html of the TOC
*/
- private static function tocList( $toc, Language $lang = null ) {
+ private static function tocList( $toc, ?Language $lang = null ) {
$lang ??= RequestContext::getMain()->getLanguage();
$title = wfMessage( 'toc' )->inLanguage( $lang )->escaped();
@@ -186,7 +186,7 @@ class HandleTOCMarkers extends ContentTextTransformStage {
* - 'maxtoclevel' Max TOC level to generate
* @return string HTML fragment
*/
- private static function generateTOC( ?TOCData $tocData, Language $lang = null, array $options = [] ): string {
+ private static function generateTOC( ?TOCData $tocData, ?Language $lang = null, array $options = [] ): string {
$toc = '';
$lastLevel = 0;
$maxTocLevel = $options['maxtoclevel'] ?? null;
diff --git a/includes/Permissions/Authority.php b/includes/Permissions/Authority.php
index 196fc344b281..5ec019868c1c 100644
--- a/includes/Permissions/Authority.php
+++ b/includes/Permissions/Authority.php
@@ -85,7 +85,7 @@ interface Authority {
*
* @see probablyCan
*/
- public function isAllowed( string $permission, PermissionStatus $status = null ): bool;
+ public function isAllowed( string $permission, ?PermissionStatus $status = null ): bool;
/**
* Checks whether this authority has any of the given permissions in general.
@@ -133,7 +133,7 @@ interface Authority {
public function probablyCan(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool;
/**
@@ -158,7 +158,7 @@ interface Authority {
public function definitelyCan(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool;
/**
@@ -183,7 +183,7 @@ interface Authority {
*/
public function isDefinitelyAllowed(
string $action,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool;
/**
@@ -205,7 +205,7 @@ interface Authority {
*/
public function authorizeAction(
string $action,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool;
/**
@@ -228,7 +228,7 @@ interface Authority {
public function authorizeRead(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool;
/**
@@ -251,7 +251,7 @@ interface Authority {
public function authorizeWrite(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool;
/**
diff --git a/includes/Permissions/GrantsInfo.php b/includes/Permissions/GrantsInfo.php
index 26e3bbf38708..6ae85c01d6d4 100644
--- a/includes/Permissions/GrantsInfo.php
+++ b/includes/Permissions/GrantsInfo.php
@@ -132,7 +132,7 @@ class GrantsInfo {
* @param string[]|null $grantsFilter
* @return string[][] Map of (group => (grant list))
*/
- public function getGrantGroups( array $grantsFilter = null ): array {
+ public function getGrantGroups( ?array $grantsFilter = null ): array {
if ( is_array( $grantsFilter ) ) {
$grantsFilter = array_fill_keys( $grantsFilter, true );
}
diff --git a/includes/Permissions/PermissionManager.php b/includes/Permissions/PermissionManager.php
index 6b9bc08e57b3..98a26c74e06b 100644
--- a/includes/Permissions/PermissionManager.php
+++ b/includes/Permissions/PermissionManager.php
@@ -1736,7 +1736,7 @@ class PermissionManager {
* @param UserIdentity|null $user User to check
* @return string[]
*/
- public function getNamespaceRestrictionLevels( $index, UserIdentity $user = null ): array {
+ public function getNamespaceRestrictionLevels( $index, ?UserIdentity $user = null ): array {
if ( !isset( $this->options->get( MainConfigNames::NamespaceProtection )[$index] ) ) {
// All levels are valid if there's no namespace restriction.
// But still filter by user, if necessary
diff --git a/includes/Permissions/SimpleAuthority.php b/includes/Permissions/SimpleAuthority.php
index 9d8c24ad0917..899099a5cee8 100644
--- a/includes/Permissions/SimpleAuthority.php
+++ b/includes/Permissions/SimpleAuthority.php
@@ -73,7 +73,7 @@ class SimpleAuthority implements Authority {
}
/** @inheritDoc */
- public function isAllowed( string $permission, PermissionStatus $status = null ): bool {
+ public function isAllowed( string $permission, ?PermissionStatus $status = null ): bool {
return isset( $this->permissions[ $permission ] );
}
@@ -123,7 +123,7 @@ class SimpleAuthority implements Authority {
public function probablyCan(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return $this->checkPermission( $action, $status );
}
@@ -132,18 +132,18 @@ class SimpleAuthority implements Authority {
public function definitelyCan(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return $this->checkPermission( $action, $status );
}
/** @inheritDoc */
- public function isDefinitelyAllowed( string $action, PermissionStatus $status = null ): bool {
+ public function isDefinitelyAllowed( string $action, ?PermissionStatus $status = null ): bool {
return $this->checkPermission( $action, $status );
}
/** @inheritDoc */
- public function authorizeAction( string $action, PermissionStatus $status = null ): bool {
+ public function authorizeAction( string $action, ?PermissionStatus $status = null ): bool {
return $this->checkPermission( $action, $status );
}
@@ -151,7 +151,7 @@ class SimpleAuthority implements Authority {
public function authorizeRead(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return $this->checkPermission( $action, $status );
}
@@ -160,7 +160,7 @@ class SimpleAuthority implements Authority {
public function authorizeWrite(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return $this->checkPermission( $action, $status );
}
diff --git a/includes/Permissions/UltimateAuthority.php b/includes/Permissions/UltimateAuthority.php
index 7c4d16a51a0d..fa61b80fb4ad 100644
--- a/includes/Permissions/UltimateAuthority.php
+++ b/includes/Permissions/UltimateAuthority.php
@@ -62,7 +62,7 @@ class UltimateAuthority implements Authority {
}
/** @inheritDoc */
- public function isAllowed( string $permission, PermissionStatus $status = null ): bool {
+ public function isAllowed( string $permission, ?PermissionStatus $status = null ): bool {
return true;
}
@@ -88,7 +88,7 @@ class UltimateAuthority implements Authority {
public function probablyCan(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return true;
}
@@ -97,18 +97,18 @@ class UltimateAuthority implements Authority {
public function definitelyCan(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return true;
}
/** @inheritDoc */
- public function isDefinitelyAllowed( string $action, PermissionStatus $status = null ): bool {
+ public function isDefinitelyAllowed( string $action, ?PermissionStatus $status = null ): bool {
return true;
}
/** @inheritDoc */
- public function authorizeAction( string $action, PermissionStatus $status = null ): bool {
+ public function authorizeAction( string $action, ?PermissionStatus $status = null ): bool {
return true;
}
@@ -116,7 +116,7 @@ class UltimateAuthority implements Authority {
public function authorizeRead(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return true;
}
@@ -125,7 +125,7 @@ class UltimateAuthority implements Authority {
public function authorizeWrite(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return true;
}
diff --git a/includes/Permissions/UserAuthority.php b/includes/Permissions/UserAuthority.php
index 2dbd0d62aac3..fca1534344bb 100644
--- a/includes/Permissions/UserAuthority.php
+++ b/includes/Permissions/UserAuthority.php
@@ -140,7 +140,7 @@ class UserAuthority implements Authority {
}
/** @inheritDoc */
- public function isAllowed( string $permission, PermissionStatus $status = null ): bool {
+ public function isAllowed( string $permission, ?PermissionStatus $status = null ): bool {
return $this->internalAllowed( $permission, $status, false, null );
}
@@ -166,7 +166,7 @@ class UserAuthority implements Authority {
public function probablyCan(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return $this->internalCan(
PermissionManager::RIGOR_QUICK,
@@ -181,7 +181,7 @@ class UserAuthority implements Authority {
public function definitelyCan(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
// Note that we do not use RIGOR_SECURE to avoid hitting the primary
// database for read operations. RIGOR_FULL performs the same checks,
@@ -196,7 +196,7 @@ class UserAuthority implements Authority {
}
/** @inheritDoc */
- public function isDefinitelyAllowed( string $action, PermissionStatus $status = null ): bool {
+ public function isDefinitelyAllowed( string $action, ?PermissionStatus $status = null ): bool {
$userBlock = $this->getApplicableBlock( PermissionManager::RIGOR_FULL, $action );
return $this->internalAllowed( $action, $status, 0, $userBlock );
}
@@ -204,7 +204,7 @@ class UserAuthority implements Authority {
/** @inheritDoc */
public function authorizeAction(
string $action,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
// Any side-effects can be added here.
@@ -222,7 +222,7 @@ class UserAuthority implements Authority {
public function authorizeRead(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
// Any side-effects can be added here.
@@ -242,7 +242,7 @@ class UserAuthority implements Authority {
public function authorizeWrite(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
// Any side-effects can be added here.
diff --git a/includes/ResourceLoader/FileModule.php b/includes/ResourceLoader/FileModule.php
index 2ac864514505..b9068edddcda 100644
--- a/includes/ResourceLoader/FileModule.php
+++ b/includes/ResourceLoader/FileModule.php
@@ -170,8 +170,8 @@ class FileModule extends Module {
*/
public function __construct(
array $options = [],
- string $localBasePath = null,
- string $remoteBasePath = null
+ ?string $localBasePath = null,
+ ?string $remoteBasePath = null
) {
// Flag to decide whether to automagically add the mediawiki.template module
$hasTemplates = false;
@@ -482,7 +482,7 @@ class FileModule extends Module {
* @param Context|null $context
* @return string[] List of module names
*/
- public function getDependencies( Context $context = null ) {
+ public function getDependencies( ?Context $context = null ) {
return $this->dependencies;
}
diff --git a/includes/ResourceLoader/ForeignApiModule.php b/includes/ResourceLoader/ForeignApiModule.php
index 6c663e87373a..591fa44d3931 100644
--- a/includes/ResourceLoader/ForeignApiModule.php
+++ b/includes/ResourceLoader/ForeignApiModule.php
@@ -28,7 +28,7 @@ namespace MediaWiki\ResourceLoader;
* @internal
*/
class ForeignApiModule extends FileModule {
- public function getDependencies( Context $context = null ) {
+ public function getDependencies( ?Context $context = null ) {
$dependencies = $this->dependencies;
$this->getHookRunner()->onResourceLoaderForeignApiModules( $dependencies, $context );
return $dependencies;
diff --git a/includes/ResourceLoader/ForeignResourceManager.php b/includes/ResourceLoader/ForeignResourceManager.php
index bb5e180e775f..692c3f683d6d 100644
--- a/includes/ResourceLoader/ForeignResourceManager.php
+++ b/includes/ResourceLoader/ForeignResourceManager.php
@@ -94,9 +94,9 @@ class ForeignResourceManager {
public function __construct(
$registryFile,
$libDir,
- callable $infoPrinter = null,
- callable $errorPrinter = null,
- callable $verbosePrinter = null
+ ?callable $infoPrinter = null,
+ ?callable $errorPrinter = null,
+ ?callable $verbosePrinter = null
) {
$this->globalIdGenerator = MediaWikiServices::getInstance()->getGlobalIdGenerator();
$this->registryFile = $registryFile;
diff --git a/includes/ResourceLoader/Module.php b/includes/ResourceLoader/Module.php
index 42aad185e693..5434488b9394 100644
--- a/includes/ResourceLoader/Module.php
+++ b/includes/ResourceLoader/Module.php
@@ -489,7 +489,7 @@ abstract class Module implements LoggerAwareInterface {
* @param Context|null $context
* @return string[] List of module names as strings
*/
- public function getDependencies( Context $context = null ) {
+ public function getDependencies( ?Context $context = null ) {
// Stub, override expected
return [];
}
diff --git a/includes/ResourceLoader/ResourceLoader.php b/includes/ResourceLoader/ResourceLoader.php
index bbaaef6ea939..5b4495e492c3 100644
--- a/includes/ResourceLoader/ResourceLoader.php
+++ b/includes/ResourceLoader/ResourceLoader.php
@@ -172,8 +172,8 @@ class ResourceLoader implements LoggerAwareInterface {
*/
public function __construct(
Config $config,
- LoggerInterface $logger = null,
- DependencyStore $tracker = null,
+ ?LoggerInterface $logger = null,
+ ?DependencyStore $tracker = null,
array $params = []
) {
$this->maxageVersioned = $params['maxageVersioned'] ?? 30 * 24 * 60 * 60;
@@ -268,7 +268,7 @@ class ResourceLoader implements LoggerAwareInterface {
* @throws InvalidArgumentException If a module name contains illegal characters (pipes or commas)
* @throws InvalidArgumentException If the module info is not an array
*/
- public function register( $name, array $info = null ) {
+ public function register( $name, ?array $info = null ) {
// Allow multiple modules to be registered in one call
$registrations = is_array( $name ) ? $name : [ $name => $info ];
foreach ( $registrations as $name => $info ) {
diff --git a/includes/ResourceLoader/SiteModule.php b/includes/ResourceLoader/SiteModule.php
index 4c0f4d59920c..5c9d7b60b822 100644
--- a/includes/ResourceLoader/SiteModule.php
+++ b/includes/ResourceLoader/SiteModule.php
@@ -52,7 +52,7 @@ class SiteModule extends WikiModule {
* @param Context|null $context
* @return array
*/
- public function getDependencies( Context $context = null ) {
+ public function getDependencies( ?Context $context = null ) {
return [ 'site.styles' ];
}
}
diff --git a/includes/ResourceLoader/SkinModule.php b/includes/ResourceLoader/SkinModule.php
index db17e07e7f03..0c5de4b48c73 100644
--- a/includes/ResourceLoader/SkinModule.php
+++ b/includes/ResourceLoader/SkinModule.php
@@ -664,7 +664,7 @@ class SkinModule extends LessVarFileModule {
* height fields defined in pixels, which are converted to ems based on 16px font-size.
* - icon (string): a square logo similar to 1x, but without the wordmark. SVG recommended.
*/
- public static function getAvailableLogos( Config $conf, string $lang = null ): array {
+ public static function getAvailableLogos( Config $conf, ?string $lang = null ): array {
$logos = $conf->get( MainConfigNames::Logos );
if ( $logos === false ) {
// no logos were defined... this will either
@@ -706,7 +706,7 @@ class SkinModule extends LessVarFileModule {
* Key "1x" is always defined. Key "svg" may also be defined,
* in which case variants other than "1x" are omitted.
*/
- protected function getLogoData( Config $conf, string $lang = null ) {
+ protected function getLogoData( Config $conf, ?string $lang = null ) {
$logoHD = self::getAvailableLogos( $conf, $lang );
$logo = $logoHD['1x'];
diff --git a/includes/ResourceLoader/WikiModule.php b/includes/ResourceLoader/WikiModule.php
index 74e12677a80f..ec5a25fc33a5 100644
--- a/includes/ResourceLoader/WikiModule.php
+++ b/includes/ResourceLoader/WikiModule.php
@@ -100,7 +100,7 @@ class WikiModule extends Module {
* @param array|null $options For back-compat, this can be omitted in favour of overwriting
* getPages.
*/
- public function __construct( array $options = null ) {
+ public function __construct( ?array $options = null ) {
if ( $options === null ) {
return;
}
diff --git a/includes/Rest/Handler/Helper/PageContentHelper.php b/includes/Rest/Handler/Helper/PageContentHelper.php
index e674deb62e6a..2e1ab8304fca 100644
--- a/includes/Rest/Handler/Helper/PageContentHelper.php
+++ b/includes/Rest/Handler/Helper/PageContentHelper.php
@@ -345,7 +345,7 @@ class PageContentHelper {
* @param ResponseInterface $response
* @param int|null $expiry
*/
- public function setCacheControl( ResponseInterface $response, int $expiry = null ) {
+ public function setCacheControl( ResponseInterface $response, ?int $expiry = null ) {
if ( $expiry === null ) {
$maxAge = self::MAX_AGE_200;
} else {
diff --git a/includes/Rest/Handler/Helper/RevisionContentHelper.php b/includes/Rest/Handler/Helper/RevisionContentHelper.php
index 415ae326c8f1..8dcd3497eba4 100644
--- a/includes/Rest/Handler/Helper/RevisionContentHelper.php
+++ b/includes/Rest/Handler/Helper/RevisionContentHelper.php
@@ -84,7 +84,7 @@ class RevisionContentHelper extends PageContentHelper {
return (bool)$this->getTargetRevision();
}
- public function setCacheControl( ResponseInterface $response, int $expiry = null ) {
+ public function setCacheControl( ResponseInterface $response, ?int $expiry = null ) {
$revision = $this->getTargetRevision();
if ( $revision && $revision->getVisibility() !== 0 ) {
diff --git a/includes/Rest/Handler/PageHistoryCountHandler.php b/includes/Rest/Handler/PageHistoryCountHandler.php
index 001e146fae6c..d732accbe9e8 100644
--- a/includes/Rest/Handler/PageHistoryCountHandler.php
+++ b/includes/Rest/Handler/PageHistoryCountHandler.php
@@ -446,7 +446,7 @@ class PageHistoryCountHandler extends SimpleHandler {
* @param RevisionRecord|null $fromRev
* @return int the count
*/
- protected function getAnonCount( $pageId, RevisionRecord $fromRev = null ) {
+ protected function getAnonCount( $pageId, ?RevisionRecord $fromRev = null ) {
$dbr = $this->dbProvider->getReplicaDatabase();
$queryBuilder = $dbr->newSelectQueryBuilder()
->select( '1' )
@@ -475,7 +475,7 @@ class PageHistoryCountHandler extends SimpleHandler {
* @param RevisionRecord|null $fromRev
* @return int the count
*/
- protected function getTempCount( $pageId, RevisionRecord $fromRev = null ) {
+ protected function getTempCount( $pageId, ?RevisionRecord $fromRev = null ) {
if ( !$this->tempUserConfig->isKnown() ) {
return 0;
}
@@ -516,7 +516,7 @@ class PageHistoryCountHandler extends SimpleHandler {
* @param RevisionRecord|null $fromRev
* @return int the count
*/
- protected function getBotCount( $pageId, RevisionRecord $fromRev = null ) {
+ protected function getBotCount( $pageId, ?RevisionRecord $fromRev = null ) {
$dbr = $this->dbProvider->getReplicaDatabase();
$queryBuilder = $dbr->newSelectQueryBuilder()
@@ -558,8 +558,8 @@ class PageHistoryCountHandler extends SimpleHandler {
* @return int the count
*/
protected function getEditorsCount( $pageId,
- RevisionRecord $fromRev = null,
- RevisionRecord $toRev = null
+ ?RevisionRecord $fromRev = null,
+ ?RevisionRecord $toRev = null
) {
[ $fromRev, $toRev ] = $this->orderRevisions( $fromRev, $toRev );
return $this->revisionStore->countAuthorsBetween( $pageId, $fromRev,
@@ -571,7 +571,7 @@ class PageHistoryCountHandler extends SimpleHandler {
* @param RevisionRecord|null $fromRev
* @return int the count
*/
- protected function getRevertedCount( $pageId, RevisionRecord $fromRev = null ) {
+ protected function getRevertedCount( $pageId, ?RevisionRecord $fromRev = null ) {
$tagIds = [];
foreach ( ChangeTags::REVERT_TAGS as $tagName ) {
@@ -613,7 +613,7 @@ class PageHistoryCountHandler extends SimpleHandler {
* @param RevisionRecord|null $fromRev
* @return int the count
*/
- protected function getMinorCount( $pageId, RevisionRecord $fromRev = null ) {
+ protected function getMinorCount( $pageId, ?RevisionRecord $fromRev = null ) {
$dbr = $this->dbProvider->getReplicaDatabase();
$queryBuilder = $dbr->newSelectQueryBuilder()
->select( '1' )
@@ -643,8 +643,8 @@ class PageHistoryCountHandler extends SimpleHandler {
*/
protected function getEditsCount(
$pageId,
- RevisionRecord $fromRev = null,
- RevisionRecord $toRev = null
+ ?RevisionRecord $fromRev = null,
+ ?RevisionRecord $toRev = null
) {
[ $fromRev, $toRev ] = $this->orderRevisions( $fromRev, $toRev );
return $this->revisionStore->countRevisionsBetween(
@@ -679,8 +679,8 @@ class PageHistoryCountHandler extends SimpleHandler {
* @phan-return array{0:RevisionRecord|null,1:RevisionRecord|null}
*/
private function orderRevisions(
- RevisionRecord $fromRev = null,
- RevisionRecord $toRev = null
+ ?RevisionRecord $fromRev = null,
+ ?RevisionRecord $toRev = null
) {
if ( $fromRev && $toRev && ( $fromRev->getTimestamp() > $toRev->getTimestamp() ||
( $fromRev->getTimestamp() === $toRev->getTimestamp()
diff --git a/includes/Revision/RenderedRevision.php b/includes/Revision/RenderedRevision.php
index 370aaa3db2bc..4de23746a788 100644
--- a/includes/Revision/RenderedRevision.php
+++ b/includes/Revision/RenderedRevision.php
@@ -112,7 +112,7 @@ class RenderedRevision implements SlotRenderingProvider {
ContentRenderer $contentRenderer,
callable $combineOutput,
$audience = RevisionRecord::FOR_PUBLIC,
- Authority $performer = null
+ ?Authority $performer = null
) {
$this->options = $options;
diff --git a/includes/Revision/RevisionAccessException.php b/includes/Revision/RevisionAccessException.php
index 76c8d1bc37f5..648291091431 100644
--- a/includes/Revision/RevisionAccessException.php
+++ b/includes/Revision/RevisionAccessException.php
@@ -49,7 +49,7 @@ class RevisionAccessException extends RuntimeException implements INormalizedExc
string $normalizedMessage = '',
array $messageContext = [],
int $code = 0,
- Throwable $previous = null
+ ?Throwable $previous = null
) {
$this->normalizedMessage = $normalizedMessage;
$this->messageContext = $messageContext;
diff --git a/includes/Revision/RevisionArchiveRecord.php b/includes/Revision/RevisionArchiveRecord.php
index 11489b48f718..6afba8a5f107 100644
--- a/includes/Revision/RevisionArchiveRecord.php
+++ b/includes/Revision/RevisionArchiveRecord.php
@@ -141,7 +141,7 @@ class RevisionArchiveRecord extends RevisionRecord {
*
* @return UserIdentity The identity of the revision author, null if access is forbidden.
*/
- public function getUser( $audience = self::FOR_PUBLIC, Authority $performer = null ) {
+ public function getUser( $audience = self::FOR_PUBLIC, ?Authority $performer = null ) {
// overwritten just to add a guarantee to the contract
return parent::getUser( $audience, $performer );
}
@@ -152,7 +152,7 @@ class RevisionArchiveRecord extends RevisionRecord {
*
* @return CommentStoreComment The revision comment, null if access is forbidden.
*/
- public function getComment( $audience = self::FOR_PUBLIC, Authority $performer = null ) {
+ public function getComment( $audience = self::FOR_PUBLIC, ?Authority $performer = null ) {
// overwritten just to add a guarantee to the contract
return parent::getComment( $audience, $performer );
}
@@ -190,7 +190,7 @@ class RevisionArchiveRecord extends RevisionRecord {
return parent::userCan( $field, $performer );
}
- public function audienceCan( $field, $audience, Authority $performer = null ) {
+ public function audienceCan( $field, $audience, ?Authority $performer = null ) {
// This revision belongs to a deleted page, so check the relevant permissions as well. (T345777)
// See userCan().
if (
diff --git a/includes/Revision/RevisionFactory.php b/includes/Revision/RevisionFactory.php
index 17843d5abd7b..4f424e3889fb 100644
--- a/includes/Revision/RevisionFactory.php
+++ b/includes/Revision/RevisionFactory.php
@@ -53,7 +53,7 @@ interface RevisionFactory {
public function newRevisionFromRow(
$row,
$queryFlags = IDBAccessObject::READ_NORMAL,
- PageIdentity $page = null
+ ?PageIdentity $page = null
);
/**
@@ -79,7 +79,7 @@ interface RevisionFactory {
public function newRevisionFromArchiveRow(
$row,
$queryFlags = IDBAccessObject::READ_NORMAL,
- PageIdentity $page = null,
+ ?PageIdentity $page = null,
array $overrides = []
);
diff --git a/includes/Revision/RevisionLookup.php b/includes/Revision/RevisionLookup.php
index 89a01fbda0a2..b749dddb7279 100644
--- a/includes/Revision/RevisionLookup.php
+++ b/includes/Revision/RevisionLookup.php
@@ -52,7 +52,7 @@ interface RevisionLookup {
*
* @return RevisionRecord|null
*/
- public function getRevisionById( $id, $flags = 0, PageIdentity $page = null );
+ public function getRevisionById( $id, $flags = 0, ?PageIdentity $page = null );
/**
* Load either the current, or a specified, revision
diff --git a/includes/Revision/RevisionRecord.php b/includes/Revision/RevisionRecord.php
index 12a5d873eeb6..839883ef985d 100644
--- a/includes/Revision/RevisionRecord.php
+++ b/includes/Revision/RevisionRecord.php
@@ -154,7 +154,7 @@ abstract class RevisionRecord implements WikiAwareEntity {
* @return Content|null The content of the given slot, or null on error
* @throws RevisionAccessException
*/
- public function getContent( $role, $audience = self::FOR_PUBLIC, Authority $performer = null ): ?Content {
+ public function getContent( $role, $audience = self::FOR_PUBLIC, ?Authority $performer = null ): ?Content {
try {
$content = $this->getSlot( $role, $audience, $performer )->getContent();
} catch ( BadRevisionException | SuppressedDataException $e ) {
@@ -175,7 +175,7 @@ abstract class RevisionRecord implements WikiAwareEntity {
* @throws BadRevisionException if the content is missing or corrupted
* @throws RevisionAccessException
*/
- public function getContentOrThrow( $role, $audience = self::FOR_PUBLIC, Authority $performer = null ): Content {
+ public function getContentOrThrow( $role, $audience = self::FOR_PUBLIC, ?Authority $performer = null ): Content {
if ( !$this->audienceCan( self::DELETED_TEXT, $audience, $performer ) ) {
throw new SuppressedDataException(
'Access to the content has been suppressed for this audience' );
@@ -197,7 +197,7 @@ abstract class RevisionRecord implements WikiAwareEntity {
* @return SlotRecord The slot meta-data. If access to the slot's content is forbidden,
* calling getContent() on the SlotRecord will throw an exception.
*/
- public function getSlot( $role, $audience = self::FOR_PUBLIC, Authority $performer = null ): SlotRecord {
+ public function getSlot( $role, $audience = self::FOR_PUBLIC, ?Authority $performer = null ): SlotRecord {
$slot = $this->mSlots->getSlot( $role );
if ( !$this->audienceCan( self::DELETED_TEXT, $audience, $performer ) ) {
@@ -406,7 +406,7 @@ abstract class RevisionRecord implements WikiAwareEntity {
* @param Authority|null $performer user on whose behalf to check
* @return UserIdentity|null
*/
- public function getUser( $audience = self::FOR_PUBLIC, Authority $performer = null ) {
+ public function getUser( $audience = self::FOR_PUBLIC, ?Authority $performer = null ) {
if ( !$this->audienceCan( self::DELETED_USER, $audience, $performer ) ) {
return null;
} else {
@@ -430,7 +430,7 @@ abstract class RevisionRecord implements WikiAwareEntity {
*
* @return CommentStoreComment|null
*/
- public function getComment( $audience = self::FOR_PUBLIC, Authority $performer = null ) {
+ public function getComment( $audience = self::FOR_PUBLIC, ?Authority $performer = null ) {
if ( !$this->audienceCan( self::DELETED_COMMENT, $audience, $performer ) ) {
return null;
} else {
@@ -496,7 +496,7 @@ abstract class RevisionRecord implements WikiAwareEntity {
*
* @return bool
*/
- public function audienceCan( $field, $audience, Authority $performer = null ) {
+ public function audienceCan( $field, $audience, ?Authority $performer = null ) {
if ( $audience == self::FOR_PUBLIC && $this->isDeleted( $field ) ) {
return false;
} elseif ( $audience == self::FOR_THIS_USER ) {
@@ -546,7 +546,7 @@ abstract class RevisionRecord implements WikiAwareEntity {
* instead of just plain user rights
* @return bool
*/
- public static function userCanBitfield( $bitfield, $field, Authority $performer, PageIdentity $page = null ) {
+ public static function userCanBitfield( $bitfield, $field, Authority $performer, ?PageIdentity $page = null ) {
if ( $bitfield & $field ) { // aspect is deleted
if ( $bitfield & self::DELETED_RESTRICTED ) {
$permissions = [ 'suppressrevision', 'viewsuppressed' ];
diff --git a/includes/Revision/RevisionRenderer.php b/includes/Revision/RevisionRenderer.php
index f85f3757d802..0b323cadd343 100644
--- a/includes/Revision/RevisionRenderer.php
+++ b/includes/Revision/RevisionRenderer.php
@@ -115,8 +115,8 @@ class RevisionRenderer {
// phpcs:enable Generic.Files.LineLength.TooLong
public function getRenderedRevision(
RevisionRecord $rev,
- ParserOptions $options = null,
- Authority $forPerformer = null,
+ ?ParserOptions $options = null,
+ ?Authority $forPerformer = null,
array $hints = []
) {
if ( $rev->getWikiId() !== $this->dbDomain ) {
diff --git a/includes/Revision/RevisionStore.php b/includes/Revision/RevisionStore.php
index 3a6ba4cffc99..4c2eb4d614f5 100644
--- a/includes/Revision/RevisionStore.php
+++ b/includes/Revision/RevisionStore.php
@@ -1262,7 +1262,7 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
*
* @return RevisionRecord|null
*/
- public function getRevisionById( $id, $flags = 0, PageIdentity $page = null ) {
+ public function getRevisionById( $id, $flags = 0, ?PageIdentity $page = null ) {
return $this->newRevisionFromConds( [ 'rev_id' => intval( $id ) ], $flags, $page );
}
@@ -1601,7 +1601,7 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
public function newRevisionFromArchiveRow(
$row,
$queryFlags = 0,
- PageIdentity $page = null,
+ ?PageIdentity $page = null,
array $overrides = []
) {
return $this->newRevisionFromArchiveRowAndSlots( $row, null, $queryFlags, $page, $overrides );
@@ -1622,7 +1622,7 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
public function newRevisionFromRow(
$row,
$queryFlags = 0,
- PageIdentity $page = null,
+ ?PageIdentity $page = null,
$fromCache = false
) {
return $this->newRevisionFromRowAndSlots( $row, null, $queryFlags, $page, $fromCache );
@@ -1936,7 +1936,7 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
$rows,
array $options = [],
$queryFlags = 0,
- PageIdentity $page = null
+ ?PageIdentity $page = null
) {
$result = new StatusValue();
$archiveMode = $options['archive'] ?? false;
@@ -2318,7 +2318,7 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
private function newRevisionFromConds(
array $conditions,
int $flags = IDBAccessObject::READ_NORMAL,
- PageIdentity $page = null,
+ ?PageIdentity $page = null,
array $options = []
) {
$db = $this->getDBConnectionRefForQueryFlags( $flags );
@@ -2357,7 +2357,7 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
IReadableDatabase $db,
array $conditions,
int $flags = IDBAccessObject::READ_NORMAL,
- PageIdentity $page = null,
+ ?PageIdentity $page = null,
array $options = []
) {
$row = $this->fetchRevisionRowFromConds( $db, $conditions, $flags, $options );
@@ -3076,7 +3076,7 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
* @param int $pageId
* @param RevisionRecord|null $rev
*/
- private function assertRevisionParameter( $paramName, $pageId, RevisionRecord $rev = null ) {
+ private function assertRevisionParameter( $paramName, $pageId, ?RevisionRecord $rev = null ) {
if ( $rev ) {
if ( $rev->getId( $this->wikiId ) === null ) {
throw new InvalidArgumentException( "Unsaved {$paramName} revision passed" );
@@ -3105,8 +3105,8 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
*/
private function getRevisionLimitConditions(
ISQLPlatform $dbr,
- RevisionRecord $old = null,
- RevisionRecord $new = null,
+ ?RevisionRecord $old = null,
+ ?RevisionRecord $new = null,
$options = []
) {
$options = (array)$options;
@@ -3165,8 +3165,8 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
*/
public function getRevisionIdsBetween(
int $pageId,
- RevisionRecord $old = null,
- RevisionRecord $new = null,
+ ?RevisionRecord $old = null,
+ ?RevisionRecord $new = null,
?int $max = null,
$options = [],
?string $order = null,
@@ -3234,9 +3234,9 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
*/
public function getAuthorsBetween(
$pageId,
- RevisionRecord $old = null,
- RevisionRecord $new = null,
- Authority $performer = null,
+ ?RevisionRecord $old = null,
+ ?RevisionRecord $new = null,
+ ?Authority $performer = null,
$max = null,
$options = []
) {
@@ -3313,9 +3313,9 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
*/
public function countAuthorsBetween(
$pageId,
- RevisionRecord $old = null,
- RevisionRecord $new = null,
- Authority $performer = null,
+ ?RevisionRecord $old = null,
+ ?RevisionRecord $new = null,
+ ?Authority $performer = null,
$max = null,
$options = []
) {
@@ -3346,8 +3346,8 @@ class RevisionStore implements RevisionFactory, RevisionLookup, LoggerAwareInter
*/
public function countRevisionsBetween(
$pageId,
- RevisionRecord $old = null,
- RevisionRecord $new = null,
+ ?RevisionRecord $old = null,
+ ?RevisionRecord $new = null,
$max = null,
$options = []
) {
diff --git a/includes/Revision/RevisionStoreCacheRecord.php b/includes/Revision/RevisionStoreCacheRecord.php
index e0bb2456ad06..329d8b5a3640 100644
--- a/includes/Revision/RevisionStoreCacheRecord.php
+++ b/includes/Revision/RevisionStoreCacheRecord.php
@@ -88,7 +88,7 @@ class RevisionStoreCacheRecord extends RevisionStoreRecord {
*
* @return UserIdentity The identity of the revision author, null if access is forbidden.
*/
- public function getUser( $audience = self::FOR_PUBLIC, Authority $performer = null ) {
+ public function getUser( $audience = self::FOR_PUBLIC, ?Authority $performer = null ) {
if ( $this->mCallback ) {
$this->loadFreshRow();
}
diff --git a/includes/Revision/RevisionStoreRecord.php b/includes/Revision/RevisionStoreRecord.php
index 426e16550dca..21aabb632f68 100644
--- a/includes/Revision/RevisionStoreRecord.php
+++ b/includes/Revision/RevisionStoreRecord.php
@@ -175,7 +175,7 @@ class RevisionStoreRecord extends RevisionRecord {
*
* @return UserIdentity The identity of the revision author, null if access is forbidden.
*/
- public function getUser( $audience = self::FOR_PUBLIC, Authority $performer = null ) {
+ public function getUser( $audience = self::FOR_PUBLIC, ?Authority $performer = null ) {
// overwritten just to add a guarantee to the contract
return parent::getUser( $audience, $performer );
}
@@ -186,7 +186,7 @@ class RevisionStoreRecord extends RevisionRecord {
*
* @return CommentStoreComment The revision comment, null if access is forbidden.
*/
- public function getComment( $audience = self::FOR_PUBLIC, Authority $performer = null ) {
+ public function getComment( $audience = self::FOR_PUBLIC, ?Authority $performer = null ) {
// overwritten just to add a guarantee to the contract
return parent::getComment( $audience, $performer );
}
diff --git a/includes/Settings/Config/ConfigBuilder.php b/includes/Settings/Config/ConfigBuilder.php
index c920cf3dadf2..02f26de84080 100644
--- a/includes/Settings/Config/ConfigBuilder.php
+++ b/includes/Settings/Config/ConfigBuilder.php
@@ -20,7 +20,7 @@ interface ConfigBuilder {
* @param MergeStrategy|null $mergeStrategy strategy for merging array config values.
* @return ConfigBuilder
*/
- public function set( string $key, $value, MergeStrategy $mergeStrategy = null ): ConfigBuilder;
+ public function set( string $key, $value, ?MergeStrategy $mergeStrategy = null ): ConfigBuilder;
/**
* Set all values in the array.
@@ -43,7 +43,7 @@ interface ConfigBuilder {
* @param MergeStrategy|null $mergeStrategy strategy for merging array config values.
* @return ConfigBuilder
*/
- public function setDefault( string $key, $defaultValue, MergeStrategy $mergeStrategy = null ): ConfigBuilder;
+ public function setDefault( string $key, $defaultValue, ?MergeStrategy $mergeStrategy = null ): ConfigBuilder;
/**
* Set defaults in a batch.
diff --git a/includes/Settings/Config/ConfigBuilderBase.php b/includes/Settings/Config/ConfigBuilderBase.php
index f91870cc580e..af134edec77c 100644
--- a/includes/Settings/Config/ConfigBuilderBase.php
+++ b/includes/Settings/Config/ConfigBuilderBase.php
@@ -14,7 +14,7 @@ abstract class ConfigBuilderBase implements ConfigBuilder {
public function set(
string $key,
$newValue,
- MergeStrategy $mergeStrategy = null
+ ?MergeStrategy $mergeStrategy = null
): ConfigBuilder {
if ( $mergeStrategy && $this->has( $key ) && is_array( $newValue ) ) {
$oldValue = $this->get( $key );
@@ -42,7 +42,7 @@ abstract class ConfigBuilderBase implements ConfigBuilder {
public function setDefault(
string $key,
$defaultValue,
- MergeStrategy $mergeStrategy = null
+ ?MergeStrategy $mergeStrategy = null
): ConfigBuilder {
if ( $this->has( $key ) ) {
if ( $mergeStrategy && $defaultValue && is_array( $defaultValue ) ) {
diff --git a/includes/Settings/SettingsBuilder.php b/includes/Settings/SettingsBuilder.php
index f36b86d503eb..39211cd32bc2 100644
--- a/includes/Settings/SettingsBuilder.php
+++ b/includes/Settings/SettingsBuilder.php
@@ -202,7 +202,7 @@ class SettingsBuilder {
ExtensionRegistry $extensionRegistry,
ConfigBuilder $configSink,
PhpIniSink $phpIniSink,
- BagOStuff $cache = null
+ ?BagOStuff $cache = null
) {
$this->baseDir = $baseDir;
$this->extensionRegistry = $extensionRegistry;
diff --git a/includes/Settings/SettingsBuilderException.php b/includes/Settings/SettingsBuilderException.php
index 3eb15121d81c..9fb5773fcbd6 100644
--- a/includes/Settings/SettingsBuilderException.php
+++ b/includes/Settings/SettingsBuilderException.php
@@ -20,7 +20,7 @@ class SettingsBuilderException extends RuntimeException implements INormalizedEx
string $normalizedMessage = '',
array $messageContext = [],
int $code = 0,
- Throwable $previous = null
+ ?Throwable $previous = null
) {
$this->normalizedMessage = $normalizedMessage;
$this->messageContext = $messageContext;
diff --git a/includes/Settings/Source/FileSource.php b/includes/Settings/Source/FileSource.php
index 3c81da144985..3c6bb81ca9fb 100644
--- a/includes/Settings/Source/FileSource.php
+++ b/includes/Settings/Source/FileSource.php
@@ -85,7 +85,7 @@ class FileSource implements Stringable, CacheableSource, SettingsIncludeLocator
* @param string $path
* @param SettingsFormat|null $format
*/
- public function __construct( string $path, SettingsFormat $format = null ) {
+ public function __construct( string $path, ?SettingsFormat $format = null ) {
$this->path = $path;
$this->format = $format;
}
diff --git a/includes/Storage/DerivedPageDataUpdater.php b/includes/Storage/DerivedPageDataUpdater.php
index 06d120ccf3cb..5185d3cd4dac 100644
--- a/includes/Storage/DerivedPageDataUpdater.php
+++ b/includes/Storage/DerivedPageDataUpdater.php
@@ -464,9 +464,9 @@ class DerivedPageDataUpdater implements LoggerAwareInterface, PreparedUpdate {
* @return bool
*/
public function isReusableFor(
- UserIdentity $user = null,
- RevisionRecord $revision = null,
- RevisionSlotsUpdate $slotsUpdate = null,
+ ?UserIdentity $user = null,
+ ?RevisionRecord $revision = null,
+ ?RevisionSlotsUpdate $slotsUpdate = null,
$parentId = null
) {
if ( $revision
diff --git a/includes/Storage/EditResultBuilder.php b/includes/Storage/EditResultBuilder.php
index 83191ae4a372..0237ca7c623e 100644
--- a/includes/Storage/EditResultBuilder.php
+++ b/includes/Storage/EditResultBuilder.php
@@ -160,7 +160,7 @@ class EditResultBuilder {
public function markAsRevert(
int $revertMethod,
int $newestRevertedRevId,
- int $revertAfterRevId = null
+ ?int $revertAfterRevId = null
) {
Assert::parameter(
in_array(
diff --git a/includes/Storage/NameTableStore.php b/includes/Storage/NameTableStore.php
index a6a8bd97a783..aa5ff54ee7a0 100644
--- a/includes/Storage/NameTableStore.php
+++ b/includes/Storage/NameTableStore.php
@@ -89,9 +89,9 @@ class NameTableStore {
$table,
$idField,
$nameField,
- callable $normalizationCallback = null,
+ ?callable $normalizationCallback = null,
$dbDomain = false,
- callable $insertCallback = null
+ ?callable $insertCallback = null
) {
$this->loadBalancer = $dbLoadBalancer;
$this->cache = $cache;
diff --git a/includes/Storage/PageUpdater.php b/includes/Storage/PageUpdater.php
index adf35bba3216..bfc487201c6e 100644
--- a/includes/Storage/PageUpdater.php
+++ b/includes/Storage/PageUpdater.php
@@ -636,7 +636,7 @@ class PageUpdater {
public function markAsRevert(
int $revertMethod,
int $newestRevertedRevId,
- int $revertAfterRevId = null
+ ?int $revertAfterRevId = null
) {
$this->editResultBuilder->markAsRevert(
$revertMethod, $newestRevertedRevId, $revertAfterRevId
diff --git a/includes/Storage/RevisionSlotsUpdate.php b/includes/Storage/RevisionSlotsUpdate.php
index 25185b7baaf4..76f8f1d38eab 100644
--- a/includes/Storage/RevisionSlotsUpdate.php
+++ b/includes/Storage/RevisionSlotsUpdate.php
@@ -55,7 +55,7 @@ class RevisionSlotsUpdate {
*/
public static function newFromRevisionSlots(
RevisionSlots $newSlots,
- RevisionSlots $parentSlots = null
+ ?RevisionSlots $parentSlots = null
) {
$modified = $newSlots->getSlots();
$removed = [];
@@ -88,7 +88,7 @@ class RevisionSlotsUpdate {
*
* @return RevisionSlotsUpdate
*/
- public static function newFromContent( array $newContent, RevisionSlots $parentSlots = null ) {
+ public static function newFromContent( array $newContent, ?RevisionSlots $parentSlots = null ) {
$modified = [];
foreach ( $newContent as $role => $content ) {
diff --git a/includes/actions/Action.php b/includes/actions/Action.php
index 94a9774649df..bc5d64c16fdc 100644
--- a/includes/actions/Action.php
+++ b/includes/actions/Action.php
@@ -89,7 +89,7 @@ abstract class Action implements MessageLocalizer {
final public static function factory(
string $action,
Article $article,
- IContextSource $context = null
+ ?IContextSource $context = null
) {
return MediaWikiServices::getInstance()
->getActionFactory()
diff --git a/includes/actions/pagers/HistoryPager.php b/includes/actions/pagers/HistoryPager.php
index 644598413bea..02614920100b 100644
--- a/includes/actions/pagers/HistoryPager.php
+++ b/includes/actions/pagers/HistoryPager.php
@@ -123,11 +123,11 @@ class HistoryPager extends ReverseChronologicalPager {
$tagFilter = '',
$tagInvert = false,
array $conds = [],
- LinkBatchFactory $linkBatchFactory = null,
- WatchlistManager $watchlistManager = null,
- CommentFormatter $commentFormatter = null,
- HookContainer $hookContainer = null,
- ChangeTagsStore $changeTagsStore = null
+ ?LinkBatchFactory $linkBatchFactory = null,
+ ?WatchlistManager $watchlistManager = null,
+ ?CommentFormatter $commentFormatter = null,
+ ?HookContainer $hookContainer = null,
+ ?ChangeTagsStore $changeTagsStore = null
) {
parent::__construct( $historyPage->getContext() );
$this->historyPage = $historyPage;
diff --git a/includes/api/ApiAuthManagerHelper.php b/includes/api/ApiAuthManagerHelper.php
index af13d7d64cf2..c06ac2e30b52 100644
--- a/includes/api/ApiAuthManagerHelper.php
+++ b/includes/api/ApiAuthManagerHelper.php
@@ -54,7 +54,7 @@ class ApiAuthManagerHelper {
* @param ApiBase $module API module, for context and parameters
* @param AuthManager|null $authManager
*/
- public function __construct( ApiBase $module, AuthManager $authManager = null ) {
+ public function __construct( ApiBase $module, ?AuthManager $authManager = null ) {
$this->module = $module;
$params = $module->extractRequestParams();
@@ -68,7 +68,7 @@ class ApiAuthManagerHelper {
* @param AuthManager|null $authManager
* @return ApiAuthManagerHelper
*/
- public static function newForModule( ApiBase $module, AuthManager $authManager = null ) {
+ public static function newForModule( ApiBase $module, ?AuthManager $authManager = null ) {
return new self( $module, $authManager );
}
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index 1497d1699526..2e3a43353dcd 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -754,7 +754,7 @@ abstract class ApiBase extends ContextSource {
/**
* @param ApiContinuationManager|null $manager
*/
- public function setContinuationManager( ApiContinuationManager $manager = null ) {
+ public function setContinuationManager( ?ApiContinuationManager $manager = null ) {
// The Main module has this method overridden, avoid infinite loops
$this->dieIfMain( __METHOD__ );
@@ -1323,7 +1323,7 @@ abstract class ApiBase extends ContextSource {
* @param array|null $params
* @return Message|null
*/
- public static function makeMessage( $msg, IContextSource $context, array $params = null ) {
+ public static function makeMessage( $msg, IContextSource $context, ?array $params = null ) {
wfDeprecated( __METHOD__, '1.43' );
if ( is_string( $msg ) ) {
$msg = wfMessage( $msg );
@@ -1356,7 +1356,7 @@ abstract class ApiBase extends ContextSource {
* @param Authority|null $performer
* @return Status
*/
- public function errorArrayToStatus( array $errors, Authority $performer = null ) {
+ public function errorArrayToStatus( array $errors, ?Authority $performer = null ) {
wfDeprecated( __METHOD__, '1.43' );
$performer ??= $this->getAuthority();
@@ -1395,7 +1395,7 @@ abstract class ApiBase extends ContextSource {
* @param StatusValue $status
* @param Authority|null $user
*/
- public function addBlockInfoToStatus( StatusValue $status, Authority $user = null ) {
+ public function addBlockInfoToStatus( StatusValue $status, ?Authority $user = null ) {
if ( $status instanceof PermissionStatus ) {
$block = $status->getBlock();
} else {
diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php
index 87686c1f3efa..73c70bde309d 100644
--- a/includes/api/ApiEditPage.php
+++ b/includes/api/ApiEditPage.php
@@ -100,15 +100,15 @@ class ApiEditPage extends ApiBase {
public function __construct(
ApiMain $mainModule,
$moduleName,
- IContentHandlerFactory $contentHandlerFactory = null,
- RevisionLookup $revisionLookup = null,
- WatchedItemStoreInterface $watchedItemStore = null,
- WikiPageFactory $wikiPageFactory = null,
- WatchlistManager $watchlistManager = null,
- UserOptionsLookup $userOptionsLookup = null,
- RedirectLookup $redirectLookup = null,
- TempUserCreator $tempUserCreator = null,
- UserFactory $userFactory = null
+ ?IContentHandlerFactory $contentHandlerFactory = null,
+ ?RevisionLookup $revisionLookup = null,
+ ?WatchedItemStoreInterface $watchedItemStore = null,
+ ?WikiPageFactory $wikiPageFactory = null,
+ ?WatchlistManager $watchlistManager = null,
+ ?UserOptionsLookup $userOptionsLookup = null,
+ ?RedirectLookup $redirectLookup = null,
+ ?TempUserCreator $tempUserCreator = null,
+ ?UserFactory $userFactory = null
) {
parent::__construct( $mainModule, $moduleName );
diff --git a/includes/api/ApiFormatRaw.php b/includes/api/ApiFormatRaw.php
index 8bc817a409a0..b3e1f291c4e4 100644
--- a/includes/api/ApiFormatRaw.php
+++ b/includes/api/ApiFormatRaw.php
@@ -37,7 +37,7 @@ class ApiFormatRaw extends ApiFormatBase {
* @param ApiMain $main
* @param ApiFormatBase|null $errorFallback Object to fall back on for errors
*/
- public function __construct( ApiMain $main, ApiFormatBase $errorFallback = null ) {
+ public function __construct( ApiMain $main, ?ApiFormatBase $errorFallback = null ) {
parent::__construct( $main, 'raw' );
$this->errorFallback = $errorFallback ?:
$main->createPrinterByName( $main->getParameter( 'format' ) );
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index 6e40b77ed2f0..7ea691074831 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -762,7 +762,7 @@ class ApiMain extends ApiBase {
/**
* @param ApiContinuationManager|null $manager
*/
- public function setContinuationManager( ApiContinuationManager $manager = null ) {
+ public function setContinuationManager( ?ApiContinuationManager $manager = null ) {
if ( $manager !== null && $this->mContinuationManager !== null ) {
throw new UnexpectedValueException(
__METHOD__ . ': tried to set manager from ' . $manager->getSource() .
@@ -1999,7 +1999,7 @@ class ApiMain extends ApiBase {
* @param float $time Time in seconds
* @param Throwable|null $e Throwable caught while processing the request
*/
- protected function logRequest( $time, Throwable $e = null ) {
+ protected function logRequest( $time, ?Throwable $e = null ) {
$request = $this->getRequest();
$user = $this->getUser();
diff --git a/includes/api/ApiMessage.php b/includes/api/ApiMessage.php
index 51fce506fe88..759389a8746b 100644
--- a/includes/api/ApiMessage.php
+++ b/includes/api/ApiMessage.php
@@ -46,7 +46,7 @@ class ApiMessage extends Message implements IApiMessage {
* @return IApiMessage
* @param-taint $msg tainted
*/
- public static function create( $msg, $code = null, array $data = null ) {
+ public static function create( $msg, $code = null, ?array $data = null ) {
if ( is_array( $msg ) ) {
// From StatusValue
if ( isset( $msg['message'] ) ) {
@@ -76,7 +76,7 @@ class ApiMessage extends Message implements IApiMessage {
* @param string|null $code
* @param array|null $data
*/
- public function __construct( $msg, $code = null, array $data = null ) {
+ public function __construct( $msg, $code = null, ?array $data = null ) {
if ( $msg instanceof Message ) {
foreach ( get_class_vars( get_class( $this ) ) as $key => $value ) {
if ( isset( $msg->$key ) ) {
diff --git a/includes/api/ApiMessageTrait.php b/includes/api/ApiMessageTrait.php
index 4f02aa8f4b14..3cc2a6720dc5 100644
--- a/includes/api/ApiMessageTrait.php
+++ b/includes/api/ApiMessageTrait.php
@@ -125,7 +125,7 @@ trait ApiMessageTrait {
return $this->apiCode;
}
- public function setApiCode( $code, array $data = null ) {
+ public function setApiCode( $code, ?array $data = null ) {
if ( $code !== null && !ApiErrorFormatter::isValidApiCode( $code ) ) {
throw new InvalidArgumentException( "Invalid code \"$code\"" );
}
diff --git a/includes/api/ApiModuleManager.php b/includes/api/ApiModuleManager.php
index 2e23b72f475a..89082ef48035 100644
--- a/includes/api/ApiModuleManager.php
+++ b/includes/api/ApiModuleManager.php
@@ -64,7 +64,7 @@ class ApiModuleManager extends ContextSource {
* @param ApiBase $parentModule Parent module instance will be used during instantiation
* @param ObjectFactory|null $objectFactory Object factory to use when instantiating modules
*/
- public function __construct( ApiBase $parentModule, ObjectFactory $objectFactory = null ) {
+ public function __construct( ApiBase $parentModule, ?ObjectFactory $objectFactory = null ) {
$this->mParent = $parentModule;
$this->objectFactory = $objectFactory ?? MediaWikiServices::getInstance()->getObjectFactory();
}
diff --git a/includes/api/ApiOptions.php b/includes/api/ApiOptions.php
index b57fff10edf2..5af193074328 100644
--- a/includes/api/ApiOptions.php
+++ b/includes/api/ApiOptions.php
@@ -43,8 +43,8 @@ class ApiOptions extends ApiOptionsBase {
public function __construct(
ApiMain $main,
$action,
- UserOptionsManager $userOptionsManager = null,
- PreferencesFactory $preferencesFactory = null
+ ?UserOptionsManager $userOptionsManager = null,
+ ?PreferencesFactory $preferencesFactory = null
) {
/**
* This class is extended by GlobalPreferences extension.
diff --git a/includes/api/ApiQueryAllDeletedRevisions.php b/includes/api/ApiQueryAllDeletedRevisions.php
index 9845a8679cf9..e1cfb3a0926b 100644
--- a/includes/api/ApiQueryAllDeletedRevisions.php
+++ b/includes/api/ApiQueryAllDeletedRevisions.php
@@ -110,7 +110,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
* @param ApiPageSet|null $resultPageSet
* @return void
*/
- protected function run( ApiPageSet $resultPageSet = null ) {
+ protected function run( ?ApiPageSet $resultPageSet = null ) {
$db = $this->getDB();
$params = $this->extractRequestParams( false );
diff --git a/includes/api/ApiQueryAllRevisions.php b/includes/api/ApiQueryAllRevisions.php
index ceb687aa330c..f7ce23a453fb 100644
--- a/includes/api/ApiQueryAllRevisions.php
+++ b/includes/api/ApiQueryAllRevisions.php
@@ -105,7 +105,7 @@ class ApiQueryAllRevisions extends ApiQueryRevisionsBase {
* @param ApiPageSet|null $resultPageSet
* @return void
*/
- protected function run( ApiPageSet $resultPageSet = null ) {
+ protected function run( ?ApiPageSet $resultPageSet = null ) {
$db = $this->getDB();
$params = $this->extractRequestParams( false );
diff --git a/includes/api/ApiQueryBacklinksprop.php b/includes/api/ApiQueryBacklinksprop.php
index 07a0cfd5b66d..0c634fd4827a 100644
--- a/includes/api/ApiQueryBacklinksprop.php
+++ b/includes/api/ApiQueryBacklinksprop.php
@@ -109,7 +109,7 @@ class ApiQueryBacklinksprop extends ApiQueryGeneratorBase {
/**
* @param ApiPageSet|null $resultPageSet
*/
- private function run( ApiPageSet $resultPageSet = null ) {
+ private function run( ?ApiPageSet $resultPageSet = null ) {
$settings = self::$settings[$this->getModuleName()];
$db = $this->getDB();
diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php
index 45066feaa972..9585649d924b 100644
--- a/includes/api/ApiQueryBase.php
+++ b/includes/api/ApiQueryBase.php
@@ -388,7 +388,7 @@ abstract class ApiQueryBase extends ApiBase {
* ApiQueryBaseProcessRow hook will be expected.
* @return IResultWrapper
*/
- protected function select( $method, $extraQuery = [], array &$hookData = null ) {
+ protected function select( $method, $extraQuery = [], ?array &$hookData = null ) {
$queryBuilder = clone $this->getQueryBuilder();
if ( isset( $extraQuery['tables'] ) ) {
$queryBuilder->rawTables( (array)$extraQuery['tables'] );
diff --git a/includes/api/ApiQueryDeletedRevisions.php b/includes/api/ApiQueryDeletedRevisions.php
index 58aec52654ee..c8d7041be879 100644
--- a/includes/api/ApiQueryDeletedRevisions.php
+++ b/includes/api/ApiQueryDeletedRevisions.php
@@ -103,7 +103,7 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
$this->linkBatchFactory = $linkBatchFactory;
}
- protected function run( ApiPageSet $resultPageSet = null ) {
+ protected function run( ?ApiPageSet $resultPageSet = null ) {
$pageSet = $this->getPageSet();
$pageMap = $pageSet->getGoodAndMissingTitlesByNamespace();
$pageCount = count( $pageSet->getGoodAndMissingPages() );
diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php
index 1a00e25c6c6b..cf607e244f3d 100644
--- a/includes/api/ApiQueryRevisions.php
+++ b/includes/api/ApiQueryRevisions.php
@@ -110,7 +110,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
$this->titleFormatter = $titleFormatter;
}
- protected function run( ApiPageSet $resultPageSet = null ) {
+ protected function run( ?ApiPageSet $resultPageSet = null ) {
$params = $this->extractRequestParams( false );
// If any of those parameters are used, work in 'enumeration' mode.
diff --git a/includes/api/ApiQueryRevisionsBase.php b/includes/api/ApiQueryRevisionsBase.php
index b53c6c7f7b47..d582c2d759ec 100644
--- a/includes/api/ApiQueryRevisionsBase.php
+++ b/includes/api/ApiQueryRevisionsBase.php
@@ -152,16 +152,16 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
ApiQuery $queryModule,
$moduleName,
$paramPrefix = '',
- RevisionStore $revisionStore = null,
- IContentHandlerFactory $contentHandlerFactory = null,
- ParserFactory $parserFactory = null,
- SlotRoleRegistry $slotRoleRegistry = null,
- ContentRenderer $contentRenderer = null,
- ContentTransformer $contentTransformer = null,
- CommentFormatter $commentFormatter = null,
- TempUserCreator $tempUserCreator = null,
- UserFactory $userFactory = null,
- UserNameUtils $userNameUtils = null
+ ?RevisionStore $revisionStore = null,
+ ?IContentHandlerFactory $contentHandlerFactory = null,
+ ?ParserFactory $parserFactory = null,
+ ?SlotRoleRegistry $slotRoleRegistry = null,
+ ?ContentRenderer $contentRenderer = null,
+ ?ContentTransformer $contentTransformer = null,
+ ?CommentFormatter $commentFormatter = null,
+ ?TempUserCreator $tempUserCreator = null,
+ ?UserFactory $userFactory = null,
+ ?UserNameUtils $userNameUtils = null
) {
parent::__construct( $queryModule, $moduleName, $paramPrefix );
// This class is part of the stable interface and
@@ -191,7 +191,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
* @param ApiPageSet|null $resultPageSet
* @return void
*/
- abstract protected function run( ApiPageSet $resultPageSet = null );
+ abstract protected function run( ?ApiPageSet $resultPageSet = null );
/**
* Parse the parameters into the various instance fields.
diff --git a/includes/api/ApiRawMessage.php b/includes/api/ApiRawMessage.php
index 2b114472bc1b..0e3cabd07a29 100644
--- a/includes/api/ApiRawMessage.php
+++ b/includes/api/ApiRawMessage.php
@@ -40,7 +40,7 @@ class ApiRawMessage extends RawMessage implements IApiMessage {
* @param string|null $code
* @param array|null $data
*/
- public function __construct( $msg, $code = null, array $data = null ) {
+ public function __construct( $msg, $code = null, ?array $data = null ) {
if ( $msg instanceof RawMessage ) {
foreach ( get_class_vars( get_class( $this ) ) as $key => $value ) {
if ( isset( $msg->$key ) ) {
diff --git a/includes/api/ApiUsageException.php b/includes/api/ApiUsageException.php
index 0f188145d333..8393445b375d 100644
--- a/includes/api/ApiUsageException.php
+++ b/includes/api/ApiUsageException.php
@@ -53,7 +53,7 @@ class ApiUsageException extends MWException implements Stringable, ILocalizedExc
* @param Throwable|null $previous Previous exception
*/
public function __construct(
- ?ApiBase $module, StatusValue $status, $httpCode = 0, Throwable $previous = null
+ ?ApiBase $module, StatusValue $status, $httpCode = 0, ?Throwable $previous = null
) {
if ( $status->isOK() ) {
throw new InvalidArgumentException( __METHOD__ . ' requires a fatal Status' );
@@ -79,7 +79,7 @@ class ApiUsageException extends MWException implements Stringable, ILocalizedExc
* @return static
*/
public static function newWithMessage(
- ?ApiBase $module, $msg, $code = null, $data = null, $httpCode = 0, Throwable $previous = null
+ ?ApiBase $module, $msg, $code = null, $data = null, $httpCode = 0, ?Throwable $previous = null
) {
return new static(
$module,
diff --git a/includes/api/IApiMessage.php b/includes/api/IApiMessage.php
index 8c17044f4443..0a9da276bfc3 100644
--- a/includes/api/IApiMessage.php
+++ b/includes/api/IApiMessage.php
@@ -63,7 +63,7 @@ interface IApiMessage extends MessageSpecifier {
* @param string|null $code If null, uses the default (see self::getApiCode())
* @param array|null $data If non-null, passed to self::setApiData()
*/
- public function setApiCode( $code, array $data = null );
+ public function setApiCode( $code, ?array $data = null );
/**
* Sets additional machine-readable data about the error condition
diff --git a/includes/api/SearchApi.php b/includes/api/SearchApi.php
index 05e2a4370e49..1a20c961ab09 100644
--- a/includes/api/SearchApi.php
+++ b/includes/api/SearchApi.php
@@ -179,7 +179,7 @@ trait SearchApi {
* ApiBase::extractRequestParams() before)
* @return SearchEngine
*/
- public function buildSearchEngine( array $params = null ) {
+ public function buildSearchEngine( ?array $params = null ) {
$this->checkDependenciesSet();
if ( $params == null ) {
diff --git a/includes/auth/AuthManager.php b/includes/auth/AuthManager.php
index 79653940350d..a6f37fb69548 100644
--- a/includes/auth/AuthManager.php
+++ b/includes/auth/AuthManager.php
@@ -2415,7 +2415,7 @@ class AuthManager implements LoggerAwareInterface {
* @param UserIdentity|null $user User being acted on, instead of the current user.
* @return AuthenticationRequest[]
*/
- public function getAuthenticationRequests( $action, UserIdentity $user = null ) {
+ public function getAuthenticationRequests( $action, ?UserIdentity $user = null ) {
$options = [];
$providerAction = $action;
@@ -2486,7 +2486,7 @@ class AuthManager implements LoggerAwareInterface {
* @return AuthenticationRequest[]
*/
private function getAuthenticationRequestsInternal(
- $providerAction, array $options, array $providers, UserIdentity $user = null
+ $providerAction, array $options, array $providers, ?UserIdentity $user = null
) {
$user = $user ?: RequestContext::getMain()->getUser();
$options['username'] = $user->isRegistered() ? $user->getName() : null;
diff --git a/includes/auth/CreateFromLoginAuthenticationRequest.php b/includes/auth/CreateFromLoginAuthenticationRequest.php
index 59762ddf1e88..39d13712b415 100644
--- a/includes/auth/CreateFromLoginAuthenticationRequest.php
+++ b/includes/auth/CreateFromLoginAuthenticationRequest.php
@@ -50,7 +50,7 @@ class CreateFromLoginAuthenticationRequest extends AuthenticationRequest {
* after creation.
*/
public function __construct(
- AuthenticationRequest $createRequest = null, array $maybeLink = []
+ ?AuthenticationRequest $createRequest = null, array $maybeLink = []
) {
$this->createRequest = $createRequest;
$this->maybeLink = $maybeLink;
diff --git a/includes/auth/Throttler.php b/includes/auth/Throttler.php
index 21a382cfbce2..c7e97b835bae 100644
--- a/includes/auth/Throttler.php
+++ b/includes/auth/Throttler.php
@@ -62,7 +62,7 @@ class Throttler implements LoggerAwareInterface {
* - warningLimit: the log level will be raised to warning when rejecting an attempt after
* no less than this many failures.
*/
- public function __construct( array $conditions = null, array $params = [] ) {
+ public function __construct( ?array $conditions = null, array $params = [] ) {
$invalidParams = array_diff_key( $params,
array_fill_keys( [ 'type', 'cache', 'warningLimit' ], true ) );
if ( $invalidParams ) {
diff --git a/includes/block/AbstractBlock.php b/includes/block/AbstractBlock.php
index ed204602440e..44ca5884f161 100644
--- a/includes/block/AbstractBlock.php
+++ b/includes/block/AbstractBlock.php
@@ -435,7 +435,7 @@ abstract class AbstractBlock implements Block {
* and if the target is a User, the target's userpage is used
* @return bool The user can edit their talk page
*/
- public function appliesToUsertalk( Title $usertalk = null ) {
+ public function appliesToUsertalk( ?Title $usertalk = null ) {
if ( !$usertalk ) {
if ( $this->target instanceof UserIdentity ) {
$usertalk = Title::makeTitle(
diff --git a/includes/block/CompositeBlock.php b/includes/block/CompositeBlock.php
index df2b19cefb5b..c74481b98fbe 100644
--- a/includes/block/CompositeBlock.php
+++ b/includes/block/CompositeBlock.php
@@ -220,7 +220,7 @@ class CompositeBlock extends AbstractBlock {
/**
* @inheritDoc
*/
- public function appliesToUsertalk( Title $usertalk = null ) {
+ public function appliesToUsertalk( ?Title $usertalk = null ) {
return $this->methodReturnsValue( __FUNCTION__, true, $usertalk );
}
diff --git a/includes/block/DatabaseBlockStore.php b/includes/block/DatabaseBlockStore.php
index ecd4a450b623..891c6adbc677 100644
--- a/includes/block/DatabaseBlockStore.php
+++ b/includes/block/DatabaseBlockStore.php
@@ -1639,7 +1639,7 @@ class DatabaseBlockStore {
* @param string|null $parentExpiry
* @return string
*/
- public function getAutoblockExpiry( $timestamp, string $parentExpiry = null ) {
+ public function getAutoblockExpiry( $timestamp, ?string $parentExpiry = null ) {
$maxDuration = $this->options->get( MainConfigNames::AutoblockExpiry );
$expiry = wfTimestamp( TS_MW, (int)wfTimestamp( TS_UNIX, $timestamp ) + $maxDuration );
if ( $parentExpiry !== null && $parentExpiry !== 'infinity' ) {
diff --git a/includes/cache/GenderCache.php b/includes/cache/GenderCache.php
index d72f12795fb7..b6aba36866ea 100644
--- a/includes/cache/GenderCache.php
+++ b/includes/cache/GenderCache.php
@@ -57,9 +57,9 @@ class GenderCache {
private UserOptionsLookup $userOptionsLookup;
public function __construct(
- NamespaceInfo $nsInfo = null,
- IConnectionProvider $dbProvider = null,
- UserOptionsLookup $userOptionsLookup = null
+ ?NamespaceInfo $nsInfo = null,
+ ?IConnectionProvider $dbProvider = null,
+ ?UserOptionsLookup $userOptionsLookup = null
) {
$this->nsInfo = $nsInfo ?? MediaWikiServices::getInstance()->getNamespaceInfo();
$this->dbProvider = $dbProvider;
diff --git a/includes/cache/LinkCache.php b/includes/cache/LinkCache.php
index ada959c7c9b7..83abee0b2cd5 100644
--- a/includes/cache/LinkCache.php
+++ b/includes/cache/LinkCache.php
@@ -81,7 +81,7 @@ class LinkCache implements LoggerAwareInterface {
TitleFormatter $titleFormatter,
WANObjectCache $cache,
NamespaceInfo $nsInfo,
- ILoadBalancer $loadBalancer = null
+ ?ILoadBalancer $loadBalancer = null
) {
$this->entries = new MapCacheLRU( self::MAX_SIZE );
$this->wanCache = $cache;
@@ -402,7 +402,7 @@ class LinkCache implements LoggerAwareInterface {
*/
private function getGoodLinkRowInternal(
TitleValue $link,
- callable $fetchCallback = null,
+ ?callable $fetchCallback = null,
int $queryFlags = IDBAccessObject::READ_NORMAL
): array {
$callerShouldAddGoodLink = false;
@@ -479,7 +479,7 @@ class LinkCache implements LoggerAwareInterface {
public function getGoodLinkRow(
int $ns,
string $dbkey,
- callable $fetchCallback = null,
+ ?callable $fetchCallback = null,
int $queryFlags = IDBAccessObject::READ_NORMAL
): ?stdClass {
$link = TitleValue::tryNew( $ns, $dbkey );
diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php
index 5ccf8027265e..9f34a2c6af2b 100644
--- a/includes/changetags/ChangeTags.php
+++ b/includes/changetags/ChangeTags.php
@@ -164,7 +164,7 @@ class ChangeTags {
* - classes: Array of strings: CSS classes used in the generated html, one class for each tag
* @return-taint onlysafefor_htmlnoent
*/
- public static function formatSummaryRow( $tags, $unused, MessageLocalizer $localizer = null ) {
+ public static function formatSummaryRow( $tags, $unused, ?MessageLocalizer $localizer = null ) {
if ( $tags === '' || $tags === null ) {
return [ '', [] ];
}
@@ -329,7 +329,7 @@ class ChangeTags {
* @return bool False if no changes are made, otherwise true
*/
public static function addTags( $tags, $rc_id = null, $rev_id = null,
- $log_id = null, $params = null, RecentChange $rc = null
+ $log_id = null, $params = null, ?RecentChange $rc = null
) {
return MediaWikiServices::getInstance()->getChangeTagsStore()->addTags(
$tags, $rc_id, $rev_id, $log_id, $params, $rc
@@ -367,8 +367,8 @@ class ChangeTags {
* @since 1.25
*/
public static function updateTags( $tagsToAdd, $tagsToRemove, &$rc_id = null,
- &$rev_id = null, &$log_id = null, $params = null, RecentChange $rc = null,
- UserIdentity $user = null
+ &$rev_id = null, &$log_id = null, $params = null, ?RecentChange $rc = null,
+ ?UserIdentity $user = null
) {
return MediaWikiServices::getInstance()->getChangeTagsStore()->updateTags(
$tagsToAdd, $tagsToRemove, $rc_id, $rev_id, $log_id, $params, $rc, $user
@@ -444,7 +444,7 @@ class ChangeTags {
*/
public static function canAddTagsAccompanyingChange(
array $tags,
- Authority $performer = null,
+ ?Authority $performer = null,
$checkBlock = true
) {
$user = null;
@@ -494,7 +494,7 @@ class ChangeTags {
public static function canUpdateTags(
array $tagsToAdd,
array $tagsToRemove,
- Authority $performer = null
+ ?Authority $performer = null
) {
if ( $performer !== null ) {
if ( !$performer->isDefinitelyAllowed( 'changetags' ) ) {
@@ -728,7 +728,7 @@ class ChangeTags {
* @return array an array of (label, selector)
*/
public static function buildTagFilterSelector(
- $selected = '', $ooui = false, IContextSource $context = null
+ $selected = '', $ooui = false, ?IContextSource $context = null
) {
if ( !$context ) {
$context = RequestContext::getMain();
@@ -808,7 +808,7 @@ class ChangeTags {
* @return Status
* @since 1.25
*/
- public static function canActivateTag( $tag, Authority $performer = null ) {
+ public static function canActivateTag( $tag, ?Authority $performer = null ) {
if ( $performer !== null ) {
if ( !$performer->isAllowed( 'managechangetags' ) ) {
return Status::newFatal( 'tags-manage-no-permission' );
@@ -883,7 +883,7 @@ class ChangeTags {
* @return Status
* @since 1.25
*/
- public static function canDeactivateTag( $tag, Authority $performer = null ) {
+ public static function canDeactivateTag( $tag, ?Authority $performer = null ) {
if ( $performer !== null ) {
if ( !$performer->isAllowed( 'managechangetags' ) ) {
return Status::newFatal( 'tags-manage-no-permission' );
@@ -983,7 +983,7 @@ class ChangeTags {
* @return Status
* @since 1.25
*/
- public static function canCreateTag( $tag, Authority $performer = null ) {
+ public static function canCreateTag( $tag, ?Authority $performer = null ) {
$user = null;
$services = MediaWikiServices::getInstance();
if ( $performer !== null ) {
@@ -1086,7 +1086,7 @@ class ChangeTags {
* @return Status
* @since 1.25
*/
- public static function canDeleteTag( $tag, Authority $performer = null, int $flags = 0 ) {
+ public static function canDeleteTag( $tag, ?Authority $performer = null, int $flags = 0 ) {
$user = null;
$services = MediaWikiServices::getInstance();
if ( $performer !== null ) {
diff --git a/includes/changetags/ChangeTagsStore.php b/includes/changetags/ChangeTagsStore.php
index b72faeded224..1c9e6c47f77d 100644
--- a/includes/changetags/ChangeTagsStore.php
+++ b/includes/changetags/ChangeTagsStore.php
@@ -529,8 +529,8 @@ class ChangeTagsStore {
* revision or log entry before any changes were made
*/
public function updateTags( $tagsToAdd, $tagsToRemove, &$rc_id = null,
- &$rev_id = null, &$log_id = null, $params = null, RecentChange $rc = null,
- UserIdentity $user = null
+ &$rev_id = null, &$log_id = null, $params = null, ?RecentChange $rc = null,
+ ?UserIdentity $user = null
) {
$tagsToAdd = array_filter(
(array)$tagsToAdd, // Make sure we're submitting all tags...
@@ -723,7 +723,7 @@ class ChangeTagsStore {
* @return bool False if no changes are made, otherwise true
*/
public function addTags( $tags, $rc_id = null, $rev_id = null,
- $log_id = null, $params = null, RecentChange $rc = null
+ $log_id = null, $params = null, ?RecentChange $rc = null
) {
$result = $this->updateTags( $tags, null, $rc_id, $rev_id, $log_id, $params, $rc );
return (bool)$result[0];
diff --git a/includes/content/AbstractContent.php b/includes/content/AbstractContent.php
index bf4d3de170b2..2535ba92b89a 100644
--- a/includes/content/AbstractContent.php
+++ b/includes/content/AbstractContent.php
@@ -246,7 +246,7 @@ abstract class AbstractContent implements Content {
*
* @see Content::equals
*/
- public function equals( Content $that = null ) {
+ public function equals( ?Content $that = null ) {
if ( $that === null ) {
return false;
}
diff --git a/includes/content/CodeContentHandler.php b/includes/content/CodeContentHandler.php
index cf4185777491..d3c23f5a1aed 100644
--- a/includes/content/CodeContentHandler.php
+++ b/includes/content/CodeContentHandler.php
@@ -49,7 +49,7 @@ abstract class CodeContentHandler extends TextContentHandler {
*
* @see ContentHandler::getPageLanguage()
*/
- public function getPageLanguage( Title $title, Content $content = null ) {
+ public function getPageLanguage( Title $title, ?Content $content = null ) {
return MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
}
@@ -65,7 +65,7 @@ abstract class CodeContentHandler extends TextContentHandler {
*
* @see ContentHandler::getPageViewLanguage()
*/
- public function getPageViewLanguage( Title $title, Content $content = null ) {
+ public function getPageViewLanguage( Title $title, ?Content $content = null ) {
return MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
}
diff --git a/includes/content/Content.php b/includes/content/Content.php
index adee48a3c6c3..ddca542f611c 100644
--- a/includes/content/Content.php
+++ b/includes/content/Content.php
@@ -225,7 +225,7 @@ interface Content {
*
* @return bool True if this Content object is equal to $that, false otherwise.
*/
- public function equals( Content $that = null );
+ public function equals( ?Content $that = null );
/**
* Return a copy of this Content object. The following must be true for the
diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php
index 3c109a857fab..ad9aabe7628d 100644
--- a/includes/content/ContentHandler.php
+++ b/includes/content/ContentHandler.php
@@ -115,7 +115,7 @@ abstract class ContentHandler {
* @param Content|null $content
* @return string|null Textual form of the content, if available.
*/
- public static function getContentText( Content $content = null ) {
+ public static function getContentText( ?Content $content = null ) {
wfDeprecated( __METHOD__, '1.37' );
if ( $content === null ) {
return '';
@@ -152,7 +152,7 @@ abstract class ContentHandler {
* @throws MWUnknownContentModelException
* @return Content A Content object representing the text.
*/
- public static function makeContent( $text, Title $title = null,
+ public static function makeContent( $text, ?Title $title = null,
$modelId = null, $format = null ) {
if ( !$title && !$modelId ) {
throw new InvalidArgumentException( "Must provide a Title object or a content model ID." );
@@ -275,7 +275,7 @@ abstract class ContentHandler {
*
* @return string The content model's localized name.
*/
- public static function getLocalizedName( $name, Language $lang = null ) {
+ public static function getLocalizedName( $name, ?Language $lang = null ) {
// Messages: content-model-wikitext, content-model-text,
// content-model-javascript, content-model-css
// Lowercase the name as message keys need to be in lowercase, T358341
@@ -726,7 +726,7 @@ abstract class ContentHandler {
*
* @return Language
*/
- public function getPageLanguage( Title $title, Content $content = null ) {
+ public function getPageLanguage( Title $title, ?Content $content = null ) {
$services = MediaWikiServices::getInstance();
$pageLang = $services->getContentLanguage();
@@ -767,7 +767,7 @@ abstract class ContentHandler {
* @param Content|null $content The page's content, if you have it handy, to avoid reloading it.
* @return Language The page's language for viewing
*/
- public function getPageViewLanguage( Title $title, Content $content = null ) {
+ public function getPageViewLanguage( Title $title, ?Content $content = null ) {
$pageLang = $this->getPageLanguage( $title, $content );
if ( $title->getNamespace() !== NS_MEDIAWIKI ) {
@@ -865,8 +865,8 @@ abstract class ContentHandler {
* @return string|null String key representing type of change, or null.
*/
private function getChangeType(
- Content $oldContent = null,
- Content $newContent = null,
+ ?Content $oldContent = null,
+ ?Content $newContent = null,
$flags = 0
) {
$oldTarget = $oldContent !== null ? $oldContent->getRedirectTarget() : null;
@@ -933,8 +933,8 @@ abstract class ContentHandler {
* @return string An appropriate auto-summary, or an empty string.
*/
public function getAutosummary(
- Content $oldContent = null,
- Content $newContent = null,
+ ?Content $oldContent = null,
+ ?Content $newContent = null,
$flags = 0
) {
$changeType = $this->getChangeType( $oldContent, $newContent, $flags );
@@ -1021,8 +1021,8 @@ abstract class ContentHandler {
* @return string|null An appropriate tag, or null.
*/
public function getChangeTag(
- Content $oldContent = null,
- Content $newContent = null,
+ ?Content $oldContent = null,
+ ?Content $newContent = null,
$flags = 0
) {
$changeType = $this->getChangeType( $oldContent, $newContent, $flags );
@@ -1395,7 +1395,7 @@ abstract class ContentHandler {
WikiPage $page,
ParserOutput $output,
SearchEngine $engine,
- RevisionRecord $revision = null
+ ?RevisionRecord $revision = null
) {
$revision ??= $page->getRevisionRecord();
if ( $revision === null ) {
@@ -1455,8 +1455,8 @@ abstract class ContentHandler {
*/
public function getParserOutputForIndexing(
WikiPage $page,
- ParserCache $cache = null,
- RevisionRecord $revision = null
+ ?ParserCache $cache = null,
+ ?RevisionRecord $revision = null
) {
// TODO: MCR: ContentHandler should be called per slot, not for the whole page.
// See T190066.
diff --git a/includes/content/Renderer/ContentParseParams.php b/includes/content/Renderer/ContentParseParams.php
index be902c1d0b67..d274b6f70763 100644
--- a/includes/content/Renderer/ContentParseParams.php
+++ b/includes/content/Renderer/ContentParseParams.php
@@ -27,7 +27,7 @@ class ContentParseParams {
public function __construct(
PageReference $page,
- int $revId = null,
+ ?int $revId = null,
?ParserOptions $parserOptions = null,
bool $generateHtml = true,
?ParserOutput $previousOutput = null
diff --git a/includes/content/TextContent.php b/includes/content/TextContent.php
index 850715c4922b..49bf2c3ebf5b 100644
--- a/includes/content/TextContent.php
+++ b/includes/content/TextContent.php
@@ -224,7 +224,7 @@ class TextContent extends AbstractContent {
* @return Diff A diff representing the changes that would have to be
* made to this content object to make it equal to $that.
*/
- public function diff( Content $that, Language $lang = null ) {
+ public function diff( Content $that, ?Language $lang = null ) {
$this->checkModelID( $that->getModel() );
/** @var self $that */
'@phan-var self $that';
diff --git a/includes/content/WikitextContent.php b/includes/content/WikitextContent.php
index f808664d1b68..6fac7e46a3b2 100644
--- a/includes/content/WikitextContent.php
+++ b/includes/content/WikitextContent.php
@@ -214,7 +214,7 @@ class WikitextContent extends TextContent {
*
* @return bool
*/
- public function isCountable( $hasLinks = null, Title $title = null ) {
+ public function isCountable( $hasLinks = null, ?Title $title = null ) {
$articleCountMethod = MediaWikiServices::getInstance()->getMainConfig()
->get( MainConfigNames::ArticleCountMethod );
diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php
index 2e3cde6abb4c..3e1d3047e648 100644
--- a/includes/context/RequestContext.php
+++ b/includes/context/RequestContext.php
@@ -198,7 +198,7 @@ class RequestContext implements IContextSource, MutableContext {
/**
* @param Title|null $title
*/
- public function setTitle( Title $title = null ) {
+ public function setTitle( ?Title $title = null ) {
$this->title = $title;
// Clear cache of derived getters
$this->wikipage = null;
diff --git a/includes/db/CloneDatabase.php b/includes/db/CloneDatabase.php
index e56a09b94f30..75469892ab75 100644
--- a/includes/db/CloneDatabase.php
+++ b/includes/db/CloneDatabase.php
@@ -52,7 +52,7 @@ class CloneDatabase {
IMaintainableDatabase $db,
array $tablesToClone,
string $newTablePrefix,
- string $oldTablePrefix = null,
+ ?string $oldTablePrefix = null,
bool $dropCurrentTables = true
) {
if ( !$tablesToClone ) {
diff --git a/includes/debug/DeprecatablePropertyArray.php b/includes/debug/DeprecatablePropertyArray.php
index 688b99852071..df75352347a7 100644
--- a/includes/debug/DeprecatablePropertyArray.php
+++ b/includes/debug/DeprecatablePropertyArray.php
@@ -40,7 +40,7 @@ class DeprecatablePropertyArray implements ArrayAccess {
array $initializer,
array $deprecatedProperties,
string $name,
- string $component = null
+ ?string $component = null
) {
$this->container = $initializer;
$this->deprecatedProperties = $deprecatedProperties;
diff --git a/includes/debug/DeprecationHelper.php b/includes/debug/DeprecationHelper.php
index 291bbf6b4924..5f3bce5430c6 100644
--- a/includes/debug/DeprecationHelper.php
+++ b/includes/debug/DeprecationHelper.php
@@ -161,8 +161,8 @@ trait DeprecationHelper {
*/
protected function deprecateDynamicPropertiesAccess(
string $version,
- string $class = null,
- string $component = null
+ ?string $class = null,
+ ?string $component = null
) {
$this->dynamicPropertiesAccessDeprecated = [ $version, $class ?: __CLASS__, $component ];
}
diff --git a/includes/debug/logger/ConsoleLogger.php b/includes/debug/logger/ConsoleLogger.php
index 4e19ec16c326..ec225a3c0710 100644
--- a/includes/debug/logger/ConsoleLogger.php
+++ b/includes/debug/logger/ConsoleLogger.php
@@ -42,8 +42,8 @@ class ConsoleLogger extends AbstractLogger {
*/
public function __construct(
string $channel,
- string $minLevel = null,
- LoggerInterface $forwardTo = null
+ ?string $minLevel = null,
+ ?LoggerInterface $forwardTo = null
) {
Assert::parameter( $minLevel === null || isset( self::LEVELS[$minLevel] ), '$minLevel',
'must be a valid, lowercase PSR-3 log level' );
diff --git a/includes/debug/logger/LegacySpi.php b/includes/debug/logger/LegacySpi.php
index 7ada88c2eccb..57da3ab7b7e7 100644
--- a/includes/debug/logger/LegacySpi.php
+++ b/includes/debug/logger/LegacySpi.php
@@ -63,7 +63,7 @@ class LegacySpi implements Spi {
* @param LoggerInterface|null $logger
* @return LoggerInterface|null
*/
- public function setLoggerForTest( $channel, LoggerInterface $logger = null ) {
+ public function setLoggerForTest( $channel, ?LoggerInterface $logger = null ) {
$ret = $this->singletons[$channel] ?? null;
$this->singletons[$channel] = $logger;
return $ret;
diff --git a/includes/debug/logger/LogCapturingSpi.php b/includes/debug/logger/LogCapturingSpi.php
index 90ca731e1309..4a7c41521e45 100644
--- a/includes/debug/logger/LogCapturingSpi.php
+++ b/includes/debug/logger/LogCapturingSpi.php
@@ -97,7 +97,7 @@ class LogCapturingSpi implements Spi {
* @param LoggerInterface|null $logger
* @return LoggerInterface|null
*/
- public function setLoggerForTest( $channel, LoggerInterface $logger = null ) {
+ public function setLoggerForTest( $channel, ?LoggerInterface $logger = null ) {
$ret = $this->singletons[$channel] ?? null;
$this->singletons[$channel] = $logger;
return $ret;
diff --git a/includes/deferred/SearchUpdate.php b/includes/deferred/SearchUpdate.php
index 7d61f2bbc45b..b4e542fa0626 100644
--- a/includes/deferred/SearchUpdate.php
+++ b/includes/deferred/SearchUpdate.php
@@ -109,7 +109,7 @@ class SearchUpdate implements DeferrableUpdate {
* @param SearchEngine|null $se Search engine
* @return string
*/
- public function updateText( $text, SearchEngine $se = null ) {
+ public function updateText( $text, ?SearchEngine $se = null ) {
$services = MediaWikiServices::getInstance();
$contLang = $services->getContentLanguage();
# Language-specific strip/conversion
diff --git a/includes/diff/DifferenceEngineSlotDiffRenderer.php b/includes/diff/DifferenceEngineSlotDiffRenderer.php
index 62cf49f6ca47..b781cc0243bf 100644
--- a/includes/diff/DifferenceEngineSlotDiffRenderer.php
+++ b/includes/diff/DifferenceEngineSlotDiffRenderer.php
@@ -54,7 +54,7 @@ class DifferenceEngineSlotDiffRenderer extends SlotDiffRenderer {
}
/** @inheritDoc */
- public function getDiff( Content $oldContent = null, Content $newContent = null ) {
+ public function getDiff( ?Content $oldContent = null, ?Content $newContent = null ) {
$this->normalizeContents( $oldContent, $newContent );
return $this->differenceEngine->generateContentDiffBody( $oldContent, $newContent );
}
diff --git a/includes/diff/SlotDiffRenderer.php b/includes/diff/SlotDiffRenderer.php
index 9da566cf0ef0..2c03dd9e390c 100644
--- a/includes/diff/SlotDiffRenderer.php
+++ b/includes/diff/SlotDiffRenderer.php
@@ -52,7 +52,7 @@ abstract class SlotDiffRenderer {
* @return string HTML. One or more <tr> tags, or an empty string if the inputs are identical.
* @throws IncompatibleDiffTypesException
*/
- abstract public function getDiff( Content $oldContent = null, Content $newContent = null );
+ abstract public function getDiff( ?Content $oldContent = null, ?Content $newContent = null );
/**
* Localize language-independent text returned by getDiff(), making it
@@ -109,7 +109,7 @@ abstract class SlotDiffRenderer {
* @throws IncompatibleDiffTypesException
*/
protected function normalizeContents(
- Content &$oldContent = null, Content &$newContent = null, $allowedClasses = null
+ ?Content &$oldContent = null, ?Content &$newContent = null, $allowedClasses = null
) {
if ( !$oldContent && !$newContent ) {
throw new InvalidArgumentException( '$oldContent and $newContent cannot both be null' );
diff --git a/includes/diff/TextSlotDiffRenderer.php b/includes/diff/TextSlotDiffRenderer.php
index 033ed66c8625..5a76adb3dee8 100644
--- a/includes/diff/TextSlotDiffRenderer.php
+++ b/includes/diff/TextSlotDiffRenderer.php
@@ -241,7 +241,7 @@ class TextSlotDiffRenderer extends SlotDiffRenderer {
}
/** @inheritDoc */
- public function getDiff( Content $oldContent = null, Content $newContent = null ) {
+ public function getDiff( ?Content $oldContent = null, ?Content $newContent = null ) {
$this->normalizeContents( $oldContent, $newContent, TextContent::class );
$oldText = $oldContent->serialize();
diff --git a/includes/diff/UnsupportedSlotDiffRenderer.php b/includes/diff/UnsupportedSlotDiffRenderer.php
index fc53f8ff1091..64224693ca6a 100644
--- a/includes/diff/UnsupportedSlotDiffRenderer.php
+++ b/includes/diff/UnsupportedSlotDiffRenderer.php
@@ -45,7 +45,7 @@ class UnsupportedSlotDiffRenderer extends SlotDiffRenderer {
}
/** @inheritDoc */
- public function getDiff( Content $oldContent = null, Content $newContent = null ) {
+ public function getDiff( ?Content $oldContent = null, ?Content $newContent = null ) {
$this->normalizeContents( $oldContent, $newContent );
$oldModel = $oldContent->getModel();
diff --git a/includes/editpage/EditPage.php b/includes/editpage/EditPage.php
index 14bf603205b3..85d7d4cc21f4 100644
--- a/includes/editpage/EditPage.php
+++ b/includes/editpage/EditPage.php
@@ -3768,7 +3768,7 @@ class EditPage implements IEditObject {
* @param ParserOutput|null $output ParserOutput object from the parse
* @return string HTML
*/
- public static function getPreviewLimitReport( ParserOutput $output = null ) {
+ public static function getPreviewLimitReport( ?ParserOutput $output = null ) {
if ( !$output || !$output->getLimitReportData() ) {
return '';
}
diff --git a/includes/editpage/TextConflictHelper.php b/includes/editpage/TextConflictHelper.php
index e3757734532d..89d86b7192ac 100644
--- a/includes/editpage/TextConflictHelper.php
+++ b/includes/editpage/TextConflictHelper.php
@@ -136,7 +136,7 @@ class TextConflictHelper {
* Record a user encountering an edit conflict
* @param User|null $user
*/
- public function incrementConflictStats( User $user = null ) {
+ public function incrementConflictStats( ?User $user = null ) {
$namespace = 'n/a';
$userBucket = 'n/a';
$statsdMetrics = [ 'edit.failures.conflict' ];
@@ -174,7 +174,7 @@ class TextConflictHelper {
* Record when a user has resolved an edit conflict
* @param User|null $user
*/
- public function incrementResolvedStats( User $user = null ) {
+ public function incrementResolvedStats( ?User $user = null ) {
$namespace = 'n/a';
$userBucket = 'n/a';
$statsdMetrics = [ 'edit.failures.conflict.resolved' ];
diff --git a/includes/exception/LocalizedException.php b/includes/exception/LocalizedException.php
index 09ff465971a7..92a6e69e1b2d 100644
--- a/includes/exception/LocalizedException.php
+++ b/includes/exception/LocalizedException.php
@@ -42,7 +42,7 @@ class LocalizedException extends Exception implements ILocalizedException {
* @param Throwable|null $previous The previous exception used for the exception
* chaining.
*/
- public function __construct( $messageSpec, $code = 0, Throwable $previous = null ) {
+ public function __construct( $messageSpec, $code = 0, ?Throwable $previous = null ) {
$this->messageSpec = $messageSpec;
// Exception->getMessage() should be in plain English, not localized.
diff --git a/includes/exception/MWExceptionRenderer.php b/includes/exception/MWExceptionRenderer.php
index 3eea01fa76fc..92ad1d09b42c 100644
--- a/includes/exception/MWExceptionRenderer.php
+++ b/includes/exception/MWExceptionRenderer.php
@@ -72,7 +72,7 @@ class MWExceptionRenderer {
* @param int $mode MWExceptionExposer::AS_* constant
* @param Throwable|null $eNew New throwable from attempting to show the first
*/
- public static function output( Throwable $e, $mode, Throwable $eNew = null ) {
+ public static function output( Throwable $e, $mode, ?Throwable $eNew = null ) {
$showExceptionDetails = self::shouldShowExceptionDetails();
if ( $e instanceof RequestTimeoutException && headers_sent() ) {
// Excimer's flag check happens on function return, so, a timeout
diff --git a/includes/exception/UserBlockedError.php b/includes/exception/UserBlockedError.php
index 77ea900af1a9..f5cd7499975a 100644
--- a/includes/exception/UserBlockedError.php
+++ b/includes/exception/UserBlockedError.php
@@ -41,7 +41,7 @@ class UserBlockedError extends ErrorPageError {
*/
public function __construct(
Block $block,
- UserIdentity $user = null,
+ ?UserIdentity $user = null,
$language = null,
$ip = null
) {
diff --git a/includes/externalstore/ExternalStoreAccess.php b/includes/externalstore/ExternalStoreAccess.php
index 747f70efd832..cffe63b0da34 100644
--- a/includes/externalstore/ExternalStoreAccess.php
+++ b/includes/externalstore/ExternalStoreAccess.php
@@ -50,7 +50,7 @@ class ExternalStoreAccess implements LoggerAwareInterface {
* @param ExternalStoreFactory $factory
* @param LoggerInterface|null $logger
*/
- public function __construct( ExternalStoreFactory $factory, LoggerInterface $logger = null ) {
+ public function __construct( ExternalStoreFactory $factory, ?LoggerInterface $logger = null ) {
$this->storeFactory = $factory;
$this->logger = $logger ?: new NullLogger();
}
@@ -114,7 +114,7 @@ class ExternalStoreAccess implements LoggerAwareInterface {
* @return string|false The URL of the stored data item, or false on error
* @throws ExternalStoreException
*/
- public function insert( $data, array $params = [], array $tryStores = null ) {
+ public function insert( $data, array $params = [], ?array $tryStores = null ) {
$tryStores ??= $this->storeFactory->getWriteBaseUrls();
if ( !$tryStores ) {
throw new ExternalStoreException( "List of external stores provided is empty." );
diff --git a/includes/externalstore/ExternalStoreFactory.php b/includes/externalstore/ExternalStoreFactory.php
index cd27bb161ce5..1685c6312b86 100644
--- a/includes/externalstore/ExternalStoreFactory.php
+++ b/includes/externalstore/ExternalStoreFactory.php
@@ -33,7 +33,7 @@ class ExternalStoreFactory implements LoggerAwareInterface {
array $externalStores,
array $defaultStores,
string $localDomainId,
- LoggerInterface $logger = null
+ ?LoggerInterface $logger = null
) {
$this->protocols = array_map( 'strtolower', $externalStores );
$this->writeBaseUrls = $defaultStores;
diff --git a/includes/filerepo/FileBackendDBRepoWrapper.php b/includes/filerepo/FileBackendDBRepoWrapper.php
index 2d08720bbb30..3829d86cb00f 100644
--- a/includes/filerepo/FileBackendDBRepoWrapper.php
+++ b/includes/filerepo/FileBackendDBRepoWrapper.php
@@ -246,7 +246,7 @@ class FileBackendDBRepoWrapper extends FileBackend {
return $this->backend->getFeatures();
}
- public function clearCache( array $paths = null ) {
+ public function clearCache( ?array $paths = null ) {
$this->backend->clearCache( null ); // clear all
}
diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php
index 302d80b5bd39..b7d8b32d82d9 100644
--- a/includes/filerepo/FileRepo.php
+++ b/includes/filerepo/FileRepo.php
@@ -172,7 +172,7 @@ class FileRepo {
* @param array|null $info
* @phan-assert array $info
*/
- public function __construct( array $info = null ) {
+ public function __construct( ?array $info = null ) {
// Verify required settings presence
if (
$info === null
@@ -1948,7 +1948,7 @@ class FileRepo {
* @param UserIdentity|null $user
* @return UploadStash
*/
- public function getUploadStash( UserIdentity $user = null ) {
+ public function getUploadStash( ?UserIdentity $user = null ) {
return new UploadStash( $this, $user );
}
diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php
index fd7d7bd963ed..05e76ca5320a 100644
--- a/includes/filerepo/LocalRepo.php
+++ b/includes/filerepo/LocalRepo.php
@@ -84,7 +84,7 @@ class LocalRepo extends FileRepo {
/** @var bool */
protected $reserializeMetadata = false;
- public function __construct( array $info = null ) {
+ public function __construct( ?array $info = null ) {
parent::__construct( $info );
$this->dbDomain = WikiMap::getCurrentWikiDbDomain();
diff --git a/includes/filerepo/file/ArchivedFile.php b/includes/filerepo/file/ArchivedFile.php
index 90997e2217cd..b95bd4d522e1 100644
--- a/includes/filerepo/file/ArchivedFile.php
+++ b/includes/filerepo/file/ArchivedFile.php
@@ -702,7 +702,7 @@ class ArchivedFile {
* passed to the $audience parameter
* @return UserIdentity|null
*/
- public function getUploader( int $audience = self::FOR_PUBLIC, Authority $performer = null ): ?UserIdentity {
+ public function getUploader( int $audience = self::FOR_PUBLIC, ?Authority $performer = null ): ?UserIdentity {
$this->load();
if ( $audience === self::FOR_PUBLIC && $this->isDeleted( File::DELETED_USER ) ) {
return null;
@@ -725,7 +725,7 @@ class ArchivedFile {
* passed to the $audience parameter
* @return string
*/
- public function getDescription( int $audience = self::FOR_PUBLIC, Authority $performer = null ): string {
+ public function getDescription( int $audience = self::FOR_PUBLIC, ?Authority $performer = null ): string {
$this->load();
if ( $audience === self::FOR_PUBLIC && $this->isDeleted( File::DELETED_COMMENT ) ) {
return '';
diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php
index 37f3c78432c1..5a6ee39e8944 100644
--- a/includes/filerepo/file/File.php
+++ b/includes/filerepo/file/File.php
@@ -2229,7 +2229,7 @@ abstract class File implements MediaHandlerState {
* @return string|false HTML
* @return-taint escaped
*/
- public function getDescriptionText( Language $lang = null ) {
+ public function getDescriptionText( ?Language $lang = null ) {
global $wgLang;
if ( !$this->repo || !$this->repo->fetchDescription ) {
@@ -2282,7 +2282,7 @@ abstract class File implements MediaHandlerState {
* passed to the $audience parameter
* @return UserIdentity|null
*/
- public function getUploader( int $audience = self::FOR_PUBLIC, Authority $performer = null ): ?UserIdentity {
+ public function getUploader( int $audience = self::FOR_PUBLIC, ?Authority $performer = null ): ?UserIdentity {
return null;
}
@@ -2299,7 +2299,7 @@ abstract class File implements MediaHandlerState {
* passed to the $audience parameter
* @return null|string
*/
- public function getDescription( $audience = self::FOR_PUBLIC, Authority $performer = null ) {
+ public function getDescription( $audience = self::FOR_PUBLIC, ?Authority $performer = null ) {
return null;
}
diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php
index f9d1993bbbbe..64848d78474a 100644
--- a/includes/filerepo/file/ForeignAPIFile.php
+++ b/includes/filerepo/file/ForeignAPIFile.php
@@ -279,7 +279,7 @@ class ForeignAPIFile extends File {
return null;
}
- public function getUploader( int $audience = self::FOR_PUBLIC, Authority $performer = null ): ?UserIdentity {
+ public function getUploader( int $audience = self::FOR_PUBLIC, ?Authority $performer = null ): ?UserIdentity {
if ( isset( $this->mInfo['user'] ) ) {
return UserIdentityValue::newExternal( $this->getRepoName(), $this->mInfo['user'] );
}
@@ -291,7 +291,7 @@ class ForeignAPIFile extends File {
* @param Authority|null $performer
* @return null|string
*/
- public function getDescription( $audience = self::FOR_PUBLIC, Authority $performer = null ) {
+ public function getDescription( $audience = self::FOR_PUBLIC, ?Authority $performer = null ) {
return isset( $this->mInfo['comment'] ) ? strval( $this->mInfo['comment'] ) : null;
}
diff --git a/includes/filerepo/file/ForeignDBFile.php b/includes/filerepo/file/ForeignDBFile.php
index c46b25c04667..ae4ac58b04d4 100644
--- a/includes/filerepo/file/ForeignDBFile.php
+++ b/includes/filerepo/file/ForeignDBFile.php
@@ -89,7 +89,7 @@ class ForeignDBFile extends LocalFile {
* @param Language|null $lang Optional language to fetch description in.
* @return string|false
*/
- public function getDescriptionText( Language $lang = null ) {
+ public function getDescriptionText( ?Language $lang = null ) {
global $wgLang;
if ( !$this->repo->fetchDescription ) {
diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php
index 7ec95ec1b607..3d88958c7ef7 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -1619,7 +1619,7 @@ class LocalFile extends File {
* archive name, or an empty string if it was a new file.
*/
public function upload( $src, $comment, $pageText, $flags = 0, $props = false,
- $timestamp = false, Authority $uploader = null, $tags = [],
+ $timestamp = false, ?Authority $uploader = null, $tags = [],
$createNullRevision = true, $revert = false
) {
if ( $this->getRepo()->getReadOnlyReason() !== false ) {
@@ -2387,7 +2387,7 @@ class LocalFile extends File {
* @param Language|null $lang What language to get description in (Optional)
* @return string|false
*/
- public function getDescriptionText( Language $lang = null ) {
+ public function getDescriptionText( ?Language $lang = null ) {
if ( !$this->title ) {
return false; // Avoid hard failure when the file does not exist. T221812
}
@@ -2424,7 +2424,7 @@ class LocalFile extends File {
* @param Authority|null $performer
* @return UserIdentity|null
*/
- public function getUploader( int $audience = self::FOR_PUBLIC, Authority $performer = null ): ?UserIdentity {
+ public function getUploader( int $audience = self::FOR_PUBLIC, ?Authority $performer = null ): ?UserIdentity {
$this->load();
if ( $audience === self::FOR_PUBLIC && $this->isDeleted( self::DELETED_USER ) ) {
return null;
@@ -2441,7 +2441,7 @@ class LocalFile extends File {
* @param Authority|null $performer
* @return string
*/
- public function getDescription( $audience = self::FOR_PUBLIC, Authority $performer = null ) {
+ public function getDescription( $audience = self::FOR_PUBLIC, ?Authority $performer = null ) {
$this->load();
if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_COMMENT ) ) {
return '';
diff --git a/includes/gallery/ImageGalleryBase.php b/includes/gallery/ImageGalleryBase.php
index 3d9aac2cacfe..9a2a2b4c87f8 100644
--- a/includes/gallery/ImageGalleryBase.php
+++ b/includes/gallery/ImageGalleryBase.php
@@ -120,7 +120,7 @@ abstract class ImageGalleryBase extends ContextSource {
* @return ImageGalleryBase
* @throws ImageGalleryClassNotFoundException
*/
- public static function factory( $mode = false, IContextSource $context = null ) {
+ public static function factory( $mode = false, ?IContextSource $context = null ) {
self::loadModes();
if ( !$context ) {
$context = RequestContext::getMainAndWarn( __METHOD__ );
@@ -169,7 +169,7 @@ abstract class ImageGalleryBase extends ContextSource {
* @param string $mode
* @param IContextSource|null $context
*/
- public function __construct( $mode = 'traditional', IContextSource $context = null ) {
+ public function __construct( $mode = 'traditional', ?IContextSource $context = null ) {
if ( $context ) {
$this->setContext( $context );
}
diff --git a/includes/gallery/PackedImageGallery.php b/includes/gallery/PackedImageGallery.php
index 57381c97f823..978d8d5663af 100644
--- a/includes/gallery/PackedImageGallery.php
+++ b/includes/gallery/PackedImageGallery.php
@@ -23,7 +23,7 @@
use MediaWiki\Context\IContextSource;
class PackedImageGallery extends TraditionalImageGallery {
- public function __construct( $mode = 'traditional', IContextSource $context = null ) {
+ public function __construct( $mode = 'traditional', ?IContextSource $context = null ) {
parent::__construct( $mode, $context );
// Does not support per row option.
$this->mPerRow = 0;
diff --git a/includes/gallery/SlideshowImageGallery.php b/includes/gallery/SlideshowImageGallery.php
index 8453f77a3148..6419438bb0b0 100644
--- a/includes/gallery/SlideshowImageGallery.php
+++ b/includes/gallery/SlideshowImageGallery.php
@@ -23,7 +23,7 @@
use MediaWiki\Context\IContextSource;
class SlideshowImageGallery extends TraditionalImageGallery {
- public function __construct( $mode = 'traditional', IContextSource $context = null ) {
+ public function __construct( $mode = 'traditional', ?IContextSource $context = null ) {
parent::__construct( $mode, $context );
// Does not support per row option.
$this->mPerRow = 0;
diff --git a/includes/htmlform/CodexHTMLForm.php b/includes/htmlform/CodexHTMLForm.php
index f3589e787e5f..256fd8c2b019 100644
--- a/includes/htmlform/CodexHTMLForm.php
+++ b/includes/htmlform/CodexHTMLForm.php
@@ -39,7 +39,7 @@ class CodexHTMLForm extends HTMLForm {
protected $displayFormat = 'codex';
public static function loadInputFromParameters( $fieldname, $descriptor,
- HTMLForm $parent = null
+ ?HTMLForm $parent = null
) {
$field = parent::loadInputFromParameters( $fieldname, $descriptor, $parent );
$field->setShowEmptyLabel( false );
diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php
index ab711b08dc7f..31d0e3371551 100644
--- a/includes/htmlform/HTMLForm.php
+++ b/includes/htmlform/HTMLForm.php
@@ -631,7 +631,7 @@ class HTMLForm extends ContextSource {
* @return HTMLFormField Instance of a subclass of HTMLFormField
*/
public static function loadInputFromParameters( $fieldname, $descriptor,
- HTMLForm $parent = null
+ ?HTMLForm $parent = null
) {
$class = static::getClassFromDescriptor( $fieldname, $descriptor );
diff --git a/includes/htmlform/OOUIHTMLForm.php b/includes/htmlform/OOUIHTMLForm.php
index 1eba7cf2be71..04c311f66171 100644
--- a/includes/htmlform/OOUIHTMLForm.php
+++ b/includes/htmlform/OOUIHTMLForm.php
@@ -54,7 +54,7 @@ class OOUIHTMLForm extends HTMLForm {
protected $displayFormat = 'ooui';
public static function loadInputFromParameters( $fieldname, $descriptor,
- HTMLForm $parent = null
+ ?HTMLForm $parent = null
) {
$field = parent::loadInputFromParameters( $fieldname, $descriptor, $parent );
$field->setShowEmptyLabel( false );
diff --git a/includes/htmlform/VFormHTMLForm.php b/includes/htmlform/VFormHTMLForm.php
index 0f2ebf8dc536..4a7a828be821 100644
--- a/includes/htmlform/VFormHTMLForm.php
+++ b/includes/htmlform/VFormHTMLForm.php
@@ -41,7 +41,7 @@ class VFormHTMLForm extends HTMLForm {
protected $displayFormat = 'vform';
public static function loadInputFromParameters( $fieldname, $descriptor,
- HTMLForm $parent = null
+ ?HTMLForm $parent = null
) {
$field = parent::loadInputFromParameters( $fieldname, $descriptor, $parent );
$field->setShowEmptyLabel( false );
diff --git a/includes/http/GuzzleHttpRequest.php b/includes/http/GuzzleHttpRequest.php
index d86dd6921363..f5c343877cf9 100644
--- a/includes/http/GuzzleHttpRequest.php
+++ b/includes/http/GuzzleHttpRequest.php
@@ -63,7 +63,7 @@ class GuzzleHttpRequest extends MWHttpRequest {
* @throws Exception
*/
public function __construct(
- $url, array $options = [], $caller = __METHOD__, Profiler $profiler = null
+ $url, array $options = [], $caller = __METHOD__, ?Profiler $profiler = null
) {
parent::__construct( $url, $options, $caller, $profiler );
diff --git a/includes/http/HttpRequestFactory.php b/includes/http/HttpRequestFactory.php
index ccb43d879669..b86a5876ef30 100644
--- a/includes/http/HttpRequestFactory.php
+++ b/includes/http/HttpRequestFactory.php
@@ -57,7 +57,7 @@ class HttpRequestFactory {
public function __construct(
ServiceOptions $options,
LoggerInterface $logger,
- Telemetry $telemetry = null
+ ?Telemetry $telemetry = null
) {
$options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
$this->options = $options;
diff --git a/includes/http/MWHttpRequest.php b/includes/http/MWHttpRequest.php
index 51ee96cbd568..fff6355d11ec 100644
--- a/includes/http/MWHttpRequest.php
+++ b/includes/http/MWHttpRequest.php
@@ -120,7 +120,7 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
* @throws Exception
*/
public function __construct(
- $url, array $options, $caller = __METHOD__, Profiler $profiler = null
+ $url, array $options, $caller = __METHOD__, ?Profiler $profiler = null
) {
$this->urlUtils = MediaWikiServices::getInstance()->getUrlUtils();
if ( !array_key_exists( 'timeout', $options )
diff --git a/includes/http/Telemetry.php b/includes/http/Telemetry.php
index 0e546e60800e..f4c80b44efa9 100644
--- a/includes/http/Telemetry.php
+++ b/includes/http/Telemetry.php
@@ -52,7 +52,7 @@ class Telemetry implements TelemetryHeadersInterface {
/**
* @param array $server Server and execution environment information, most likely the $_SERVER variable
*/
- public function __construct( array $server, bool $allowExternalReqID = null ) {
+ public function __construct( array $server, ?bool $allowExternalReqID = null ) {
$this->server = $server;
$this->allowExternalReqID = $allowExternalReqID;
}
diff --git a/includes/import/ImportableOldRevisionImporter.php b/includes/import/ImportableOldRevisionImporter.php
index 4c962434065d..d6ee1eac606e 100644
--- a/includes/import/ImportableOldRevisionImporter.php
+++ b/includes/import/ImportableOldRevisionImporter.php
@@ -35,9 +35,9 @@ class ImportableOldRevisionImporter implements OldRevisionImporter {
IConnectionProvider $dbProvider,
RevisionStore $revisionStore,
SlotRoleRegistry $slotRoleRegistry,
- WikiPageFactory $wikiPageFactory = null,
- PageUpdaterFactory $pageUpdaterFactory = null,
- UserFactory $userFactory = null
+ ?WikiPageFactory $wikiPageFactory = null,
+ ?PageUpdaterFactory $pageUpdaterFactory = null,
+ ?UserFactory $userFactory = null
) {
$this->doUpdates = $doUpdates;
$this->logger = $logger;
diff --git a/includes/import/WikiImporterFactory.php b/includes/import/WikiImporterFactory.php
index c5b436f87896..7ebda454cd21 100644
--- a/includes/import/WikiImporterFactory.php
+++ b/includes/import/WikiImporterFactory.php
@@ -78,7 +78,7 @@ class WikiImporterFactory {
* If you want to also log the import actions, see ImportReporter.
* @return WikiImporter
*/
- public function getWikiImporter( ImportSource $source, Authority $performer = null ): WikiImporter {
+ public function getWikiImporter( ImportSource $source, ?Authority $performer = null ): WikiImporter {
if ( !$performer ) {
wfDeprecated( __METHOD__ . ' without $performer', '1.42' );
$performer = RequestContext::getMain()->getAuthority();
diff --git a/includes/installer/ConnectionStatus.php b/includes/installer/ConnectionStatus.php
index a6532045ddb5..92170af19f89 100644
--- a/includes/installer/ConnectionStatus.php
+++ b/includes/installer/ConnectionStatus.php
@@ -9,7 +9,7 @@ use Wikimedia\Rdbms\Database;
* @internal
*/
class ConnectionStatus extends Status {
- public function __construct( Database $db = null ) {
+ public function __construct( ?Database $db = null ) {
$this->value = $db;
}
diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php
index 8c1d1b4cdd4f..98d4ef3aed09 100644
--- a/includes/installer/DatabaseUpdater.php
+++ b/includes/installer/DatabaseUpdater.php
@@ -133,7 +133,7 @@ abstract class DatabaseUpdater {
protected function __construct(
IMaintainableDatabase &$db,
$shared,
- Maintenance $maintenance = null
+ ?Maintenance $maintenance = null
) {
$this->db = $db;
$this->db->setFlag( DBO_DDLMODE );
@@ -229,7 +229,7 @@ abstract class DatabaseUpdater {
public static function newForDB(
IMaintainableDatabase $db,
$shared = false,
- Maintenance $maintenance = null
+ ?Maintenance $maintenance = null
) {
$type = $db->getType();
if ( in_array( $type, Installer::getDBTypes() ) ) {
diff --git a/includes/installer/InstallException.php b/includes/installer/InstallException.php
index 7ccf4df86ec4..18e54f644624 100644
--- a/includes/installer/InstallException.php
+++ b/includes/installer/InstallException.php
@@ -40,7 +40,7 @@ class InstallException extends \MWException {
* @param Throwable|null $previous The previous throwable used for the exception chaining
*/
public function __construct( Status $status, $message = '', $code = 0,
- Throwable $previous = null ) {
+ ?Throwable $previous = null ) {
parent::__construct( $message, $code, $previous );
$this->status = $status;
}
diff --git a/includes/interwiki/InterwikiLookupAdapter.php b/includes/interwiki/InterwikiLookupAdapter.php
index 6325d08c83b1..e8c755e2f12f 100644
--- a/includes/interwiki/InterwikiLookupAdapter.php
+++ b/includes/interwiki/InterwikiLookupAdapter.php
@@ -45,7 +45,7 @@ class InterwikiLookupAdapter implements InterwikiLookup {
public function __construct(
SiteLookup $siteLookup,
- array $interwikiMap = null
+ ?array $interwikiMap = null
) {
$this->siteLookup = $siteLookup;
$this->interwikiMap = $interwikiMap;
diff --git a/includes/jobqueue/JobSpecification.php b/includes/jobqueue/JobSpecification.php
index ce7800ee6833..bf3dc9552a60 100644
--- a/includes/jobqueue/JobSpecification.php
+++ b/includes/jobqueue/JobSpecification.php
@@ -61,7 +61,7 @@ class JobSpecification implements IJobSpecification {
* @param PageReference|null $page
*/
public function __construct(
- $type, array $params, array $opts = [], PageReference $page = null
+ $type, array $params, array $opts = [], ?PageReference $page = null
) {
$params += [
'requestId' => Telemetry::getInstance()->getRequestId(),
diff --git a/includes/jobqueue/jobs/CategoryMembershipChangeJob.php b/includes/jobqueue/jobs/CategoryMembershipChangeJob.php
index accac902461d..13a4d6b0b15d 100644
--- a/includes/jobqueue/jobs/CategoryMembershipChangeJob.php
+++ b/includes/jobqueue/jobs/CategoryMembershipChangeJob.php
@@ -232,7 +232,7 @@ class CategoryMembershipChangeJob extends Job {
}
private function getExplicitCategoriesChanges(
- WikiPage $page, RevisionRecord $newRev, RevisionRecord $oldRev = null
+ WikiPage $page, RevisionRecord $newRev, ?RevisionRecord $oldRev = null
) {
// Inject the same timestamp for both revision parses to avoid seeing category changes
// due to time-based parser functions. Inject the same page title for the parses too.
diff --git a/includes/json/JsonCodec.php b/includes/json/JsonCodec.php
index 5331b255508d..0ec82526cfe8 100644
--- a/includes/json/JsonCodec.php
+++ b/includes/json/JsonCodec.php
@@ -141,7 +141,7 @@ class JsonCodec
return $this->deserialize( $json, $expectedClass );
}
- public function deserialize( $json, string $expectedClass = null ) {
+ public function deserialize( $json, ?string $expectedClass = null ) {
Assert::parameterType( [ 'stdClass', 'array', 'string' ], $json, '$json' );
Assert::precondition(
!$expectedClass ||
diff --git a/includes/json/JsonDeserializer.php b/includes/json/JsonDeserializer.php
index 2c09306ddf65..cfe2111107e7 100644
--- a/includes/json/JsonDeserializer.php
+++ b/includes/json/JsonDeserializer.php
@@ -47,14 +47,14 @@ interface JsonDeserializer {
* @throws InvalidArgumentException if the passed $json can't be deserialized.
* @return mixed
*/
- public function deserialize( $json, string $expectedClass = null );
+ public function deserialize( $json, ?string $expectedClass = null );
/**
* Backwards-compatibility alias for deserialize()
*
* @deprecated since 1.43
*/
- public function unserialize( $json, string $expectedClass = null );
+ public function unserialize( $json, ?string $expectedClass = null );
/**
* Helper to deserialize an array of JsonDeserializable instances or simple types.
diff --git a/includes/language/Language.php b/includes/language/Language.php
index 92d23c633aa9..a3a209d6e023 100644
--- a/includes/language/Language.php
+++ b/includes/language/Language.php
@@ -333,13 +333,13 @@ class Language implements Bcp47Code {
*/
public function __construct(
$code = null,
- NamespaceInfo $namespaceInfo = null,
- LocalisationCache $localisationCache = null,
- LanguageNameUtils $langNameUtils = null,
- LanguageFallback $langFallback = null,
- LanguageConverterFactory $converterFactory = null,
- HookContainer $hookContainer = null,
- Config $config = null
+ ?NamespaceInfo $namespaceInfo = null,
+ ?LocalisationCache $localisationCache = null,
+ ?LanguageNameUtils $langNameUtils = null,
+ ?LanguageFallback $langFallback = null,
+ ?LanguageConverterFactory $converterFactory = null,
+ ?HookContainer $hookContainer = null,
+ ?Config $config = null
) {
if ( !func_num_args() ) {
// Old calling convention, deprecated
@@ -899,7 +899,7 @@ class Language implements Bcp47Code {
* @return string
* @return-taint tainted
*/
- public function sprintfDate( $format, $ts, DateTimeZone $zone = null, &$ttl = 'unused' ) {
+ public function sprintfDate( $format, $ts, ?DateTimeZone $zone = null, &$ttl = 'unused' ) {
// @phan-suppress-previous-line PhanTypeMismatchDefault Type mismatch on pass-by-ref args
$s = '';
$raw = false;
@@ -2404,7 +2404,7 @@ class Language implements Bcp47Code {
* @return string Formatted timestamp
*/
public function getHumanTimestamp(
- MWTimestamp $time, MWTimestamp $relativeTo = null, UserIdentity $user = null
+ MWTimestamp $time, ?MWTimestamp $relativeTo = null, ?UserIdentity $user = null
) {
$relativeTo ??= new MWTimestamp();
if ( $user === null ) {
@@ -4040,7 +4040,7 @@ class Language implements Bcp47Code {
* @return string Somehow translated block duration
* @see LanguageFi.php file for an implementation example
*/
- public function translateBlockExpiry( $str, UserIdentity $user = null, $now = 0 ) {
+ public function translateBlockExpiry( $str, ?UserIdentity $user = null, $now = 0 ) {
$duration = $this->getBlockDurations();
$show = array_search( $str, $duration, true );
if ( $show !== false ) {
diff --git a/includes/language/MessageCache.php b/includes/language/MessageCache.php
index 0598fab5df77..227fd9eb0ad2 100644
--- a/includes/language/MessageCache.php
+++ b/includes/language/MessageCache.php
@@ -1458,7 +1458,7 @@ class MessageCache implements LoggerAwareInterface {
* @param PageReference|null $page
* @return string
*/
- public function transform( $message, $interface = false, $language = null, PageReference $page = null ) {
+ public function transform( $message, $interface = false, $language = null, ?PageReference $page = null ) {
// Avoid creating parser if nothing to transform
if ( $this->inParser || !str_contains( $message, '{{' ) ) {
return $message;
@@ -1497,7 +1497,7 @@ class MessageCache implements LoggerAwareInterface {
* @param Language|StubUserLang|string|null $language Language code
* @return ParserOutput|string
*/
- public function parse( $text, PageReference $page = null, $linestart = true,
+ public function parse( $text, ?PageReference $page = null, $linestart = true,
$interface = false, $language = null
) {
// phpcs:ignore MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle
@@ -1636,7 +1636,7 @@ class MessageCache implements LoggerAwareInterface {
* @param Content|null $content New content for edit/create, null on deletion
* @since 1.29
*/
- public function updateMessageOverride( LinkTarget $linkTarget, Content $content = null ) {
+ public function updateMessageOverride( LinkTarget $linkTarget, ?Content $content = null ) {
// treat null as not existing
$msgText = $this->getMessageTextFromContent( $content ) ?? false;
@@ -1659,7 +1659,7 @@ class MessageCache implements LoggerAwareInterface {
* @param Content|null $content Content or null if the message page does not exist
* @return string|false|null Returns false if $content is null and null on error
*/
- private function getMessageTextFromContent( Content $content = null ) {
+ private function getMessageTextFromContent( ?Content $content = null ) {
// @TODO: could skip pseudo-messages like js/css here, based on content model
if ( $content && $content->isRedirect() ) {
// Treat redirects as not existing (T376398)
diff --git a/includes/language/TrivialLanguageConverter.php b/includes/language/TrivialLanguageConverter.php
index d3137800386d..ddfc323d263f 100644
--- a/includes/language/TrivialLanguageConverter.php
+++ b/includes/language/TrivialLanguageConverter.php
@@ -60,7 +60,7 @@ class TrivialLanguageConverter implements ILanguageConverter {
*/
public function __construct(
$langobj,
- TitleFormatter $titleFormatter = null
+ ?TitleFormatter $titleFormatter = null
) {
$this->language = $langobj;
$this->titleFormatter = $titleFormatter ?? MediaWikiServices::getInstance()->getTitleFormatter();
diff --git a/includes/languages/LanguageFi.php b/includes/languages/LanguageFi.php
index f84d37883881..7e60c629a20d 100644
--- a/includes/languages/LanguageFi.php
+++ b/includes/languages/LanguageFi.php
@@ -83,7 +83,7 @@ class LanguageFi extends Language {
* @param int $now Current timestamp, for formatting relative block durations
* @return string
*/
- public function translateBlockExpiry( $str, UserIdentity $user = null, $now = 0 ) {
+ public function translateBlockExpiry( $str, ?UserIdentity $user = null, $now = 0 ) {
/*
'ago', 'now', 'today', 'this', 'next',
'first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth',
diff --git a/includes/libs/Message/DataMessageValue.php b/includes/libs/Message/DataMessageValue.php
index 44cb66f06218..a7a93bfb62cd 100644
--- a/includes/libs/Message/DataMessageValue.php
+++ b/includes/libs/Message/DataMessageValue.php
@@ -39,7 +39,7 @@ class DataMessageValue extends MessageValue {
* @param array|null $data Structured data representing the concept
* behind this message.
*/
- public function __construct( $key, $params = [], $code = null, array $data = null ) {
+ public function __construct( $key, $params = [], $code = null, ?array $data = null ) {
parent::__construct( $key, $params );
$this->code = $code ?? $key;
@@ -54,7 +54,7 @@ class DataMessageValue extends MessageValue {
* @param array|null $data
* @return DataMessageValue
*/
- public static function new( $key, $params = [], $code = null, array $data = null ) {
+ public static function new( $key, $params = [], $code = null, ?array $data = null ) {
return new DataMessageValue( $key, $params, $code, $data );
}
diff --git a/includes/libs/ParamValidator/TypeDef.php b/includes/libs/ParamValidator/TypeDef.php
index c7eecf91f8b6..7a7b4e24a991 100644
--- a/includes/libs/ParamValidator/TypeDef.php
+++ b/includes/libs/ParamValidator/TypeDef.php
@@ -153,7 +153,7 @@ abstract class TypeDef {
* @param string|null $suffix Suffix to append when producing the message key
* @return DataMessageValue
*/
- protected function failureMessage( $code, array $data = null, $suffix = null ): DataMessageValue {
+ protected function failureMessage( $code, ?array $data = null, $suffix = null ): DataMessageValue {
return DataMessageValue::new(
"paramvalidator-$code" . ( $suffix !== null ? "-$suffix" : '' ),
[], $code, $data
diff --git a/includes/libs/ParamValidator/ValidationException.php b/includes/libs/ParamValidator/ValidationException.php
index e37820aff598..c217b3184840 100644
--- a/includes/libs/ParamValidator/ValidationException.php
+++ b/includes/libs/ParamValidator/ValidationException.php
@@ -36,7 +36,7 @@ class ValidationException extends UnexpectedValueException {
* @param Throwable|null $previous Previous throwable causing this failure
*/
public function __construct(
- DataMessageValue $failureMessage, $name, $value, $settings, Throwable $previous = null
+ DataMessageValue $failureMessage, $name, $value, $settings, ?Throwable $previous = null
) {
$this->failureMessage = $failureMessage;
$this->paramName = $name;
diff --git a/includes/libs/Stats/OutputFormats.php b/includes/libs/Stats/OutputFormats.php
index ff10f7ea8b39..157b05e3c71c 100644
--- a/includes/libs/Stats/OutputFormats.php
+++ b/includes/libs/Stats/OutputFormats.php
@@ -96,7 +96,7 @@ class OutputFormats {
string $prefix,
StatsCache $cache,
FormatterInterface $formatter,
- string $target = null
+ ?string $target = null
): EmitterInterface {
switch ( get_class( $formatter ) ) {
case StatsdFormatter::class:
diff --git a/includes/libs/WRStats/LimitOperation.php b/includes/libs/WRStats/LimitOperation.php
index 1b73f5ad3a09..145e419821b6 100644
--- a/includes/libs/WRStats/LimitOperation.php
+++ b/includes/libs/WRStats/LimitOperation.php
@@ -27,7 +27,7 @@ class LimitOperation {
*/
public function __construct(
string $condName,
- EntityKey $entityKey = null,
+ ?EntityKey $entityKey = null,
$amount = 1
) {
$this->condName = $condName;
diff --git a/includes/libs/WRStats/WRStatsRateLimiter.php b/includes/libs/WRStats/WRStatsRateLimiter.php
index 2b9e0313eb53..4270835b15a5 100644
--- a/includes/libs/WRStats/WRStatsRateLimiter.php
+++ b/includes/libs/WRStats/WRStatsRateLimiter.php
@@ -74,7 +74,7 @@ class WRStatsRateLimiter {
*/
public function peek(
string $condName,
- EntityKey $entityKey = null,
+ ?EntityKey $entityKey = null,
$amount = 1
): LimitOperationResult {
$actions = [ new LimitOperation( $condName, $entityKey, $amount ) ];
@@ -136,7 +136,7 @@ class WRStatsRateLimiter {
*/
public function tryIncr(
string $condName,
- EntityKey $entityKey = null,
+ ?EntityKey $entityKey = null,
$amount = 1
): LimitOperationResult {
$actions = [ new LimitOperation( $condName, $entityKey, $amount ) ];
@@ -169,7 +169,7 @@ class WRStatsRateLimiter {
*/
public function incr(
string $condName,
- EntityKey $entityKey = null,
+ ?EntityKey $entityKey = null,
$amount = 1
) {
$actions = [ new LimitOperation( $condName, $entityKey, $amount ) ];
diff --git a/includes/libs/filebackend/FSFileBackend.php b/includes/libs/filebackend/FSFileBackend.php
index 11ba1b706112..2e6c9ba076e4 100644
--- a/includes/libs/filebackend/FSFileBackend.php
+++ b/includes/libs/filebackend/FSFileBackend.php
@@ -613,7 +613,7 @@ class FSFileBackend extends FileBackendStore {
return $hadError ? self::RES_ERROR : self::RES_ABSENT;
}
- protected function doClearCache( array $paths = null ) {
+ protected function doClearCache( ?array $paths = null ) {
if ( is_array( $paths ) ) {
foreach ( $paths as $path ) {
$fsPath = $this->resolveToFSPath( $path );
diff --git a/includes/libs/filebackend/FileBackend.php b/includes/libs/filebackend/FileBackend.php
index 46a46ff05131..8ad1ca2956c7 100644
--- a/includes/libs/filebackend/FileBackend.php
+++ b/includes/libs/filebackend/FileBackend.php
@@ -1388,7 +1388,7 @@ abstract class FileBackend implements LoggerAwareInterface {
*
* @param array|null $paths Storage paths (optional)
*/
- abstract public function clearCache( array $paths = null );
+ abstract public function clearCache( ?array $paths = null );
/**
* Preload file stat information (concurrently if possible) into in-process cache.
diff --git a/includes/libs/filebackend/FileBackendMultiWrite.php b/includes/libs/filebackend/FileBackendMultiWrite.php
index 8c9b753cb27b..c35237da1c5d 100644
--- a/includes/libs/filebackend/FileBackendMultiWrite.php
+++ b/includes/libs/filebackend/FileBackendMultiWrite.php
@@ -793,7 +793,7 @@ class FileBackendMultiWrite extends FileBackend {
return $this->backends[$this->masterIndex]->getFeatures();
}
- public function clearCache( array $paths = null ) {
+ public function clearCache( ?array $paths = null ) {
foreach ( $this->backends as $backend ) {
$realPaths = is_array( $paths ) ? $this->substPaths( $paths, $backend ) : null;
$backend->clearCache( $realPaths );
diff --git a/includes/libs/filebackend/FileBackendStore.php b/includes/libs/filebackend/FileBackendStore.php
index 9d0530f82591..99db1aa65103 100644
--- a/includes/libs/filebackend/FileBackendStore.php
+++ b/includes/libs/filebackend/FileBackendStore.php
@@ -1486,7 +1486,7 @@ abstract class FileBackendStore extends FileBackend {
$this->primeFileCache( $paths );
}
- final public function clearCache( array $paths = null ) {
+ final public function clearCache( ?array $paths = null ) {
if ( is_array( $paths ) ) {
$paths = array_map( [ FileBackend::class, 'normalizeStoragePath' ], $paths );
$paths = array_filter( $paths, 'strlen' ); // remove nulls
@@ -1511,7 +1511,7 @@ abstract class FileBackendStore extends FileBackend {
*
* @param string[]|null $paths Storage paths (optional)
*/
- protected function doClearCache( array $paths = null ) {
+ protected function doClearCache( ?array $paths = null ) {
}
final public function preloadFileStat( array $params ) {
diff --git a/includes/libs/lockmanager/ScopedLock.php b/includes/libs/lockmanager/ScopedLock.php
index 67b56f9a8f9d..679d4debb442 100644
--- a/includes/libs/lockmanager/ScopedLock.php
+++ b/includes/libs/lockmanager/ScopedLock.php
@@ -83,7 +83,7 @@ class ScopedLock {
* @param ScopedLock|null &$lock
* @since 1.21
*/
- public static function release( ScopedLock &$lock = null ) {
+ public static function release( ?ScopedLock &$lock = null ) {
$lock = null;
}
diff --git a/includes/libs/mime/MimeAnalyzer.php b/includes/libs/mime/MimeAnalyzer.php
index 6487c385ded1..6c12c96210e0 100644
--- a/includes/libs/mime/MimeAnalyzer.php
+++ b/includes/libs/mime/MimeAnalyzer.php
@@ -952,7 +952,7 @@ class MimeAnalyzer implements LoggerAwareInterface {
* @param string|null $mime MIME type. If null it will be guessed using guessMimeType.
* @return string A value to be used with the MEDIATYPE_xxx constants.
*/
- public function getMediaType( string $path = null, string $mime = null ): string {
+ public function getMediaType( ?string $path = null, ?string $mime = null ): string {
if ( !$mime && !$path ) {
return MEDIATYPE_UNKNOWN;
}
diff --git a/includes/libs/objectcache/BagOStuff.php b/includes/libs/objectcache/BagOStuff.php
index 500134705f59..a2337caa8e82 100644
--- a/includes/libs/objectcache/BagOStuff.php
+++ b/includes/libs/objectcache/BagOStuff.php
@@ -394,9 +394,9 @@ abstract class BagOStuff implements
*/
abstract public function deleteObjectsExpiringBefore(
$timestamp,
- callable $progress = null,
+ ?callable $progress = null,
$limit = INF,
- string $tag = null
+ ?string $tag = null
);
/**
diff --git a/includes/libs/objectcache/CachedBagOStuff.php b/includes/libs/objectcache/CachedBagOStuff.php
index 3e209ac7de80..e6f6e06dc14f 100644
--- a/includes/libs/objectcache/CachedBagOStuff.php
+++ b/includes/libs/objectcache/CachedBagOStuff.php
@@ -187,9 +187,9 @@ class CachedBagOStuff extends BagOStuff {
public function deleteObjectsExpiringBefore(
$timestamp,
- callable $progress = null,
+ ?callable $progress = null,
$limit = INF,
- string $tag = null
+ ?string $tag = null
) {
$this->procCache->deleteObjectsExpiringBefore( $timestamp, $progress, $limit, $tag );
diff --git a/includes/libs/objectcache/MediumSpecificBagOStuff.php b/includes/libs/objectcache/MediumSpecificBagOStuff.php
index 02772457a2ac..1eaf24bb006c 100644
--- a/includes/libs/objectcache/MediumSpecificBagOStuff.php
+++ b/includes/libs/objectcache/MediumSpecificBagOStuff.php
@@ -657,9 +657,9 @@ abstract class MediumSpecificBagOStuff extends BagOStuff {
public function deleteObjectsExpiringBefore(
$timestamp,
- callable $progress = null,
+ ?callable $progress = null,
$limit = INF,
- string $tag = null
+ ?string $tag = null
) {
return false;
}
diff --git a/includes/libs/objectcache/MultiWriteBagOStuff.php b/includes/libs/objectcache/MultiWriteBagOStuff.php
index 3d9233836703..9948a7e26208 100644
--- a/includes/libs/objectcache/MultiWriteBagOStuff.php
+++ b/includes/libs/objectcache/MultiWriteBagOStuff.php
@@ -307,9 +307,9 @@ class MultiWriteBagOStuff extends BagOStuff {
public function deleteObjectsExpiringBefore(
$timestamp,
- callable $progress = null,
+ ?callable $progress = null,
$limit = INF,
- string $tag = null
+ ?string $tag = null
) {
$ret = false;
foreach ( $this->caches as $cache ) {
diff --git a/includes/libs/objectcache/WANObjectCache.php b/includes/libs/objectcache/WANObjectCache.php
index 3ea23c95a81a..fe6e7bb8f179 100644
--- a/includes/libs/objectcache/WANObjectCache.php
+++ b/includes/libs/objectcache/WANObjectCache.php
@@ -1908,7 +1908,7 @@ class WANObjectCache implements
* @param string|null $route Routing prefix (optional)
* @return string[] Order-corresponding list of sister keys
*/
- private function makeSisterKeys( array $baseKeys, string $type, string $route = null ) {
+ private function makeSisterKeys( array $baseKeys, string $type, ?string $route = null ) {
$sisterKeys = [];
foreach ( $baseKeys as $baseKey ) {
$sisterKeys[] = $this->makeSisterKey( $baseKey, $type, $route );
@@ -1927,7 +1927,7 @@ class WANObjectCache implements
* @param string|null $route Routing prefix (optional)
* @return string Sister key
*/
- private function makeSisterKey( string $baseKey, string $typeChar, string $route = null ) {
+ private function makeSisterKey( string $baseKey, string $typeChar, ?string $route = null ) {
if ( $this->coalesceScheme === self::SCHEME_HASH_STOP ) {
// Key style: "WANCache:<base key>|#|<character>"
$sisterKey = 'WANCache:' . $baseKey . '|#|' . $typeChar;
@@ -3013,7 +3013,7 @@ class WANObjectCache implements
* @param array|null &$purge Unwrapped purge value array [returned]
* @return string Wrapped purge value; format is "PURGED:<timestamp>:<holdoff>"
*/
- private function makeCheckPurgeValue( float $timestamp, int $holdoff, array &$purge = null ) {
+ private function makeCheckPurgeValue( float $timestamp, int $holdoff, ?array &$purge = null ) {
$normalizedTime = (int)$timestamp;
// Purge array that matches what parsePurgeValue() would have returned
$purge = [ self::PURGE_TIME => (float)$normalizedTime, self::PURGE_HOLDOFF => $holdoff ];
diff --git a/includes/libs/rdbms/ServerInfo.php b/includes/libs/rdbms/ServerInfo.php
index 2b68567db7a9..5de1d6c189dc 100644
--- a/includes/libs/rdbms/ServerInfo.php
+++ b/includes/libs/rdbms/ServerInfo.php
@@ -136,7 +136,7 @@ class ServerInfo {
return $newIndexByServerIndex;
}
- public function normalizeServerMaps( array $servers, array &$indexBySrvName = null ) {
+ public function normalizeServerMaps( array $servers, ?array &$indexBySrvName = null ) {
if ( !$servers ) {
throw new InvalidArgumentException( 'Missing or empty "servers" parameter' );
}
diff --git a/includes/libs/rdbms/database/DBConnRef.php b/includes/libs/rdbms/database/DBConnRef.php
index 63444ecb5c97..98e907853e20 100644
--- a/includes/libs/rdbms/database/DBConnRef.php
+++ b/includes/libs/rdbms/database/DBConnRef.php
@@ -637,7 +637,7 @@ class DBConnRef implements Stringable, IMaintainableDatabase, IDatabaseForOwner
return $this->__call( __FUNCTION__, func_get_args() );
}
- public function setTransactionListener( $name, callable $callback = null ) {
+ public function setTransactionListener( $name, ?callable $callback = null ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
@@ -653,7 +653,7 @@ class DBConnRef implements Stringable, IMaintainableDatabase, IDatabaseForOwner
return $this->__call( __FUNCTION__, func_get_args() );
}
- public function cancelAtomic( $fname = __METHOD__, AtomicSectionIdentifier $sectionId = null ) {
+ public function cancelAtomic( $fname = __METHOD__, ?AtomicSectionIdentifier $sectionId = null ) {
// Don't call assertRoleAllowsWrites(); caller might want a REPEATABLE-READ snapshot
return $this->__call( __FUNCTION__, func_get_args() );
}
@@ -789,10 +789,10 @@ class DBConnRef implements Stringable, IMaintainableDatabase, IDatabaseForOwner
public function sourceFile(
$filename,
- callable $lineCallback = null,
- callable $resultCallback = null,
+ ?callable $lineCallback = null,
+ ?callable $resultCallback = null,
$fname = false,
- callable $inputCallback = null
+ ?callable $inputCallback = null
) {
$this->assertRoleAllowsWrites();
@@ -801,10 +801,10 @@ class DBConnRef implements Stringable, IMaintainableDatabase, IDatabaseForOwner
public function sourceStream(
$fp,
- callable $lineCallback = null,
- callable $resultCallback = null,
+ ?callable $lineCallback = null,
+ ?callable $resultCallback = null,
$fname = __METHOD__,
- callable $inputCallback = null
+ ?callable $inputCallback = null
) {
$this->assertRoleAllowsWrites();
diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php
index 17ff248f3a5d..b36650d683f5 100644
--- a/includes/libs/rdbms/database/Database.php
+++ b/includes/libs/rdbms/database/Database.php
@@ -1970,7 +1970,7 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD
$this->transactionManager->onAtomicSectionCancel( $this, $callback, $fname );
}
- final public function setTransactionListener( $name, callable $callback = null ) {
+ final public function setTransactionListener( $name, ?callable $callback = null ) {
$this->transactionManager->setTransactionListener( $name, $callback );
}
@@ -2196,7 +2196,7 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD
final public function cancelAtomic(
$fname = __METHOD__,
- AtomicSectionIdentifier $sectionId = null
+ ?AtomicSectionIdentifier $sectionId = null
) {
$this->transactionManager->onCancelAtomicBeforeCriticalSection( $this, $fname );
$pos = $this->transactionManager->getPositionFromSectionId( $sectionId );
@@ -2708,10 +2708,10 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD
public function sourceFile(
$filename,
- callable $lineCallback = null,
- callable $resultCallback = null,
+ ?callable $lineCallback = null,
+ ?callable $resultCallback = null,
$fname = false,
- callable $inputCallback = null
+ ?callable $inputCallback = null
) {
AtEase::suppressWarnings();
$fp = fopen( $filename, 'r' );
@@ -2740,10 +2740,10 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD
public function sourceStream(
$fp,
- callable $lineCallback = null,
- callable $resultCallback = null,
+ ?callable $lineCallback = null,
+ ?callable $resultCallback = null,
$fname = __METHOD__,
- callable $inputCallback = null
+ ?callable $inputCallback = null
) {
$delimiterReset = new ScopedCallback(
function ( $delimiter ) {
@@ -3116,7 +3116,7 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD
protected function completeCriticalSection(
string $fname,
?CriticalSectionScope $csm,
- Throwable $trxError = null
+ ?Throwable $trxError = null
) {
if ( $csm !== null ) {
if ( $this->csmId === null ) {
diff --git a/includes/libs/rdbms/database/IDatabase.php b/includes/libs/rdbms/database/IDatabase.php
index eb6c45fab574..8e614a231c56 100644
--- a/includes/libs/rdbms/database/IDatabase.php
+++ b/includes/libs/rdbms/database/IDatabase.php
@@ -774,7 +774,7 @@ interface IDatabase extends IReadableDatabase {
* passing this enables cancellation of unclosed nested sections [optional]
* @throws DBError If an error occurs, {@see query}
*/
- public function cancelAtomic( $fname = __METHOD__, AtomicSectionIdentifier $sectionId = null );
+ public function cancelAtomic( $fname = __METHOD__, ?AtomicSectionIdentifier $sectionId = null );
/**
* Perform an atomic section of reversible SQL statements from a callback
diff --git a/includes/libs/rdbms/database/IDatabaseForOwner.php b/includes/libs/rdbms/database/IDatabaseForOwner.php
index 0e4933c8a6b1..8b36262e1f93 100644
--- a/includes/libs/rdbms/database/IDatabaseForOwner.php
+++ b/includes/libs/rdbms/database/IDatabaseForOwner.php
@@ -47,7 +47,7 @@ interface IDatabaseForOwner extends IDatabase {
* @param callable|null $callback Use null to unset a listener
* @since 1.28
*/
- public function setTransactionListener( $name, callable $callback = null );
+ public function setTransactionListener( $name, ?callable $callback = null );
/**
* @return bool Whether this DB server is running in server-side read-only mode
diff --git a/includes/libs/rdbms/database/IMaintainableDatabase.php b/includes/libs/rdbms/database/IMaintainableDatabase.php
index 2cdf1e755a62..a5aaf543de3a 100644
--- a/includes/libs/rdbms/database/IMaintainableDatabase.php
+++ b/includes/libs/rdbms/database/IMaintainableDatabase.php
@@ -50,10 +50,10 @@ interface IMaintainableDatabase extends IDatabase {
*/
public function sourceFile(
$filename,
- callable $lineCallback = null,
- callable $resultCallback = null,
+ ?callable $lineCallback = null,
+ ?callable $resultCallback = null,
$fname = false,
- callable $inputCallback = null
+ ?callable $inputCallback = null
);
/**
@@ -71,10 +71,10 @@ interface IMaintainableDatabase extends IDatabase {
*/
public function sourceStream(
$fp,
- callable $lineCallback = null,
- callable $resultCallback = null,
+ ?callable $lineCallback = null,
+ ?callable $resultCallback = null,
$fname = __METHOD__,
- callable $inputCallback = null
+ ?callable $inputCallback = null
);
/**
diff --git a/includes/libs/rdbms/database/Query.php b/includes/libs/rdbms/database/Query.php
index 44a06f4179d6..14a51958b9c0 100644
--- a/includes/libs/rdbms/database/Query.php
+++ b/includes/libs/rdbms/database/Query.php
@@ -67,7 +67,7 @@ class Query {
string $sql,
$flags,
$queryVerb,
- string $writeTable = null,
+ ?string $writeTable = null,
$cleanedSql = ''
) {
$this->sql = $sql;
diff --git a/includes/libs/rdbms/database/TransactionManager.php b/includes/libs/rdbms/database/TransactionManager.php
index 1022c46245ed..ba55919967b5 100644
--- a/includes/libs/rdbms/database/TransactionManager.php
+++ b/includes/libs/rdbms/database/TransactionManager.php
@@ -123,7 +123,7 @@ class TransactionManager {
/** @var TransactionProfiler */
private $profiler;
- public function __construct( LoggerInterface $logger = null, $profiler = null ) {
+ public function __construct( ?LoggerInterface $logger = null, $profiler = null ) {
$this->logger = $logger ?? new NullLogger();
$this->profiler = $profiler ?? new TransactionProfiler();
}
@@ -474,7 +474,7 @@ class TransactionManager {
return [ $savepointId, $sectionId ];
}
- public function getPositionFromSectionId( AtomicSectionIdentifier $sectionId = null ): ?int {
+ public function getPositionFromSectionId( ?AtomicSectionIdentifier $sectionId = null ): ?int {
if ( $sectionId !== null ) {
// Find the (last) section with the given $sectionId
$pos = -1;
@@ -622,7 +622,7 @@ class TransactionManager {
];
}
- public function setTransactionListener( $name, callable $callback = null ) {
+ public function setTransactionListener( $name, ?callable $callback = null ) {
if ( $callback ) {
$this->trxRecurringCallbacks[$name] = $callback;
} else {
@@ -691,7 +691,7 @@ class TransactionManager {
*/
public function modifyCallbacksForCancel(
array $excisedSectionsId,
- AtomicSectionIdentifier $newSectionId = null
+ ?AtomicSectionIdentifier $newSectionId = null
) {
// Cancel the "on commit" callbacks owned by this savepoint
$this->trxPostCommitOrIdleCallbacks = array_filter(
diff --git a/includes/libs/rdbms/exception/DBConnectionError.php b/includes/libs/rdbms/exception/DBConnectionError.php
index 0ee2542f13c6..c3c8eda2e5b3 100644
--- a/includes/libs/rdbms/exception/DBConnectionError.php
+++ b/includes/libs/rdbms/exception/DBConnectionError.php
@@ -29,7 +29,7 @@ class DBConnectionError extends DBExpectedError {
* @param IDatabase|null $db Object throwing the error
* @param string $error Error text
*/
- public function __construct( IDatabase $db = null, $error = 'unknown error' ) {
+ public function __construct( ?IDatabase $db = null, $error = 'unknown error' ) {
$msg = 'Cannot access the database';
if ( trim( $error ) != '' ) {
$msg .= ": $error";
diff --git a/includes/libs/rdbms/exception/DBError.php b/includes/libs/rdbms/exception/DBError.php
index dae50a39cbf3..f791bc77a342 100644
--- a/includes/libs/rdbms/exception/DBError.php
+++ b/includes/libs/rdbms/exception/DBError.php
@@ -44,7 +44,7 @@ class DBError extends RuntimeException {
* @param string $error A simple error message to be used for debugging
* @param \Throwable|null $prev Previous throwable
*/
- public function __construct( ?IDatabase $db, $error, \Throwable $prev = null ) {
+ public function __construct( ?IDatabase $db, $error, ?\Throwable $prev = null ) {
parent::__construct( $error, 0, $prev );
$this->db = $db;
}
diff --git a/includes/libs/rdbms/exception/DBExpectedError.php b/includes/libs/rdbms/exception/DBExpectedError.php
index b3ddfe2e88ab..4397fc293da9 100644
--- a/includes/libs/rdbms/exception/DBExpectedError.php
+++ b/includes/libs/rdbms/exception/DBExpectedError.php
@@ -41,7 +41,7 @@ class DBExpectedError extends DBError implements MessageSpecifier {
* @param \Throwable|null $prev
*/
public function __construct(
- ?IDatabase $db, $error, array $params = [], \Throwable $prev = null
+ ?IDatabase $db, $error, array $params = [], ?\Throwable $prev = null
) {
parent::__construct( $db, $error, $prev );
$this->params = $params;
diff --git a/includes/libs/rdbms/exception/DBLanguageError.php b/includes/libs/rdbms/exception/DBLanguageError.php
index 328e2a8fafd3..3b6a620a18ac 100644
--- a/includes/libs/rdbms/exception/DBLanguageError.php
+++ b/includes/libs/rdbms/exception/DBLanguageError.php
@@ -27,7 +27,7 @@ use Throwable;
* @ingroup Database
*/
class DBLanguageError extends DBUnexpectedError {
- public function __construct( $error, Throwable $prev = null ) {
+ public function __construct( $error, ?Throwable $prev = null ) {
parent::__construct( null, $error, $prev );
}
}
diff --git a/includes/libs/rdbms/exception/DBTransactionError.php b/includes/libs/rdbms/exception/DBTransactionError.php
index 253faa421012..c8ec8adffe4f 100644
--- a/includes/libs/rdbms/exception/DBTransactionError.php
+++ b/includes/libs/rdbms/exception/DBTransactionError.php
@@ -39,7 +39,7 @@ class DBTransactionError extends DBExpectedError implements INormalizedException
* @param array $errorParams PSR-3 message context
*/
public function __construct(
- ?IDatabase $db, $error, array $params = [], \Throwable $prev = null, $errorParams = []
+ ?IDatabase $db, $error, array $params = [], ?\Throwable $prev = null, $errorParams = []
) {
$this->normalizedMessage = $error;
$this->messageContext = $errorParams;
diff --git a/includes/libs/rdbms/lbfactory/ILBFactory.php b/includes/libs/rdbms/lbfactory/ILBFactory.php
index ad3b3702660f..96427524e307 100644
--- a/includes/libs/rdbms/lbfactory/ILBFactory.php
+++ b/includes/libs/rdbms/lbfactory/ILBFactory.php
@@ -237,7 +237,7 @@ interface ILBFactory extends IConnectionProvider {
*/
public function shutdown(
$flags = self::SHUTDOWN_NORMAL,
- callable $workCallback = null,
+ ?callable $workCallback = null,
&$cpIndex = null,
&$cpClientId = null
);
@@ -383,7 +383,7 @@ interface ILBFactory extends IConnectionProvider {
* @param string $name Callback name
* @param callable|null $callback Use null to unset a callback
*/
- public function setWaitForReplicationListener( $name, callable $callback = null );
+ public function setWaitForReplicationListener( $name, ?callable $callback = null );
/**
* Disable the ChronologyProtector on all instantiated tracked load balancer instances
diff --git a/includes/libs/rdbms/lbfactory/LBFactory.php b/includes/libs/rdbms/lbfactory/LBFactory.php
index ca6910d4cf70..c53d5091fe26 100644
--- a/includes/libs/rdbms/lbfactory/LBFactory.php
+++ b/includes/libs/rdbms/lbfactory/LBFactory.php
@@ -228,7 +228,7 @@ abstract class LBFactory implements ILBFactory {
public function shutdown(
$flags = self::SHUTDOWN_NORMAL,
- callable $workCallback = null,
+ ?callable $workCallback = null,
&$cpIndex = null,
&$cpClientId = null
) {
@@ -498,7 +498,7 @@ abstract class LBFactory implements ILBFactory {
return !$failed;
}
- public function setWaitForReplicationListener( $name, callable $callback = null ) {
+ public function setWaitForReplicationListener( $name, ?callable $callback = null ) {
if ( $callback ) {
$this->replicationWaitCallbacks[$name] = $callback;
} else {
diff --git a/includes/libs/rdbms/loadbalancer/ILoadBalancer.php b/includes/libs/rdbms/loadbalancer/ILoadBalancer.php
index 2d3165d5049b..1725d9fbd939 100644
--- a/includes/libs/rdbms/loadbalancer/ILoadBalancer.php
+++ b/includes/libs/rdbms/loadbalancer/ILoadBalancer.php
@@ -472,7 +472,7 @@ interface ILoadBalancer {
* @param string $name Callback name
* @param callable|null $callback
*/
- public function setTransactionListener( $name, callable $callback = null );
+ public function setTransactionListener( $name, ?callable $callback = null );
/**
* Make certain table names use their own database, schema, and table prefix
diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php b/includes/libs/rdbms/loadbalancer/LoadBalancer.php
index c779f061b82b..7d30e2a8d457 100644
--- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php
+++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php
@@ -1754,7 +1754,7 @@ class LoadBalancer implements ILoadBalancerForOwner {
* @param IDatabaseForOwner|null $conn Recently acquired primary connection; null if not applicable
* @return bool Whether the entire primary DB server or the local domain DB is read-only
*/
- private function isPrimaryRunningReadOnly( IDatabaseForOwner $conn = null ) {
+ private function isPrimaryRunningReadOnly( ?IDatabaseForOwner $conn = null ) {
// Context will often be HTTP GET/HEAD; heavily cache the results
return (bool)$this->wanCache->getWithSetCallback(
// Note that table prefixes are not related to server-side read-only mode
@@ -1921,7 +1921,7 @@ class LoadBalancer implements ILoadBalancerForOwner {
return $ok;
}
- public function setTransactionListener( $name, callable $callback = null ) {
+ public function setTransactionListener( $name, ?callable $callback = null ) {
if ( $callback ) {
$this->trxRecurringCallbacks[$name] = $callback;
} else {
diff --git a/includes/libs/rdbms/platform/SQLPlatform.php b/includes/libs/rdbms/platform/SQLPlatform.php
index 8dbfdbee2a1a..563a9d920062 100644
--- a/includes/libs/rdbms/platform/SQLPlatform.php
+++ b/includes/libs/rdbms/platform/SQLPlatform.php
@@ -62,8 +62,8 @@ class SQLPlatform implements ISQLPlatform {
public function __construct(
DbQuoter $quoter,
- LoggerInterface $logger = null,
- DatabaseDomain $currentDomain = null,
+ ?LoggerInterface $logger = null,
+ ?DatabaseDomain $currentDomain = null,
$errorLogger = null
) {
diff --git a/includes/libs/redis/RedisConnectionPool.php b/includes/libs/redis/RedisConnectionPool.php
index 495a4e366149..709d6967e8bd 100644
--- a/includes/libs/redis/RedisConnectionPool.php
+++ b/includes/libs/redis/RedisConnectionPool.php
@@ -183,7 +183,7 @@ class RedisConnectionPool implements LoggerAwareInterface {
* @return RedisConnRef|Redis|false Returns false on failure
* @throws InvalidArgumentException
*/
- public function getConnection( $server, LoggerInterface $logger = null ) {
+ public function getConnection( $server, ?LoggerInterface $logger = null ) {
// The above @return also documents 'Redis' for convenience with IDEs.
// RedisConnRef uses PHP magic methods, which wouldn't be recognised.
diff --git a/includes/linker/Linker.php b/includes/linker/Linker.php
index b1237695d7cd..e320c61f0715 100644
--- a/includes/linker/Linker.php
+++ b/includes/linker/Linker.php
@@ -1690,7 +1690,7 @@ class Linker {
*/
public static function generateRollback(
RevisionRecord $revRecord,
- IContextSource $context = null,
+ ?IContextSource $context = null,
$options = []
) {
$context ??= RequestContext::getMain();
@@ -1813,7 +1813,7 @@ class Linker {
*/
public static function buildRollbackLink(
RevisionRecord $revRecord,
- IContextSource $context = null,
+ ?IContextSource $context = null,
$editCount = false
) {
$config = MediaWikiServices::getInstance()->getMainConfig();
diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php
index 185c96c70ce3..f521bf7d385d 100644
--- a/includes/logging/LogEventsList.php
+++ b/includes/logging/LogEventsList.php
@@ -759,7 +759,7 @@ class LogEventsList extends ContextSource {
* @return string|false String on success, false on failure.
* @throws InvalidArgumentException
*/
- public static function getExcludeClause( $db, $audience = 'public', Authority $performer = null ) {
+ public static function getExcludeClause( $db, $audience = 'public', ?Authority $performer = null ) {
$logRestrictions = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::LogRestrictions );
if ( $audience != 'public' && $performer === null ) {
diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php
index 2841b15a964b..3a5b3cced6aa 100644
--- a/includes/logging/LogFormatter.php
+++ b/includes/logging/LogFormatter.php
@@ -759,7 +759,7 @@ class LogFormatter {
* @return string wikitext or html
* @return-taint onlysafefor_html
*/
- protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
+ protected function makePageLink( ?Title $title = null, $parameters = [], $html = null ) {
if ( !$title instanceof Title ) {
$msg = $this->msg( 'invalidtitle' )->text();
if ( $this->plaintext ) {
diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php
index 832b5669099c..699df9c3420e 100644
--- a/includes/logging/LogPager.php
+++ b/includes/logging/LogPager.php
@@ -106,9 +106,9 @@ class LogPager extends ReverseChronologicalPager {
public function __construct( $list, $types = [], $performer = '', $page = '',
$pattern = false, $conds = [], $year = false, $month = false, $day = false,
$tagFilter = '', $action = '', $logId = 0,
- LinkBatchFactory $linkBatchFactory = null,
- ActorNormalization $actorNormalization = null,
- LogFormatterFactory $logFormatterFactory = null,
+ ?LinkBatchFactory $linkBatchFactory = null,
+ ?ActorNormalization $actorNormalization = null,
+ ?LogFormatterFactory $logFormatterFactory = null,
$tagInvert = false
) {
parent::__construct( $list->getContext() );
diff --git a/includes/logging/ManualLogEntry.php b/includes/logging/ManualLogEntry.php
index b6113e85bd0a..bbb355734f52 100644
--- a/includes/logging/ManualLogEntry.php
+++ b/includes/logging/ManualLogEntry.php
@@ -291,7 +291,7 @@ class ManualLogEntry extends LogEntryBase implements Taggable {
* @param IDatabase|null $dbw
* @return int ID of the log entry
*/
- public function insert( IDatabase $dbw = null ) {
+ public function insert( ?IDatabase $dbw = null ) {
$services = MediaWikiServices::getInstance();
$dbw = $dbw ?: $services->getConnectionProvider()->getPrimaryDatabase();
diff --git a/includes/logging/RightsLogFormatter.php b/includes/logging/RightsLogFormatter.php
index 840f1b7c9e03..0f623ba28b68 100644
--- a/includes/logging/RightsLogFormatter.php
+++ b/includes/logging/RightsLogFormatter.php
@@ -34,7 +34,7 @@ use MediaWiki\WikiMap\WikiMap;
* @since 1.21
*/
class RightsLogFormatter extends LogFormatter {
- protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
+ protected function makePageLink( ?Title $title = null, $parameters = [], $html = null ) {
$userrightsInterwikiDelimiter = $this->context->getConfig()
->get( MainConfigNames::UserrightsInterwikiDelimiter );
diff --git a/includes/mail/EmailUserFactory.php b/includes/mail/EmailUserFactory.php
index 920a20bf9539..903cbaa4dfe3 100644
--- a/includes/mail/EmailUserFactory.php
+++ b/includes/mail/EmailUserFactory.php
@@ -105,7 +105,7 @@ class EmailUserFactory {
* @param Config|null $config
* @return EmailUser
*/
- public function newEmailUserBC( Authority $sender, Config $config = null ): EmailUser {
+ public function newEmailUserBC( Authority $sender, ?Config $config = null ): EmailUser {
$options = $config ? new ServiceOptions( EmailUser::CONSTRUCTOR_OPTIONS, $config ) : $this->options;
return new EmailUser(
$options,
diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php
index 708938fa60b9..d756847e7f12 100644
--- a/includes/objectcache/SqlBagOStuff.php
+++ b/includes/objectcache/SqlBagOStuff.php
@@ -1366,9 +1366,9 @@ class SqlBagOStuff extends MediumSpecificBagOStuff {
public function deleteObjectsExpiringBefore(
$timestamp,
- callable $progress = null,
+ ?callable $progress = null,
$limit = INF,
- string $tag = null
+ ?string $tag = null
) {
/** @noinspection PhpUnusedLocalVariableInspection */
$silenceScope = $this->silenceTransactionProfiler();
@@ -1439,7 +1439,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff {
$timestamp,
$limit,
&$keysDeletedCount = 0,
- array $progress = null
+ ?array $progress = null
) {
$cutoffUnix = ConvertibleTimestamp::convert( TS_UNIX, $timestamp );
if ( $this->multiPrimaryMode ) {
diff --git a/includes/page/Article.php b/includes/page/Article.php
index 1937abac9fed..3ae618bc5220 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -1092,7 +1092,7 @@ class Article implements Page {
* @return string[] The policy that should be set
* @todo actions other than 'view'
*/
- public function getRobotPolicy( $action, ParserOutput $pOutput = null ) {
+ public function getRobotPolicy( $action, ?ParserOutput $pOutput = null ) {
$context = $this->getContext();
$mainConfig = $context->getConfig();
$articleRobotPolicies = $mainConfig->get( MainConfigNames::ArticleRobotPolicies );
@@ -2011,7 +2011,7 @@ class Article implements Page {
* @param UserIdentity|null $user The relevant user
* @return ParserOutput|false ParserOutput or false if the given revision ID is not found
*/
- public function getParserOutput( $oldid = null, UserIdentity $user = null ) {
+ public function getParserOutput( $oldid = null, ?UserIdentity $user = null ) {
if ( $user === null ) {
$parserOptions = $this->getParserOptions();
} else {
diff --git a/includes/page/File/BadFileLookup.php b/includes/page/File/BadFileLookup.php
index 49bedd374bee..90abb84ffdd9 100644
--- a/includes/page/File/BadFileLookup.php
+++ b/includes/page/File/BadFileLookup.php
@@ -58,7 +58,7 @@ class BadFileLookup {
* @param LinkTarget|null $contextTitle The page on which the file occurs, if known
* @return bool
*/
- public function isBadFile( $name, LinkTarget $contextTitle = null ) {
+ public function isBadFile( $name, ?LinkTarget $contextTitle = null ) {
// Handle redirects; callers almost always hit RepoGroup::findFile() anyway,
// so just use that method because it has a fast process cache.
$file = $this->repoGroup->findFile( $name );
diff --git a/includes/page/ImageHistoryPseudoPager.php b/includes/page/ImageHistoryPseudoPager.php
index 24b8a5ffec40..254191f40b18 100644
--- a/includes/page/ImageHistoryPseudoPager.php
+++ b/includes/page/ImageHistoryPseudoPager.php
@@ -65,7 +65,7 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
* @param ImagePage $imagePage
* @param LinkBatchFactory|null $linkBatchFactory
*/
- public function __construct( $imagePage, LinkBatchFactory $linkBatchFactory = null ) {
+ public function __construct( $imagePage, ?LinkBatchFactory $linkBatchFactory = null ) {
parent::__construct( $imagePage->getContext() );
$this->mImagePage = $imagePage;
$this->mTitle = $imagePage->getTitle()->createFragmentTarget( 'filehistory' );
diff --git a/includes/page/MergeHistory.php b/includes/page/MergeHistory.php
index eeee0ab6f03e..fa0666ca44d2 100644
--- a/includes/page/MergeHistory.php
+++ b/includes/page/MergeHistory.php
@@ -228,7 +228,7 @@ class MergeHistory {
* @param string|null $reason
* @return PermissionStatus
*/
- public function probablyCanMerge( Authority $performer, string $reason = null ): PermissionStatus {
+ public function probablyCanMerge( Authority $performer, ?string $reason = null ): PermissionStatus {
return $this->authorizeInternal(
static function ( string $action, PageIdentity $target, PermissionStatus $status ) use ( $performer ) {
return $performer->probablyCan( $action, $target, $status );
@@ -249,7 +249,7 @@ class MergeHistory {
* @param string|null $reason
* @return PermissionStatus
*/
- public function authorizeMerge( Authority $performer, string $reason = null ): PermissionStatus {
+ public function authorizeMerge( Authority $performer, ?string $reason = null ): PermissionStatus {
return $this->authorizeInternal(
static function ( string $action, PageIdentity $target, PermissionStatus $status ) use ( $performer ) {
return $performer->authorizeWrite( $action, $target, $status );
diff --git a/includes/page/MergeHistoryFactory.php b/includes/page/MergeHistoryFactory.php
index 70b9aa89e6ce..5a95442e2d10 100644
--- a/includes/page/MergeHistoryFactory.php
+++ b/includes/page/MergeHistoryFactory.php
@@ -39,6 +39,6 @@ interface MergeHistoryFactory {
public function newMergeHistory(
PageIdentity $source,
PageIdentity $destination,
- string $timestamp = null
+ ?string $timestamp = null
): MergeHistory;
}
diff --git a/includes/page/MovePage.php b/includes/page/MovePage.php
index fe785a7174aa..14027ce107ed 100644
--- a/includes/page/MovePage.php
+++ b/includes/page/MovePage.php
@@ -209,7 +209,7 @@ class MovePage {
* @param string|null $reason
* @return PermissionStatus
*/
- public function probablyCanMove( Authority $performer, string $reason = null ): PermissionStatus {
+ public function probablyCanMove( Authority $performer, ?string $reason = null ): PermissionStatus {
return $this->authorizeInternal(
static function ( string $action, PageIdentity $target, PermissionStatus $status ) use ( $performer ) {
return $performer->probablyCan( $action, $target, $status );
@@ -230,7 +230,7 @@ class MovePage {
* @param string|null $reason
* @return PermissionStatus
*/
- public function authorizeMove( Authority $performer, string $reason = null ): PermissionStatus {
+ public function authorizeMove( Authority $performer, ?string $reason = null ): PermissionStatus {
return $this->authorizeInternal(
static function ( string $action, PageIdentity $target, PermissionStatus $status ) use ( $performer ) {
return $performer->authorizeWrite( $action, $target, $status );
diff --git a/includes/page/PageAssertionException.php b/includes/page/PageAssertionException.php
index efd2b432e5e4..c4b0bc8a1e09 100644
--- a/includes/page/PageAssertionException.php
+++ b/includes/page/PageAssertionException.php
@@ -46,7 +46,7 @@ class PageAssertionException extends InvalidArgumentException implements INormal
string $normalizedMessage = '',
array $messageContext = [],
int $code = 0,
- Throwable $previous = null
+ ?Throwable $previous = null
) {
$this->normalizedMessage = $normalizedMessage;
$this->messageContext = $messageContext;
diff --git a/includes/page/PageCommandFactory.php b/includes/page/PageCommandFactory.php
index 353001bd889d..a64b0b9444f2 100644
--- a/includes/page/PageCommandFactory.php
+++ b/includes/page/PageCommandFactory.php
@@ -228,7 +228,7 @@ class PageCommandFactory implements
public function newMergeHistory(
PageIdentity $source,
PageIdentity $destination,
- string $timestamp = null
+ ?string $timestamp = null
): MergeHistory {
return new MergeHistory(
$source,
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 91dfb5ada7c8..12d78c27ddd1 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -766,7 +766,7 @@ class WikiPage implements Stringable, Page, PageRecord {
*
* @since 1.21
*/
- public function getContent( $audience = RevisionRecord::FOR_PUBLIC, Authority $performer = null ) {
+ public function getContent( $audience = RevisionRecord::FOR_PUBLIC, ?Authority $performer = null ) {
$this->loadLastEdit();
if ( $this->mLastRevision ) {
return $this->mLastRevision->getContent( SlotRecord::MAIN, $audience, $performer );
@@ -805,7 +805,7 @@ class WikiPage implements Stringable, Page, PageRecord {
* a user no fallback is provided and the RevisionRecord method will throw an error)
* @return int User ID for the user that made the last article revision
*/
- public function getUser( $audience = RevisionRecord::FOR_PUBLIC, Authority $performer = null ) {
+ public function getUser( $audience = RevisionRecord::FOR_PUBLIC, ?Authority $performer = null ) {
$this->loadLastEdit();
if ( $this->mLastRevision ) {
$revUser = $this->mLastRevision->getUser( $audience, $performer );
@@ -826,7 +826,7 @@ class WikiPage implements Stringable, Page, PageRecord {
* a user no fallback is provided and the RevisionRecord method will throw an error)
* @return UserIdentity|null
*/
- public function getCreator( $audience = RevisionRecord::FOR_PUBLIC, Authority $performer = null ) {
+ public function getCreator( $audience = RevisionRecord::FOR_PUBLIC, ?Authority $performer = null ) {
$revRecord = $this->getRevisionStore()->getFirstRevision( $this->getTitle() );
if ( $revRecord ) {
return $revRecord->getUser( $audience, $performer );
@@ -845,7 +845,7 @@ class WikiPage implements Stringable, Page, PageRecord {
* a user no fallback is provided and the RevisionRecord method will throw an error)
* @return string Username of the user that made the last article revision
*/
- public function getUserText( $audience = RevisionRecord::FOR_PUBLIC, Authority $performer = null ) {
+ public function getUserText( $audience = RevisionRecord::FOR_PUBLIC, ?Authority $performer = null ) {
$this->loadLastEdit();
if ( $this->mLastRevision ) {
$revUser = $this->mLastRevision->getUser( $audience, $performer );
@@ -866,7 +866,7 @@ class WikiPage implements Stringable, Page, PageRecord {
* @return string|null Comment stored for the last article revision, or null if the specified
* audience does not have access to the comment.
*/
- public function getComment( $audience = RevisionRecord::FOR_PUBLIC, Authority $performer = null ) {
+ public function getComment( $audience = RevisionRecord::FOR_PUBLIC, ?Authority $performer = null ) {
$this->loadLastEdit();
if ( $this->mLastRevision ) {
$revComment = $this->mLastRevision->getComment( $audience, $performer );
@@ -1139,7 +1139,7 @@ class WikiPage implements Stringable, Page, PageRecord {
public function doViewUpdates(
Authority $performer,
$oldid = 0,
- RevisionRecord $oldRev = null
+ ?RevisionRecord $oldRev = null
) {
if ( MediaWikiServices::getInstance()->getReadOnlyMode()->isReadOnly() ) {
return;
@@ -1501,9 +1501,9 @@ class WikiPage implements Stringable, Page, PageRecord {
* @return DerivedPageDataUpdater
*/
private function getDerivedDataUpdater(
- UserIdentity $forUser = null,
- RevisionRecord $forRevision = null,
- RevisionSlotsUpdate $forUpdate = null,
+ ?UserIdentity $forUser = null,
+ ?RevisionRecord $forRevision = null,
+ ?RevisionSlotsUpdate $forUpdate = null,
$forEdit = false
) {
if ( !$forRevision && !$forUpdate ) {
@@ -1562,7 +1562,7 @@ class WikiPage implements Stringable, Page, PageRecord {
*
* @return PageUpdater
*/
- public function newPageUpdater( $performer, RevisionSlotsUpdate $forUpdate = null ) {
+ public function newPageUpdater( $performer, ?RevisionSlotsUpdate $forUpdate = null ) {
if ( $performer instanceof Authority ) {
// TODO: Deprecate this. But better get rid of this method entirely.
$performer = $performer->getUser();
@@ -2562,7 +2562,7 @@ class WikiPage implements Stringable, Page, PageRecord {
*/
public static function onArticleEdit(
Title $title,
- RevisionRecord $revRecord = null,
+ ?RevisionRecord $revRecord = null,
$slotsChanged = null,
$maybeRedirectChanged = true
) {
diff --git a/includes/pager/IndexPager.php b/includes/pager/IndexPager.php
index e47cb9d12334..2ab89214e3de 100644
--- a/includes/pager/IndexPager.php
+++ b/includes/pager/IndexPager.php
@@ -178,7 +178,7 @@ abstract class IndexPager extends ContextSource implements Pager {
* @param IContextSource|null $context
* @param LinkRenderer|null $linkRenderer
*/
- public function __construct( IContextSource $context = null, LinkRenderer $linkRenderer = null ) {
+ public function __construct( ?IContextSource $context = null, ?LinkRenderer $linkRenderer = null ) {
if ( $context ) {
$this->setContext( $context );
}
@@ -642,7 +642,7 @@ abstract class IndexPager extends ContextSource implements Pager {
* "title". Valid values (non-exhaustive list): 'first', 'last', 'prev', 'next', 'asc', 'desc'.
* @return string HTML fragment
*/
- protected function makeLink( $text, array $query = null, $type = null ) {
+ protected function makeLink( $text, ?array $query = null, $type = null ) {
$attrs = [];
if ( $query !== null && in_array( $type, [ 'prev', 'next' ] ) ) {
$attrs['rel'] = $type;
diff --git a/includes/pager/TablePager.php b/includes/pager/TablePager.php
index 4f481804e442..f206afd6654b 100644
--- a/includes/pager/TablePager.php
+++ b/includes/pager/TablePager.php
@@ -48,7 +48,7 @@ abstract class TablePager extends IndexPager {
* @param IContextSource|null $context
* @param LinkRenderer|null $linkRenderer
*/
- public function __construct( IContextSource $context = null, LinkRenderer $linkRenderer = null ) {
+ public function __construct( ?IContextSource $context = null, ?LinkRenderer $linkRenderer = null ) {
if ( $context ) {
$this->setContext( $context );
}
diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php
index 444b1727672f..fedc5b461343 100644
--- a/includes/parser/CoreParserFunctions.php
+++ b/includes/parser/CoreParserFunctions.php
@@ -595,7 +595,7 @@ class CoreParserFunctions {
* @return string
*/
public static function formatRaw(
- $num, $raw, $language, MagicWordFactory $magicWordFactory = null
+ $num, $raw, $language, ?MagicWordFactory $magicWordFactory = null
) {
if ( $raw !== null && $raw !== '' ) {
if ( !$magicWordFactory ) {
diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php
index 0bb63f19281a..969cc5c7f24b 100644
--- a/includes/parser/DateFormatter.php
+++ b/includes/parser/DateFormatter.php
@@ -165,7 +165,7 @@ class DateFormatter {
* Defaults to the site content language
* @return DateFormatter
*/
- public static function getInstance( Language $lang = null ) {
+ public static function getInstance( ?Language $lang = null ) {
$lang ??= MediaWikiServices::getInstance()->getContentLanguage();
return MediaWikiServices::getInstance()->getDateFormatterFactory()->get( $lang );
}
diff --git a/includes/parser/MagicWord.php b/includes/parser/MagicWord.php
index 027fe81671f1..b21f3a42c0cf 100644
--- a/includes/parser/MagicWord.php
+++ b/includes/parser/MagicWord.php
@@ -84,7 +84,7 @@ class MagicWord {
* @param bool $cs If magic word is case sensitive
* @param Language|null $contentLanguage
*/
- public function __construct( $id = null, $syn = [], $cs = false, Language $contentLanguage = null ) {
+ public function __construct( $id = null, $syn = [], $cs = false, ?Language $contentLanguage = null ) {
$this->mId = $id;
$this->mSynonyms = (array)$syn;
$this->mCaseSensitive = $cs;
diff --git a/includes/parser/MagicWordArray.php b/includes/parser/MagicWordArray.php
index d6bd7c05afc1..8b0d007820fc 100644
--- a/includes/parser/MagicWordArray.php
+++ b/includes/parser/MagicWordArray.php
@@ -51,7 +51,7 @@ class MagicWordArray {
* @param string[] $names
* @param MagicWordFactory|null $factory
*/
- public function __construct( $names = [], MagicWordFactory $factory = null ) {
+ public function __construct( $names = [], ?MagicWordFactory $factory = null ) {
$this->names = $names;
$this->factory = $factory ?: MediaWikiServices::getInstance()->getMagicWordFactory();
}
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index c598e65b1a99..dae0be83d8c4 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -1001,7 +1001,7 @@ class Parser {
* @param Title|null $t
* @since 1.12
*/
- public function setTitle( Title $t = null ) {
+ public function setTitle( ?Title $t = null ) {
$this->setPage( $t );
}
@@ -2251,7 +2251,7 @@ class Parser {
* @param LinkTarget|null $title Optional LinkTarget, for wgNoFollowNsExceptions lookups
* @return string|null Rel attribute for $url
*/
- public static function getExternalLinkRel( $url = false, LinkTarget $title = null ) {
+ public static function getExternalLinkRel( $url = false, ?LinkTarget $title = null ) {
$mainConfig = MediaWikiServices::getInstance()->getMainConfig();
$noFollowLinks = $mainConfig->get( MainConfigNames::NoFollowLinks );
$noFollowNsExceptions = $mainConfig->get( MainConfigNames::NoFollowNsExceptions );
diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php
index 9178e073da62..71fe4da361a9 100644
--- a/includes/parser/ParserCache.php
+++ b/includes/parser/ParserCache.php
@@ -341,7 +341,7 @@ class ParserCache {
public function makeParserOutputKey(
PageRecord $page,
ParserOptions $options,
- array $usedOptions = null
+ ?array $usedOptions = null
): string {
$usedOptions ??= ParserOptions::allCacheVaryingOptions();
// idhash seem to mean 'page id' + 'rendering hash' (r3710)
diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php
index a11e94f155bd..55a11da62519 100644
--- a/includes/parser/ParserOptions.php
+++ b/includes/parser/ParserOptions.php
@@ -1505,7 +1505,7 @@ class ParserOptions {
* @return bool
* @since 1.30
*/
- public function isSafeToCache( array $usedOptions = null ) {
+ public function isSafeToCache( ?array $usedOptions = null ) {
$defaults = self::getDefaults();
$inCacheKey = self::getCacheVaryingOptionsHash();
$usedOptions ??= array_keys( $this->options );
diff --git a/includes/parser/Preprocessor.php b/includes/parser/Preprocessor.php
index 5fa8ca76d685..47d75eca67f1 100644
--- a/includes/parser/Preprocessor.php
+++ b/includes/parser/Preprocessor.php
@@ -78,7 +78,7 @@ abstract class Preprocessor {
*/
public function __construct(
Parser $parser,
- WANObjectCache $wanCache = null,
+ ?WANObjectCache $wanCache = null,
array $options = []
) {
$this->parser = $parser;
diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php
index 34f63f92e5b2..afc5339fc5e9 100644
--- a/includes/parser/Preprocessor_Hash.php
+++ b/includes/parser/Preprocessor_Hash.php
@@ -60,7 +60,7 @@ class Preprocessor_Hash extends Preprocessor {
*/
public function __construct(
Parser $parser,
- WANObjectCache $wanCache = null,
+ ?WANObjectCache $wanCache = null,
array $options = []
) {
parent::__construct( $parser, $wanCache, $options );
diff --git a/includes/parser/RevisionOutputCache.php b/includes/parser/RevisionOutputCache.php
index 4ac71df853fb..d1223451e126 100644
--- a/includes/parser/RevisionOutputCache.php
+++ b/includes/parser/RevisionOutputCache.php
@@ -107,7 +107,7 @@ class RevisionOutputCache {
* @param string $status e.g. hit, miss etc.
* @param string|null $reason
*/
- private function incrementStats( string $status, string $reason = null ) {
+ private function incrementStats( string $status, ?string $reason = null ) {
$metricSuffix = $reason ? "{$status}_{$reason}" : $status;
$this->stats->getCounter( 'RevisionOutputCache_operation_total' )
@@ -139,7 +139,7 @@ class RevisionOutputCache {
public function makeParserOutputKey(
RevisionRecord $revision,
ParserOptions $options,
- array $usedOptions = null
+ ?array $usedOptions = null
): string {
$usedOptions = ParserOptions::allCacheVaryingOptions();
@@ -172,7 +172,7 @@ class RevisionOutputCache {
public function makeParserOutputKeyOptionalRevId(
RevisionRecord $revision,
ParserOptions $options,
- array $usedOptions = null
+ ?array $usedOptions = null
): string {
$usedOptions = ParserOptions::allCacheVaryingOptions();
@@ -240,7 +240,7 @@ class RevisionOutputCache {
ParserOutput $output,
RevisionRecord $revision,
ParserOptions $parserOptions,
- string $cacheTime = null
+ ?string $cacheTime = null
) {
if ( !$output->hasText() ) {
throw new InvalidArgumentException( 'Attempt to cache a ParserOutput with no text set!' );
diff --git a/includes/parser/StripState.php b/includes/parser/StripState.php
index 354cbfd40555..9d4374481d95 100644
--- a/includes/parser/StripState.php
+++ b/includes/parser/StripState.php
@@ -59,7 +59,7 @@ class StripState {
* @param Parser|null $parser
* @param array $options
*/
- public function __construct( Parser $parser = null, $options = [] ) {
+ public function __construct( ?Parser $parser = null, $options = [] ) {
$this->data = [
'nowiki' => [],
'general' => []
diff --git a/includes/password/Password.php b/includes/password/Password.php
index 3fa6df63247b..18f18dc25b7d 100644
--- a/includes/password/Password.php
+++ b/includes/password/Password.php
@@ -96,7 +96,7 @@ abstract class Password {
* @param array $config Array of engine configuration options for hashing
* @param string|null $hash The raw hash, including the type
*/
- final public function __construct( PasswordFactory $factory, array $config, string $hash = null ) {
+ final public function __construct( PasswordFactory $factory, array $config, ?string $hash = null ) {
if ( !$this->isSupported() ) {
throw new RuntimeException( 'PHP support not found for ' . get_class( $this ) );
}
diff --git a/includes/password/PasswordFactory.php b/includes/password/PasswordFactory.php
index b35658f8bff2..1de40fe546ea 100644
--- a/includes/password/PasswordFactory.php
+++ b/includes/password/PasswordFactory.php
@@ -204,7 +204,7 @@ final class PasswordFactory {
* @param Password|null $existing Optional existing hash to get options from
* @return Password
*/
- public function newFromPlaintext( ?string $password, Password $existing = null ): Password {
+ public function newFromPlaintext( ?string $password, ?Password $existing = null ): Password {
if ( $password === null ) {
return new InvalidPassword( $this, [ 'type' => '' ], null );
}
diff --git a/includes/poolcounter/PoolCounterWork.php b/includes/poolcounter/PoolCounterWork.php
index bf46e575f3ea..9262ecd3965c 100644
--- a/includes/poolcounter/PoolCounterWork.php
+++ b/includes/poolcounter/PoolCounterWork.php
@@ -39,7 +39,7 @@ abstract class PoolCounterWork {
* @param string $key Key that identifies the queue this work is placed on
* @param PoolCounter|null $poolCounter
*/
- public function __construct( string $type, string $key, PoolCounter $poolCounter = null ) {
+ public function __construct( string $type, string $key, ?PoolCounter $poolCounter = null ) {
$this->type = $type;
// MW >= 1.35
$this->poolCounter = $poolCounter ??
diff --git a/includes/preferences/DefaultPreferencesFactory.php b/includes/preferences/DefaultPreferencesFactory.php
index b0e42902e332..2d5129abde9e 100644
--- a/includes/preferences/DefaultPreferencesFactory.php
+++ b/includes/preferences/DefaultPreferencesFactory.php
@@ -187,11 +187,11 @@ class DefaultPreferencesFactory implements PreferencesFactory {
LanguageNameUtils $languageNameUtils,
HookContainer $hookContainer,
UserOptionsLookup $userOptionsLookup,
- LanguageConverterFactory $languageConverterFactory = null,
- ParserFactory $parserFactory = null,
- SkinFactory $skinFactory = null,
- UserGroupManager $userGroupManager = null,
- SignatureValidatorFactory $signatureValidatorFactory = null
+ ?LanguageConverterFactory $languageConverterFactory = null,
+ ?ParserFactory $parserFactory = null,
+ ?SkinFactory $skinFactory = null,
+ ?UserGroupManager $userGroupManager = null,
+ ?SignatureValidatorFactory $signatureValidatorFactory = null
) {
$options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
diff --git a/includes/preferences/MultiTitleFilter.php b/includes/preferences/MultiTitleFilter.php
index 17a259a06a52..9cd156b78bf8 100644
--- a/includes/preferences/MultiTitleFilter.php
+++ b/includes/preferences/MultiTitleFilter.php
@@ -44,7 +44,7 @@ class MultiTitleFilter implements Filter {
* @param TitleFormatter|null $titleFormatter
*/
public function __construct(
- TitleFactory $titleFactory = null, PageStore $pageStore = null, TitleFormatter $titleFormatter = null ) {
+ ?TitleFactory $titleFactory = null, ?PageStore $pageStore = null, ?TitleFormatter $titleFormatter = null ) {
$this->pageStore = $pageStore;
$this->titleFormatter = $titleFormatter;
}
diff --git a/includes/preferences/MultiUsernameFilter.php b/includes/preferences/MultiUsernameFilter.php
index 18edf6dd5129..15a177145532 100644
--- a/includes/preferences/MultiUsernameFilter.php
+++ b/includes/preferences/MultiUsernameFilter.php
@@ -37,7 +37,7 @@ class MultiUsernameFilter implements Filter {
* @param Authority|int $authorityOrAudience
*/
public function __construct(
- CentralIdLookup $lookup = null,
+ ?CentralIdLookup $lookup = null,
$authorityOrAudience = CentralIdLookup::AUDIENCE_PUBLIC
) {
$this->lookup = $lookup;
diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php
index d7608fb2242a..5d9cff6535e1 100644
--- a/includes/profiler/Profiler.php
+++ b/includes/profiler/Profiler.php
@@ -144,7 +144,7 @@ abstract class Profiler {
/**
* @param SectionProfileCallback|null &$section
*/
- public function scopedProfileOut( SectionProfileCallback &$section = null ) {
+ public function scopedProfileOut( ?SectionProfileCallback &$section = null ) {
$section = null;
}
diff --git a/includes/recentchanges/CategoryMembershipChange.php b/includes/recentchanges/CategoryMembershipChange.php
index d67eb51a2a8a..56574d9e2fcf 100644
--- a/includes/recentchanges/CategoryMembershipChange.php
+++ b/includes/recentchanges/CategoryMembershipChange.php
@@ -80,7 +80,7 @@ class CategoryMembershipChange {
* @param bool $forImport Whether this was caused by a import
*/
public function __construct(
- Title $pageTitle, BacklinkCache $backlinkCache, RevisionRecord $revision = null, bool $forImport = false
+ Title $pageTitle, BacklinkCache $backlinkCache, ?RevisionRecord $revision = null, bool $forImport = false
) {
// TODO: Update callers of this method to pass for import
$this->pageTitle = $pageTitle;
diff --git a/includes/recentchanges/ChangesList.php b/includes/recentchanges/ChangesList.php
index 39916c47e89b..c92fc04a9323 100644
--- a/includes/recentchanges/ChangesList.php
+++ b/includes/recentchanges/ChangesList.php
@@ -315,7 +315,7 @@ class ChangesList extends ContextSource {
* @param IContextSource|null $context
* @return string HTML
*/
- public static function flag( $flag, IContextSource $context = null ) {
+ public static function flag( $flag, ?IContextSource $context = null ) {
static $map = [ 'minoredit' => 'minor', 'botedit' => 'bot' ];
static $flagInfos = null;
@@ -390,7 +390,7 @@ class ChangesList extends ContextSource {
* @param IContextSource|null $context
* @return string
*/
- public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
+ public static function showCharacterDifference( $old, $new, ?IContextSource $context = null ) {
if ( !$context ) {
$context = RequestContext::getMain();
}
@@ -446,7 +446,7 @@ class ChangesList extends ContextSource {
* @param RecentChange|null $new Last change to use, if not provided, $old will be used
* @return string HTML fragment
*/
- public function formatCharacterDifference( RecentChange $old, RecentChange $new = null ) {
+ public function formatCharacterDifference( RecentChange $old, ?RecentChange $new = null ) {
$oldlen = $old->mAttribs['rc_old_len'];
if ( $new ) {
@@ -862,7 +862,7 @@ class ChangesList extends ContextSource {
* User is assumed instead.
* @return bool
*/
- public static function userCan( $rc, $field, Authority $performer = null ) {
+ public static function userCan( $rc, $field, ?Authority $performer = null ) {
$performer ??= RequestContext::getMain()->getAuthority();
if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
diff --git a/includes/recentchanges/RecentChange.php b/includes/recentchanges/RecentChange.php
index 6fbde13a5e56..93ebf2badce4 100644
--- a/includes/recentchanges/RecentChange.php
+++ b/includes/recentchanges/RecentChange.php
@@ -576,7 +576,7 @@ class RecentChange implements Taggable {
* Notify all the feeds about the change.
* @param array|null $feeds Optional feeds to send to, defaults to $wgRCFeeds
*/
- public function notifyRCFeeds( array $feeds = null ) {
+ public function notifyRCFeeds( ?array $feeds = null ) {
$feeds ??=
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::RCFeeds );
@@ -767,7 +767,7 @@ class RecentChange implements Taggable {
public static function notifyEdit(
$timestamp, $page, $minor, $user, $comment, $oldId, $lastTimestamp,
$bot, $ip = '', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0,
- $tags = [], EditResult $editResult = null
+ $tags = [], ?EditResult $editResult = null
) {
Assert::parameter( $page->exists(), '$page', 'must represent an existing page' );
diff --git a/includes/revisiondelete/RevisionDeleteUser.php b/includes/revisiondelete/RevisionDeleteUser.php
index 5add6d8f3173..97d1a2f42dc0 100644
--- a/includes/revisiondelete/RevisionDeleteUser.php
+++ b/includes/revisiondelete/RevisionDeleteUser.php
@@ -46,7 +46,7 @@ class RevisionDeleteUser {
* @param null|IDatabase $dbw If you happen to have one lying around
* @return bool True on success, false on failure (e.g. invalid user ID)
*/
- private static function setUsernameBitfields( $name, $userId, $op, IDatabase $dbw = null ) {
+ private static function setUsernameBitfields( $name, $userId, $op, ?IDatabase $dbw = null ) {
if ( !$userId || ( $op !== '|' && $op !== '&' ) ) {
return false;
}
@@ -153,7 +153,7 @@ class RevisionDeleteUser {
* @param IDatabase|null $dbw If you happen to have one lying around
* @return bool True on success, false on failure (e.g. invalid user ID)
*/
- public static function suppressUserName( $name, $userId, IDatabase $dbw = null ) {
+ public static function suppressUserName( $name, $userId, ?IDatabase $dbw = null ) {
return self::setUsernameBitfields( $name, $userId, '|', $dbw );
}
@@ -163,7 +163,7 @@ class RevisionDeleteUser {
* @param IDatabase|null $dbw If you happen to have one lying around
* @return bool True on success, false on failure (e.g. invalid user ID)
*/
- public static function unsuppressUserName( $name, $userId, IDatabase $dbw = null ) {
+ public static function unsuppressUserName( $name, $userId, ?IDatabase $dbw = null ) {
return self::setUsernameBitfields( $name, $userId, '&', $dbw );
}
}
diff --git a/includes/search/FauxSearchResult.php b/includes/search/FauxSearchResult.php
index b7c27e0600a3..2dcc32fbcce5 100644
--- a/includes/search/FauxSearchResult.php
+++ b/includes/search/FauxSearchResult.php
@@ -12,8 +12,8 @@ class FauxSearchResult extends SearchResult {
public function __construct(
Title $title,
- RevisionRecord $revRecord = null,
- File $image = null,
+ ?RevisionRecord $revRecord = null,
+ ?File $image = null,
$text = ''
) {
parent::__construct();
diff --git a/includes/search/Hook/SearchResultProvideThumbnailHook.php b/includes/search/Hook/SearchResultProvideThumbnailHook.php
index 958d3baea45c..a36ecf8f6126 100644
--- a/includes/search/Hook/SearchResultProvideThumbnailHook.php
+++ b/includes/search/Hook/SearchResultProvideThumbnailHook.php
@@ -24,5 +24,5 @@ interface SearchResultProvideThumbnailHook {
* is pageId and value is either a valid SearchResultThumbnail for given page or null
* @param int|null $size size of thumbnail height and width in points
*/
- public function onSearchResultProvideThumbnail( array $pageIdentities, &$thumbnails, int $size = null );
+ public function onSearchResultProvideThumbnail( array $pageIdentities, &$thumbnails, ?int $size = null );
}
diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php
index 7fd2d075c7ce..b3a99a1deb4a 100644
--- a/includes/search/SearchEngine.php
+++ b/includes/search/SearchEngine.php
@@ -515,7 +515,7 @@ abstract class SearchEngine {
* @return string
* @deprecated since 1.34 use Content::getTextForSearchIndex directly
*/
- public function getTextFromContent( Title $t, Content $c = null ) {
+ public function getTextFromContent( Title $t, ?Content $c = null ) {
return $c ? $c->getTextForSearchIndex() : '';
}
@@ -772,7 +772,7 @@ abstract class SearchEngine {
* @return array|null the list of profiles or null if none available
* @phan-return null|array{name:string,desc-message:string,default?:bool}
*/
- public function getProfiles( $profileType, User $user = null ) {
+ public function getProfiles( $profileType, ?User $user = null ) {
return null;
}
diff --git a/includes/search/SearchResult.php b/includes/search/SearchResult.php
index f2644cfd72b2..7d1c3d72ae73 100644
--- a/includes/search/SearchResult.php
+++ b/includes/search/SearchResult.php
@@ -54,7 +54,7 @@ class SearchResult {
* @param ISearchResultSet|null $parentSet
* @return SearchResult
*/
- public static function newFromTitle( $title, ISearchResultSet $parentSet = null ) {
+ public static function newFromTitle( $title, ?ISearchResultSet $parentSet = null ) {
$result = new RevisionSearchResult( $title );
if ( $parentSet ) {
$parentSet->augmentResult( $result );
diff --git a/includes/search/SearchResultThumbnailProvider.php b/includes/search/SearchResultThumbnailProvider.php
index 7ba9f9a74189..f8da28191999 100644
--- a/includes/search/SearchResultThumbnailProvider.php
+++ b/includes/search/SearchResultThumbnailProvider.php
@@ -64,7 +64,7 @@ class SearchResultThumbnailProvider {
* @param int|null $size
* @return SearchResultThumbnail|null
*/
- public function buildSearchResultThumbnailFromFile( File $file, int $size = null ): ?SearchResultThumbnail {
+ public function buildSearchResultThumbnailFromFile( File $file, ?int $size = null ): ?SearchResultThumbnail {
$size ??= self::THUMBNAIL_SIZE;
$thumb = $file->transform( [ 'width' => $size ] );
diff --git a/includes/search/SearchSuggestion.php b/includes/search/SearchSuggestion.php
index 32358e5d24c8..6613f0814c33 100644
--- a/includes/search/SearchSuggestion.php
+++ b/includes/search/SearchSuggestion.php
@@ -59,7 +59,7 @@ class SearchSuggestion {
* @param Title|null $suggestedTitle
* @param int|null $suggestedTitleID
*/
- public function __construct( $score, $text = null, Title $suggestedTitle = null,
+ public function __construct( $score, $text = null, ?Title $suggestedTitle = null,
$suggestedTitleID = null ) {
$this->score = $score;
$this->text = $text;
@@ -101,7 +101,7 @@ class SearchSuggestion {
/**
* @param Title|null $title
*/
- public function setSuggestedTitle( Title $title = null ) {
+ public function setSuggestedTitle( ?Title $title = null ) {
$this->suggestedTitle = $title;
if ( $title !== null ) {
$urlUtils = MediaWikiServices::getInstance()->getUrlUtils();
diff --git a/includes/search/searchwidgets/BasicSearchResultSetWidget.php b/includes/search/searchwidgets/BasicSearchResultSetWidget.php
index 5b0c40b3d636..bad4b1ee4ccf 100644
--- a/includes/search/searchwidgets/BasicSearchResultSetWidget.php
+++ b/includes/search/searchwidgets/BasicSearchResultSetWidget.php
@@ -40,8 +40,8 @@ class BasicSearchResultSetWidget {
public function render(
$term,
$offset,
- ISearchResultSet $titleResultSet = null,
- ISearchResultSet $textResultSet = null
+ ?ISearchResultSet $titleResultSet = null,
+ ?ISearchResultSet $textResultSet = null
) {
$hasTitle = $titleResultSet && $titleResultSet->numRows() > 0;
$hasText = $textResultSet && $textResultSet->numRows() > 0;
diff --git a/includes/search/searchwidgets/FullSearchResultWidget.php b/includes/search/searchwidgets/FullSearchResultWidget.php
index 451e68ebdbdb..3b8051186193 100644
--- a/includes/search/searchwidgets/FullSearchResultWidget.php
+++ b/includes/search/searchwidgets/FullSearchResultWidget.php
@@ -346,7 +346,7 @@ class FullSearchResultWidget implements SearchResultWidget {
* @param SearchResultThumbnail|null $thumbnail
* @return string|null
*/
- private function generateThumbnailHtml( SearchResult $result, SearchResultThumbnail $thumbnail = null ): ?string {
+ private function generateThumbnailHtml( SearchResult $result, ?SearchResultThumbnail $thumbnail = null ): ?string {
$title = $result->getTitle();
// don't assume that result is a valid title; e.g. could be an interwiki link target
if ( $title === null || !$title->canExist() ) {
diff --git a/includes/session/MetadataMergeException.php b/includes/session/MetadataMergeException.php
index 5cabcd7f8b82..868bb25e4287 100644
--- a/includes/session/MetadataMergeException.php
+++ b/includes/session/MetadataMergeException.php
@@ -46,7 +46,7 @@ class MetadataMergeException extends UnexpectedValueException {
public function __construct(
$message = '',
$code = 0,
- Exception $previous = null,
+ ?Exception $previous = null,
array $context = []
) {
parent::__construct( $message, $code, $previous );
diff --git a/includes/session/SessionManager.php b/includes/session/SessionManager.php
index f2487527bc81..780ac536dbf9 100644
--- a/includes/session/SessionManager.php
+++ b/includes/session/SessionManager.php
@@ -255,7 +255,7 @@ class SessionManager implements SessionManagerInterface {
return $session;
}
- public function getSessionById( $id, $create = false, WebRequest $request = null ) {
+ public function getSessionById( $id, $create = false, ?WebRequest $request = null ) {
if ( !self::validateSessionId( $id ) ) {
throw new InvalidArgumentException( 'Invalid session ID' );
}
@@ -296,7 +296,7 @@ class SessionManager implements SessionManagerInterface {
return $session;
}
- public function getEmptySession( WebRequest $request = null ) {
+ public function getEmptySession( ?WebRequest $request = null ) {
return $this->getEmptySessionInternal( $request );
}
@@ -306,7 +306,7 @@ class SessionManager implements SessionManagerInterface {
* @param string|null $id ID to force on the new session
* @return Session
*/
- private function getEmptySessionInternal( WebRequest $request = null, $id = null ) {
+ private function getEmptySessionInternal( ?WebRequest $request = null, $id = null ) {
if ( $id !== null ) {
if ( !self::validateSessionId( $id ) ) {
throw new InvalidArgumentException( 'Invalid session ID' );
@@ -376,7 +376,7 @@ class SessionManager implements SessionManagerInterface {
* session associated with this WebRequest object will be overwritten.
* @return Session
*/
- private function getInitialSession( WebRequest $request = null ) {
+ private function getInitialSession( ?WebRequest $request = null ) {
$session = $this->getEmptySession( $request );
$session->getToken();
return $session;
@@ -1060,7 +1060,7 @@ class SessionManager implements SessionManagerInterface {
* @private For use in Setup.php only
* @param Session|null $session For testing only
*/
- public function logPotentialSessionLeakage( Session $session = null ) {
+ public function logPotentialSessionLeakage( ?Session $session = null ) {
$proxyLookup = MediaWikiServices::getInstance()->getProxyLookup();
$session = $session ?: self::getGlobalSession();
$suspiciousIpExpiry = $this->config->get( MainConfigNames::SuspiciousIpExpiry );
diff --git a/includes/session/SessionManagerInterface.php b/includes/session/SessionManagerInterface.php
index 203d70d5c8cd..568788ac6793 100644
--- a/includes/session/SessionManagerInterface.php
+++ b/includes/session/SessionManagerInterface.php
@@ -61,7 +61,7 @@ interface SessionManagerInterface extends LoggerAwareInterface {
* session associated with this WebRequest object will be overwritten.
* @return Session|null
*/
- public function getSessionById( $id, $create = false, WebRequest $request = null );
+ public function getSessionById( $id, $create = false, ?WebRequest $request = null );
/**
* Create a new, empty session
@@ -73,7 +73,7 @@ interface SessionManagerInterface extends LoggerAwareInterface {
* session associated with this WebRequest object will be overwritten.
* @return Session
*/
- public function getEmptySession( WebRequest $request = null );
+ public function getEmptySession( ?WebRequest $request = null );
/**
* Invalidate sessions for a user
diff --git a/includes/skins/QuickTemplate.php b/includes/skins/QuickTemplate.php
index 2ff6cc7416a3..0cadd29671e4 100644
--- a/includes/skins/QuickTemplate.php
+++ b/includes/skins/QuickTemplate.php
@@ -75,7 +75,7 @@ abstract class QuickTemplate {
/**
* @param Config|null $config
*/
- public function __construct( Config $config = null ) {
+ public function __construct( ?Config $config = null ) {
$this->data = [];
if ( $config === null ) {
wfDebug( __METHOD__ . ' was called with no Config instance passed to it' );
diff --git a/includes/skins/SkinFactory.php b/includes/skins/SkinFactory.php
index b05e8d9c9caa..425ec0c8d6a7 100644
--- a/includes/skins/SkinFactory.php
+++ b/includes/skins/SkinFactory.php
@@ -84,7 +84,7 @@ class SkinFactory {
* @param true|null $skippable Whether the skin is skippable and should be hidden
* from user preferences. By default, this is determined based by $wgSkipSkins.
*/
- public function register( $name, $displayName, $spec, bool $skippable = null ) {
+ public function register( $name, $displayName, $spec, ?bool $skippable = null ) {
if ( !is_callable( $spec ) ) {
if ( is_array( $spec ) ) {
if ( !isset( $spec['args'] ) ) {
diff --git a/includes/specialpage/SpecialPage.php b/includes/specialpage/SpecialPage.php
index 02e42186303f..cbe4f4c8a7cf 100644
--- a/includes/specialpage/SpecialPage.php
+++ b/includes/specialpage/SpecialPage.php
@@ -651,7 +651,12 @@ class SpecialPage implements MessageLocalizer {
* @param SearchEngineFactory|null $searchEngineFactory Provide the service
* @return string[] Matching subpages
*/
- protected function prefixSearchString( $search, $limit, $offset, SearchEngineFactory $searchEngineFactory = null ) {
+ protected function prefixSearchString(
+ $search,
+ $limit,
+ $offset,
+ ?SearchEngineFactory $searchEngineFactory = null
+ ) {
$title = Title::newFromText( $search );
if ( !$title || !$title->canExist() ) {
// No prefix suggestion in special and media namespace
diff --git a/includes/specialpage/SpecialPageFactory.php b/includes/specialpage/SpecialPageFactory.php
index 61701094a1a9..a1e6e6f27c84 100644
--- a/includes/specialpage/SpecialPageFactory.php
+++ b/includes/specialpage/SpecialPageFactory.php
@@ -1655,7 +1655,7 @@ class SpecialPageFactory {
* @return bool|Title
*/
public function executePath( $path, IContextSource $context, $including = false,
- LinkRenderer $linkRenderer = null
+ ?LinkRenderer $linkRenderer = null
) {
if ( $path instanceof PageReference ) {
$path = $path->getDBkey();
@@ -1742,7 +1742,7 @@ class SpecialPageFactory {
* @return bool|Title
*/
public function capturePath(
- PageReference $page, IContextSource $context, LinkRenderer $linkRenderer = null
+ PageReference $page, IContextSource $context, ?LinkRenderer $linkRenderer = null
) {
// phpcs:ignore MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgUser,MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle
global $wgTitle, $wgOut, $wgRequest, $wgUser, $wgLang;
diff --git a/includes/specialpage/SpecialRedirectWithAction.php b/includes/specialpage/SpecialRedirectWithAction.php
index 0195b939827d..5578bf4738e5 100644
--- a/includes/specialpage/SpecialRedirectWithAction.php
+++ b/includes/specialpage/SpecialRedirectWithAction.php
@@ -56,7 +56,7 @@ abstract class SpecialRedirectWithAction extends RedirectSpecialPage {
$name,
$action,
$msgPrefix,
- SearchEngineFactory $searchEngineFactory = null
+ ?SearchEngineFactory $searchEngineFactory = null
) {
parent::__construct( $name );
$this->action = $action;
diff --git a/includes/specials/SpecialAllPages.php b/includes/specials/SpecialAllPages.php
index b161a2bf1fa0..f58ca549c802 100644
--- a/includes/specials/SpecialAllPages.php
+++ b/includes/specials/SpecialAllPages.php
@@ -60,9 +60,9 @@ class SpecialAllPages extends IncludableSpecialPage {
private PageStore $pageStore;
public function __construct(
- IConnectionProvider $dbProvider = null,
- SearchEngineFactory $searchEngineFactory = null,
- PageStore $pageStore = null
+ ?IConnectionProvider $dbProvider = null,
+ ?SearchEngineFactory $searchEngineFactory = null,
+ ?PageStore $pageStore = null
) {
parent::__construct( 'Allpages' );
// This class is extended and therefore falls back to global state - T265309
diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php
index 7e52b6df8e93..12d9c1b99b5c 100644
--- a/includes/specials/SpecialBlock.php
+++ b/includes/specials/SpecialBlock.php
@@ -1091,7 +1091,7 @@ class SpecialBlock extends FormSpecialPage {
* suggestions
* @return string[]
*/
- public static function getSuggestedDurations( Language $lang = null, $includeOther = true ) {
+ public static function getSuggestedDurations( ?Language $lang = null, $includeOther = true ) {
wfDeprecated( __METHOD__, '1.42' );
$lang ??= MediaWikiServices::getInstance()->getContentLanguage();
return $lang->getBlockDurations( $includeOther );
@@ -1134,7 +1134,7 @@ class SpecialBlock extends FormSpecialPage {
* @param HTMLForm|null $form
* @return bool|string|array|Status As documented for HTMLForm::trySubmit.
*/
- public function onSubmit( array $data, HTMLForm $form = null ) {
+ public function onSubmit( array $data, ?HTMLForm $form = null ) {
return self::processFormInternal(
$data,
$this->getAuthority(),
diff --git a/includes/specials/SpecialChangeContentModel.php b/includes/specials/SpecialChangeContentModel.php
index 3608ddc20480..d29c602936a7 100644
--- a/includes/specials/SpecialChangeContentModel.php
+++ b/includes/specials/SpecialChangeContentModel.php
@@ -204,7 +204,7 @@ class SpecialChangeContentModel extends FormSpecialPage {
* correspond to the human readable text in the drop-down list. The array values
* correspond to the <option value="">.
*/
- private function getOptionsForTitle( Title $title = null ) {
+ private function getOptionsForTitle( ?Title $title = null ) {
$models = $this->contentHandlerFactory->getContentModels();
$options = [];
foreach ( $models as $model ) {
diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php
index d563543efbad..56e0a5285562 100644
--- a/includes/specials/SpecialEditWatchlist.php
+++ b/includes/specials/SpecialEditWatchlist.php
@@ -100,13 +100,13 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
* @param WatchlistManager|null $watchlistManager
*/
public function __construct(
- WatchedItemStoreInterface $watchedItemStore = null,
- TitleParser $titleParser = null,
- GenderCache $genderCache = null,
- LinkBatchFactory $linkBatchFactory = null,
- NamespaceInfo $nsInfo = null,
- WikiPageFactory $wikiPageFactory = null,
- WatchlistManager $watchlistManager = null
+ ?WatchedItemStoreInterface $watchedItemStore = null,
+ ?TitleParser $titleParser = null,
+ ?GenderCache $genderCache = null,
+ ?LinkBatchFactory $linkBatchFactory = null,
+ ?NamespaceInfo $nsInfo = null,
+ ?WikiPageFactory $wikiPageFactory = null,
+ ?WatchlistManager $watchlistManager = null
) {
parent::__construct( 'EditWatchlist', 'editmywatchlist' );
// This class is extended and therefor fallback to global state - T266065
@@ -914,7 +914,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
* @param int|false $selectedMode result of self::getMode
* @return string
*/
- public static function buildTools( $unused, LinkRenderer $linkRenderer = null, $selectedMode = false ) {
+ public static function buildTools( $unused, ?LinkRenderer $linkRenderer = null, $selectedMode = false ) {
if ( !$linkRenderer ) {
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
}
diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php
index 83ec2a863365..40931d322643 100644
--- a/includes/specials/SpecialLog.php
+++ b/includes/specials/SpecialLog.php
@@ -206,7 +206,7 @@ class SpecialLog extends SpecialPage {
* @param HookRunner|null $runner
* @return array
*/
- public static function getLogTypesOnUser( HookRunner $runner = null ) {
+ public static function getLogTypesOnUser( ?HookRunner $runner = null ) {
static $types = null;
if ( $types !== null ) {
return $types;
diff --git a/includes/specials/SpecialMute.php b/includes/specials/SpecialMute.php
index 0e5f17debb57..e935a1268985 100644
--- a/includes/specials/SpecialMute.php
+++ b/includes/specials/SpecialMute.php
@@ -117,7 +117,7 @@ class SpecialMute extends FormSpecialPage {
* @param HTMLForm|null $form
* @return bool
*/
- public function onSubmit( array $data, HTMLForm $form = null ) {
+ public function onSubmit( array $data, ?HTMLForm $form = null ) {
foreach ( $data as $userOption => $value ) {
if ( $value ) {
$this->muteTarget( $userOption );
diff --git a/includes/specials/SpecialPageLanguage.php b/includes/specials/SpecialPageLanguage.php
index e96364bd554a..ec9df198655c 100644
--- a/includes/specials/SpecialPageLanguage.php
+++ b/includes/specials/SpecialPageLanguage.php
@@ -220,7 +220,7 @@ class SpecialPageLanguage extends FormSpecialPage {
* @return Status
*/
public static function changePageLanguage( IContextSource $context, Title $title,
- $newLanguage, $reason = "", array $tags = [], IDatabase $dbw = null ) {
+ $newLanguage, $reason = "", array $tags = [], ?IDatabase $dbw = null ) {
// Get the default language for the wiki
$defLang = $context->getConfig()->get( MainConfigNames::LanguageCode );
diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php
index 5837b367335b..84ea9bdfa362 100644
--- a/includes/specials/SpecialPreferences.php
+++ b/includes/specials/SpecialPreferences.php
@@ -48,8 +48,8 @@ class SpecialPreferences extends SpecialPage {
* @param UserOptionsManager|null $userOptionsManager
*/
public function __construct(
- PreferencesFactory $preferencesFactory = null,
- UserOptionsManager $userOptionsManager = null
+ ?PreferencesFactory $preferencesFactory = null,
+ ?UserOptionsManager $userOptionsManager = null
) {
parent::__construct( 'Preferences' );
// This class is extended and therefore falls back to global state - T265924
diff --git a/includes/specials/SpecialRecentChanges.php b/includes/specials/SpecialRecentChanges.php
index 597022b12c75..e3c00739d9be 100644
--- a/includes/specials/SpecialRecentChanges.php
+++ b/includes/specials/SpecialRecentChanges.php
@@ -75,12 +75,12 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
* @param TempUserConfig|null $tempUserConfig
*/
public function __construct(
- WatchedItemStoreInterface $watchedItemStore = null,
- MessageCache $messageCache = null,
- UserOptionsLookup $userOptionsLookup = null,
- ChangeTagsStore $changeTagsStore = null,
- UserIdentityUtils $userIdentityUtils = null,
- TempUserConfig $tempUserConfig = null
+ ?WatchedItemStoreInterface $watchedItemStore = null,
+ ?MessageCache $messageCache = null,
+ ?UserOptionsLookup $userOptionsLookup = null,
+ ?ChangeTagsStore $changeTagsStore = null,
+ ?UserIdentityUtils $userIdentityUtils = null,
+ ?TempUserConfig $tempUserConfig = null
) {
// This class is extended and therefor fallback to global state - T265310
$services = MediaWikiServices::getInstance();
diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php
index 11ce5ab06de4..6dfac4bae988 100644
--- a/includes/specials/SpecialUndelete.php
+++ b/includes/specials/SpecialUndelete.php
@@ -300,7 +300,7 @@ class SpecialUndelete extends SpecialPage {
* @param User|null $user
* @return bool
*/
- protected function isAllowed( $permission, User $user = null ) {
+ protected function isAllowed( $permission, ?User $user = null ) {
$user ??= $this->getUser();
$block = $user->getBlock();
diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php
index d87deb234ef8..ecd6f7f836d5 100644
--- a/includes/specials/SpecialUpload.php
+++ b/includes/specials/SpecialUpload.php
@@ -78,10 +78,10 @@ class SpecialUpload extends SpecialPage {
* @param WatchlistManager|null $watchlistManager
*/
public function __construct(
- RepoGroup $repoGroup = null,
- UserOptionsLookup $userOptionsLookup = null,
- NamespaceInfo $nsInfo = null,
- WatchlistManager $watchlistManager = null
+ ?RepoGroup $repoGroup = null,
+ ?UserOptionsLookup $userOptionsLookup = null,
+ ?NamespaceInfo $nsInfo = null,
+ ?WatchlistManager $watchlistManager = null
) {
parent::__construct( 'Upload', 'upload' );
// This class is extended and therefor fallback to global state - T265300
@@ -919,7 +919,7 @@ class SpecialUpload extends SpecialPage {
* @return string
*/
public static function getInitialPageText( $comment = '', $license = '',
- $copyStatus = '', $source = '', Config $config = null
+ $copyStatus = '', $source = '', ?Config $config = null
) {
if ( $config === null ) {
wfDebug( __METHOD__ . ' called without a Config instance passed to it' );
diff --git a/includes/specials/SpecialUserRights.php b/includes/specials/SpecialUserRights.php
index 15d5941855ff..8a1d07ef834f 100644
--- a/includes/specials/SpecialUserRights.php
+++ b/includes/specials/SpecialUserRights.php
@@ -93,13 +93,13 @@ class SpecialUserRights extends SpecialPage {
* @param TempUserConfig|null $tempUserConfig
*/
public function __construct(
- UserGroupManagerFactory $userGroupManagerFactory = null,
- UserNameUtils $userNameUtils = null,
- UserNamePrefixSearch $userNamePrefixSearch = null,
- UserFactory $userFactory = null,
- ActorStoreFactory $actorStoreFactory = null,
- WatchlistManager $watchlistManager = null,
- TempUserConfig $tempUserConfig = null
+ ?UserGroupManagerFactory $userGroupManagerFactory = null,
+ ?UserNameUtils $userNameUtils = null,
+ ?UserNamePrefixSearch $userNamePrefixSearch = null,
+ ?UserFactory $userFactory = null,
+ ?ActorStoreFactory $actorStoreFactory = null,
+ ?WatchlistManager $watchlistManager = null,
+ ?TempUserConfig $tempUserConfig = null
) {
parent::__construct( 'Userrights' );
$services = MediaWikiServices::getInstance();
diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php
index 6b6bf661376e..6788c6948137 100644
--- a/includes/specials/SpecialVersion.php
+++ b/includes/specials/SpecialVersion.php
@@ -1227,7 +1227,7 @@ class SpecialVersion extends SpecialPage {
return implode( "\n", $ret );
}
- private function openExtType( string $text = null, string $name = null ) {
+ private function openExtType( ?string $text = null, ?string $name = null ) {
$out = '';
$opt = [ 'class' => 'wikitable plainlinks mw-installed-software' ];
diff --git a/includes/specials/forms/UploadForm.php b/includes/specials/forms/UploadForm.php
index 86bd95473bdc..65fcc652a2d1 100644
--- a/includes/specials/forms/UploadForm.php
+++ b/includes/specials/forms/UploadForm.php
@@ -77,12 +77,12 @@ class UploadForm extends HTMLForm {
*/
public function __construct(
array $options = [],
- IContextSource $context = null,
- LinkRenderer $linkRenderer = null,
- LocalRepo $localRepo = null,
- Language $contentLanguage = null,
- NamespaceInfo $nsInfo = null,
- HookContainer $hookContainer = null
+ ?IContextSource $context = null,
+ ?LinkRenderer $linkRenderer = null,
+ ?LocalRepo $localRepo = null,
+ ?Language $contentLanguage = null,
+ ?NamespaceInfo $nsInfo = null,
+ ?HookContainer $hookContainer = null
) {
if ( $context instanceof IContextSource ) {
$this->setContext( $context );
diff --git a/includes/specials/helpers/ImportReporter.php b/includes/specials/helpers/ImportReporter.php
index 3a6590d7ae49..7f89c6f74006 100644
--- a/includes/specials/helpers/ImportReporter.php
+++ b/includes/specials/helpers/ImportReporter.php
@@ -60,7 +60,7 @@ class ImportReporter extends ContextSource {
* @param string|bool $reason
* @param IContextSource|null $context
*/
- public function __construct( $importer, $upload, $interwiki, $reason = "", IContextSource $context = null ) {
+ public function __construct( $importer, $upload, $interwiki, $reason = "", ?IContextSource $context = null ) {
if ( $context ) {
$this->setContext( $context );
} else {
diff --git a/includes/specials/pagers/AllMessagesTablePager.php b/includes/specials/pagers/AllMessagesTablePager.php
index 26160f1f2af5..3ff5d4220f46 100644
--- a/includes/specials/pagers/AllMessagesTablePager.php
+++ b/includes/specials/pagers/AllMessagesTablePager.php
@@ -166,7 +166,7 @@ class AllMessagesTablePager extends TablePager {
$messageNames,
$langcode = 'en',
$foreign = false,
- IReadableDatabase $dbr = null
+ ?IReadableDatabase $dbr = null
) {
// FIXME: This function should be moved to Language:: or something.
// Fallback to global state, if not provided
diff --git a/includes/specials/pagers/ContribsPager.php b/includes/specials/pagers/ContribsPager.php
index 8c78e6620b05..14783873eebf 100644
--- a/includes/specials/pagers/ContribsPager.php
+++ b/includes/specials/pagers/ContribsPager.php
@@ -65,14 +65,14 @@ class ContribsPager extends ContributionsPager {
public function __construct(
IContextSource $context,
array $options,
- LinkRenderer $linkRenderer = null,
- LinkBatchFactory $linkBatchFactory = null,
- HookContainer $hookContainer = null,
- IConnectionProvider $dbProvider = null,
- RevisionStore $revisionStore = null,
- NamespaceInfo $namespaceInfo = null,
- UserIdentity $targetUser = null,
- CommentFormatter $commentFormatter = null
+ ?LinkRenderer $linkRenderer = null,
+ ?LinkBatchFactory $linkBatchFactory = null,
+ ?HookContainer $hookContainer = null,
+ ?IConnectionProvider $dbProvider = null,
+ ?RevisionStore $revisionStore = null,
+ ?NamespaceInfo $namespaceInfo = null,
+ ?UserIdentity $targetUser = null,
+ ?CommentFormatter $commentFormatter = null
) {
// Class is used directly in extensions - T266484
$services = MediaWikiServices::getInstance();
diff --git a/includes/title/Title.php b/includes/title/Title.php
index be95699c704e..15b60f7e8b30 100644
--- a/includes/title/Title.php
+++ b/includes/title/Title.php
@@ -678,7 +678,7 @@ class Title implements Stringable, LinkTarget, PageIdentity {
* @param MessageLocalizer|null $localizer An optional context to use (since 1.34)
* @return Title
*/
- public static function newMainPage( MessageLocalizer $localizer = null ) {
+ public static function newMainPage( ?MessageLocalizer $localizer = null ) {
static $recursionGuard = false;
$title = null;
diff --git a/includes/title/TitleFactory.php b/includes/title/TitleFactory.php
index bb3470923c85..b9d590ef6ef2 100644
--- a/includes/title/TitleFactory.php
+++ b/includes/title/TitleFactory.php
@@ -185,7 +185,7 @@ class TitleFactory {
* @param MessageLocalizer|null $localizer
* @return Title
*/
- public function newMainPage( MessageLocalizer $localizer = null ): Title {
+ public function newMainPage( ?MessageLocalizer $localizer = null ): Title {
return Title::newMainPage( $localizer );
}
diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php
index 736af7be47ac..ef0338cbf917 100644
--- a/includes/upload/UploadBase.php
+++ b/includes/upload/UploadBase.php
@@ -1234,7 +1234,7 @@ abstract class UploadBase {
* @param User|null $user
* @return UploadStashFile Stashed file
*/
- protected function doStashFile( User $user = null ) {
+ protected function doStashFile( ?User $user = null ) {
$stash = MediaWikiServices::getInstance()->getRepoGroup()
->getLocalRepo()->getUploadStash( $user );
$file = $stash->stashFile( $this->mTempPath, $this->getSourceType(), $this->mFileProps );
diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php
index c4d06187a3b7..71401d918b1e 100644
--- a/includes/upload/UploadFromChunks.php
+++ b/includes/upload/UploadFromChunks.php
@@ -104,7 +104,7 @@ class UploadFromChunks extends UploadFromFile {
* @param User|null $user
* @return UploadStashFile Stashed file
*/
- protected function doStashFile( User $user = null ) {
+ protected function doStashFile( ?User $user = null ) {
// Stash file is the called on creating a new chunk session:
$this->mChunkIndex = 0;
$this->mOffset = 0;
diff --git a/includes/upload/UploadFromStash.php b/includes/upload/UploadFromStash.php
index bedb0ef06bf1..a0ccaec31c74 100644
--- a/includes/upload/UploadFromStash.php
+++ b/includes/upload/UploadFromStash.php
@@ -50,7 +50,7 @@ class UploadFromStash extends UploadBase {
* @param UploadStash|false $stash Default: false
* @param FileRepo|false $repo Default: false
*/
- public function __construct( UserIdentity $user = null, $stash = false, $repo = false ) {
+ public function __construct( ?UserIdentity $user = null, $stash = false, $repo = false ) {
if ( $repo ) {
$this->repo = $repo;
} else {
diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php
index bb1ca40c98f1..593f7576181f 100644
--- a/includes/upload/UploadStash.php
+++ b/includes/upload/UploadStash.php
@@ -88,7 +88,7 @@ class UploadStash {
* @param FileRepo $repo
* @param UserIdentity|null $user
*/
- public function __construct( FileRepo $repo, UserIdentity $user = null ) {
+ public function __construct( FileRepo $repo, ?UserIdentity $user = null ) {
// this might change based on wiki's configuration.
$this->repo = $repo;
diff --git a/includes/upload/exception/UploadStashException.php b/includes/upload/exception/UploadStashException.php
index b905d57bddfa..5862380dd28e 100644
--- a/includes/upload/exception/UploadStashException.php
+++ b/includes/upload/exception/UploadStashException.php
@@ -36,7 +36,7 @@ class UploadStashException extends RuntimeException implements ILocalizedExcepti
* @param Throwable|null $previous The previous exception used for the exception
* chaining.
*/
- public function __construct( $messageSpec, $code = 0, Throwable $previous = null ) {
+ public function __construct( $messageSpec, $code = 0, ?Throwable $previous = null ) {
$this->messageSpec = $messageSpec;
$msg = $this->getMessageObject()->text();
diff --git a/includes/user/BotPassword.php b/includes/user/BotPassword.php
index a5ddf45c6405..b86a6e008ccd 100644
--- a/includes/user/BotPassword.php
+++ b/includes/user/BotPassword.php
@@ -260,7 +260,7 @@ class BotPassword {
* @return Status
* @throws UnexpectedValueException
*/
- public function save( $operation, Password $password = null ) {
+ public function save( $operation, ?Password $password = null ) {
// Ensure operation is valid
if ( $operation !== 'insert' && $operation !== 'update' ) {
throw new UnexpectedValueException(
diff --git a/includes/user/BotPasswordStore.php b/includes/user/BotPasswordStore.php
index a0f546b8602c..7c79d2838edc 100644
--- a/includes/user/BotPasswordStore.php
+++ b/includes/user/BotPasswordStore.php
@@ -215,7 +215,7 @@ class BotPasswordStore {
*/
public function insertBotPassword(
BotPassword $botPassword,
- Password $password = null
+ ?Password $password = null
): StatusValue {
$res = $this->validateBotPassword( $botPassword );
if ( !$res->isGood() ) {
@@ -261,7 +261,7 @@ class BotPasswordStore {
*/
public function updateBotPassword(
BotPassword $botPassword,
- Password $password = null
+ ?Password $password = null
): StatusValue {
$res = $this->validateBotPassword( $botPassword );
if ( !$res->isGood() ) {
diff --git a/includes/user/CentralId/CentralIdLookupFactory.php b/includes/user/CentralId/CentralIdLookupFactory.php
index a9669743c5f8..098d3b21cc18 100644
--- a/includes/user/CentralId/CentralIdLookupFactory.php
+++ b/includes/user/CentralId/CentralIdLookupFactory.php
@@ -102,7 +102,7 @@ class CentralIdLookupFactory {
* @return CentralIdLookup
* @throws InvalidArgumentException if $providerId is not properly configured
*/
- public function getLookup( string $providerId = null ): CentralIdLookup {
+ public function getLookup( ?string $providerId = null ): CentralIdLookup {
$providerId ??= $this->defaultProvider;
if ( !array_key_exists( $providerId, $this->instanceCache ) ) {
@@ -134,7 +134,7 @@ class CentralIdLookupFactory {
* @return ?CentralIdLookup
* @throws InvalidArgumentException if $providerId is not properly configured
*/
- public function getNonLocalLookup( string $providerID = null ): ?CentralIdLookup {
+ public function getNonLocalLookup( ?string $providerID = null ): ?CentralIdLookup {
$centralIdLookup = $this->getLookup( $providerID );
if ( $centralIdLookup instanceof LocalIdLookup ) {
/*
diff --git a/includes/user/TalkPageNotificationManager.php b/includes/user/TalkPageNotificationManager.php
index fef268b21b31..2e818bf875ec 100644
--- a/includes/user/TalkPageNotificationManager.php
+++ b/includes/user/TalkPageNotificationManager.php
@@ -108,7 +108,7 @@ class TalkPageNotificationManager {
*/
public function clearForPageView(
UserIdentity $user,
- RevisionRecord $oldRev = null
+ ?RevisionRecord $oldRev = null
) {
// Abort if the hook says so. (Echo doesn't abort, it just queues its own update)
if ( !$this->hookRunner->onUserClearNewTalkNotification(
@@ -166,7 +166,7 @@ class TalkPageNotificationManager {
*/
public function setUserHasNewMessages(
UserIdentity $user,
- RevisionRecord $curRev = null
+ ?RevisionRecord $curRev = null
): void {
if ( $this->isTalkDisabled( $user ) ) {
return;
@@ -269,7 +269,7 @@ class TalkPageNotificationManager {
*/
private function dbUpdateNewUserMessages(
UserIdentity $user,
- RevisionRecord $curRev = null
+ ?RevisionRecord $curRev = null
): bool {
if ( $this->readOnlyMode->isReadOnly() ) {
return false;
diff --git a/includes/user/User.php b/includes/user/User.php
index c32644bedf8d..8ee4b0cce997 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -711,7 +711,7 @@ class User implements Stringable, Authority, UserIdentity, UserEmailContact {
* @param WebRequest|null $request Object to use; the global request will be used if omitted.
* @return User
*/
- public static function newFromSession( WebRequest $request = null ) {
+ public static function newFromSession( ?WebRequest $request = null ) {
$user = new User;
$user->mFrom = 'session';
$user->mRequest = $request;
@@ -2168,7 +2168,7 @@ class User implements Stringable, Authority, UserIdentity, UserEmailContact {
return $this->getThisAsAuthority()->isAllowedAll( ...$permissions );
}
- public function isAllowed( string $permission, PermissionStatus $status = null ): bool {
+ public function isAllowed( string $permission, ?PermissionStatus $status = null ): bool {
return $this->getThisAsAuthority()->isAllowed( $permission, $status );
}
@@ -3249,7 +3249,7 @@ class User implements Stringable, Authority, UserIdentity, UserEmailContact {
public function probablyCan(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return $this->getThisAsAuthority()->probablyCan( $action, $target, $status );
}
@@ -3264,7 +3264,7 @@ class User implements Stringable, Authority, UserIdentity, UserEmailContact {
public function definitelyCan(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return $this->getThisAsAuthority()->definitelyCan( $action, $target, $status );
}
@@ -3277,7 +3277,7 @@ class User implements Stringable, Authority, UserIdentity, UserEmailContact {
* @param PermissionStatus|null $status
* @return bool
*/
- public function isDefinitelyAllowed( string $action, PermissionStatus $status = null ): bool {
+ public function isDefinitelyAllowed( string $action, ?PermissionStatus $status = null ): bool {
return $this->getThisAsAuthority()->isDefinitelyAllowed( $action, $status );
}
@@ -3289,7 +3289,7 @@ class User implements Stringable, Authority, UserIdentity, UserEmailContact {
* @param PermissionStatus|null $status
* @return bool
*/
- public function authorizeAction( string $action, PermissionStatus $status = null ): bool {
+ public function authorizeAction( string $action, ?PermissionStatus $status = null ): bool {
return $this->getThisAsAuthority()->authorizeAction( $action, $status );
}
@@ -3303,7 +3303,7 @@ class User implements Stringable, Authority, UserIdentity, UserEmailContact {
public function authorizeRead(
string $action,
PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return $this->getThisAsAuthority()->authorizeRead( $action, $target, $status );
}
@@ -3317,7 +3317,7 @@ class User implements Stringable, Authority, UserIdentity, UserEmailContact {
*/
public function authorizeWrite(
string $action, PageIdentity $target,
- PermissionStatus $status = null
+ ?PermissionStatus $status = null
): bool {
return $this->getThisAsAuthority()->authorizeWrite( $action, $target, $status );
}
diff --git a/includes/user/UserGroupManager.php b/includes/user/UserGroupManager.php
index 2938b92636e7..2e75bc8a21d0 100644
--- a/includes/user/UserGroupManager.php
+++ b/includes/user/UserGroupManager.php
@@ -822,7 +822,7 @@ class UserGroupManager {
public function addUserToGroup(
UserIdentity $user,
string $group,
- string $expiry = null,
+ ?string $expiry = null,
bool $allowUpdate = false
): bool {
$user->assertWiki( $this->wikiId );
@@ -947,7 +947,7 @@ class UserGroupManager {
public function addUserToMultipleGroups(
UserIdentity $user,
array $groups,
- string $expiry = null,
+ ?string $expiry = null,
bool $allowUpdate = false
) {
foreach ( $groups as $group ) {
diff --git a/includes/user/UserTimeCorrection.php b/includes/user/UserTimeCorrection.php
index a42cb1df4f00..fdafab702ce1 100644
--- a/includes/user/UserTimeCorrection.php
+++ b/includes/user/UserTimeCorrection.php
@@ -78,7 +78,7 @@ class UserTimeCorrection implements Stringable {
*/
public function __construct(
string $timeCorrection,
- DateTime $relativeToDate = null,
+ ?DateTime $relativeToDate = null,
int $systemOffset = 0
) {
$this->date = $relativeToDate ?? new DateTime( '@' . MWTimestamp::time() );
diff --git a/includes/utils/MWRestrictions.php b/includes/utils/MWRestrictions.php
index 33ea1ca4fc1b..f8c19d47c821 100644
--- a/includes/utils/MWRestrictions.php
+++ b/includes/utils/MWRestrictions.php
@@ -43,7 +43,7 @@ class MWRestrictions implements Stringable {
* @param array|null $restrictions
* @throws InvalidArgumentException
*/
- protected function __construct( array $restrictions = null ) {
+ protected function __construct( ?array $restrictions = null ) {
$this->validity = StatusValue::newGood();
if ( $restrictions !== null ) {
$this->loadFromArray( $restrictions );
diff --git a/includes/utils/MWTimestamp.php b/includes/utils/MWTimestamp.php
index a37aeb75fc50..07e8cb4e5973 100644
--- a/includes/utils/MWTimestamp.php
+++ b/includes/utils/MWTimestamp.php
@@ -93,9 +93,9 @@ class MWTimestamp extends ConvertibleTimestamp {
* @return string Relative timestamp
*/
public function getRelativeTimestamp(
- MWTimestamp $relativeTo = null,
- UserIdentity $user = null,
- Language $lang = null,
+ ?MWTimestamp $relativeTo = null,
+ ?UserIdentity $user = null,
+ ?Language $lang = null,
array $chosenIntervals = []
) {
$relativeTo ??= new self();
diff --git a/includes/watchlist/WatchlistManager.php b/includes/watchlist/WatchlistManager.php
index 4749b739bc17..f75941db96f4 100644
--- a/includes/watchlist/WatchlistManager.php
+++ b/includes/watchlist/WatchlistManager.php
@@ -191,7 +191,7 @@ class WatchlistManager {
$performer,
$title,
int $oldid = 0,
- RevisionRecord $oldRev = null
+ ?RevisionRecord $oldRev = null
) {
if ( $this->readOnlyMode->isReadOnly() ) {
// Cannot change anything in read only
@@ -487,7 +487,7 @@ class WatchlistManager {
bool $watch,
Authority $performer,
PageIdentity $target,
- string $expiry = null
+ ?string $expiry = null
): StatusValue {
// User must be registered, and (T371091) not a temp user
if ( !$performer->getUser()->isRegistered() || $performer->isTemp() ) {
diff --git a/includes/xml/Xml.php b/includes/xml/Xml.php
index 43202ab9f002..a880d0790466 100644
--- a/includes/xml/Xml.php
+++ b/includes/xml/Xml.php
@@ -225,7 +225,7 @@ class Xml {
* @deprecated since 1.42
*/
public static function languageSelector( $selected, $customisedOnly = true,
- $inLanguage = null, $overrideAttrs = [], Message $msg = null
+ $inLanguage = null, $overrideAttrs = [], ?Message $msg = null
) {
wfDeprecated( __METHOD__, '1.42' );
$languageCode = MediaWikiServices::getInstance()->getMainConfig()
diff --git a/maintenance/findBadBlobs.php b/maintenance/findBadBlobs.php
index 537739895824..ab2840b584d2 100644
--- a/maintenance/findBadBlobs.php
+++ b/maintenance/findBadBlobs.php
@@ -427,7 +427,7 @@ class FindBadBlobs extends Maintenance {
*
* @return false|string
*/
- private function markBlob( SlotRecord $slot, string $error = null ) {
+ private function markBlob( SlotRecord $slot, ?string $error = null ) {
$args = [];
if ( $this->hasOption( 'mark' ) ) {
diff --git a/maintenance/includes/Maintenance.php b/maintenance/includes/Maintenance.php
index b479a7e6ec9d..7d5cb14df4ac 100644
--- a/maintenance/includes/Maintenance.php
+++ b/maintenance/includes/Maintenance.php
@@ -1483,7 +1483,7 @@ abstract class Maintenance {
*
* @since 1.43
*/
- protected function prompt( string $prompt, string $default = null ): ?string {
+ protected function prompt( string $prompt, ?string $default = null ): ?string {
$defaultText = $default === null ? ' > ' : " [{$default}] > ";
$promptWithDefault = $prompt . $defaultText;
$line = self::readconsole( $promptWithDefault );
diff --git a/tests/phpunit/MediaWikiIntegrationTestCase.php b/tests/phpunit/MediaWikiIntegrationTestCase.php
index 8a24b03c5d41..08cb08739cf9 100644
--- a/tests/phpunit/MediaWikiIntegrationTestCase.php
+++ b/tests/phpunit/MediaWikiIntegrationTestCase.php
@@ -419,8 +419,8 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
* @return array Config overrides
*/
public static function getConfigOverrides(
- Config $customOverrides = null,
- Config $baseConfig = null
+ ?Config $customOverrides = null,
+ ?Config $baseConfig = null
): array {
$overrides = [];
@@ -1218,7 +1218,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
* @since 1.27
*/
protected function overrideMwServices(
- Config $customOverrides = null, array $services = []
+ ?Config $customOverrides = null, array $services = []
) {
if ( $this->overriddenServices ) {
throw new LogicException(
@@ -1624,7 +1624,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
$title,
$text = 'Sample page for unit test.',
$namespace = null,
- User $user = null
+ ?User $user = null
) {
if ( !self::needsDB() ) {
throw new RuntimeException( 'When testing with pages, the test must use @group Database.' );
@@ -2128,7 +2128,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
self::truncateTables( $tablesUsed, $db );
}
- protected function truncateTable( $table, IDatabase $db = null ) {
+ protected function truncateTable( $table, ?IDatabase $db = null ) {
self::truncateTables( [ $table ], $db );
}
@@ -2140,7 +2140,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
* @param string[] $tables
* @param IDatabase|null $db
*/
- protected static function truncateTables( array $tables, IDatabase $db = null ) {
+ protected static function truncateTables( array $tables, ?IDatabase $db = null ) {
$dbw = $db ?: MediaWikiServices::getInstance()->getConnectionProvider()->getPrimaryDatabase();
foreach ( $tables as $table ) {
$dbw->truncateTable( $table, __METHOD__ );
@@ -2597,7 +2597,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
$content,
$summary = '',
$defaultNs = NS_MAIN,
- Authority $performer = null
+ ?Authority $performer = null
) {
if ( !self::needsDB() ) {
throw new LogicException( 'When testing with pages, the test must use @group Database.' );
@@ -2635,7 +2635,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
* @param string $summary
* @param Authority|null $deleter
*/
- protected function deletePage( ProperPageIdentity $page, string $summary = '', Authority $deleter = null ): void {
+ protected function deletePage( ProperPageIdentity $page, string $summary = '', ?Authority $deleter = null ): void {
$deleter ??= new UltimateAuthority( new UserIdentityValue( 0, 'MediaWiki default' ) );
MediaWikiServices::getInstance()->getDeletePageFactory()
->newDeletePage( $page, $deleter )
diff --git a/tests/phpunit/MediaWikiTestCaseTrait.php b/tests/phpunit/MediaWikiTestCaseTrait.php
index bdf1abca4ab8..6164641830c7 100644
--- a/tests/phpunit/MediaWikiTestCaseTrait.php
+++ b/tests/phpunit/MediaWikiTestCaseTrait.php
@@ -514,7 +514,7 @@ trait MediaWikiTestCaseTrait {
protected function expectPHPError(
int $errorLevel,
callable $callback,
- string $msg = null
+ ?string $msg = null
): void {
try {
$errorEmitted = false;
diff --git a/tests/phpunit/ResourceLoaderTestCase.php b/tests/phpunit/ResourceLoaderTestCase.php
index 6cd803b19f86..2e3557600aed 100644
--- a/tests/phpunit/ResourceLoaderTestCase.php
+++ b/tests/phpunit/ResourceLoaderTestCase.php
@@ -32,7 +32,7 @@ abstract class ResourceLoaderTestCase extends MediaWikiIntegrationTestCase {
* @param ResourceLoader|null $rl
* @return Context
*/
- protected function getResourceLoaderContext( $options = [], ResourceLoader $rl = null ) {
+ protected function getResourceLoaderContext( $options = [], ?ResourceLoader $rl = null ) {
if ( is_string( $options ) ) {
// Back-compat for extension tests
$options = [ 'lang' => $options ];
@@ -172,7 +172,7 @@ class ResourceLoaderTestModule extends Module {
return $this->messages;
}
- public function getDependencies( Context $context = null ) {
+ public function getDependencies( ?Context $context = null ) {
return $this->dependencies;
}
@@ -242,7 +242,7 @@ class ResourceLoaderFileModuleTestingSubclass extends FileModule {
}
class EmptyResourceLoader extends ResourceLoader {
- public function __construct( Config $config = null, LoggerInterface $logger = null ) {
+ public function __construct( ?Config $config = null, ?LoggerInterface $logger = null ) {
parent::__construct( $config ?: ResourceLoaderTestCase::getMinimalConfig(), $logger );
}
}
diff --git a/tests/phpunit/includes/Output/OutputPageTest.php b/tests/phpunit/includes/Output/OutputPageTest.php
index 917552eaccf4..f0cf2118db1d 100644
--- a/tests/phpunit/includes/Output/OutputPageTest.php
+++ b/tests/phpunit/includes/Output/OutputPageTest.php
@@ -1304,7 +1304,7 @@ class OutputPageTest extends MediaWikiIntegrationTestCase {
}
private function setupCategoryTests(
- array $fakeResults, callable $variantLinkCallback = null
+ array $fakeResults, ?callable $variantLinkCallback = null
): OutputPage {
$this->overrideConfigValue( MainConfigNames::UsePigLatinVariant, true );
@@ -3348,9 +3348,9 @@ class OutputPageTest extends MediaWikiIntegrationTestCase {
private function newInstance(
array $config = [],
- WebRequest $request = null,
+ ?WebRequest $request = null,
$option = null,
- Authority $performer = null
+ ?Authority $performer = null
): OutputPage {
$this->overrideConfigValues( [
// Avoid configured skin affecting the headings
diff --git a/tests/phpunit/includes/Permissions/PermissionManagerTest.php b/tests/phpunit/includes/Permissions/PermissionManagerTest.php
index 18866692487a..89aa12541f49 100644
--- a/tests/phpunit/includes/Permissions/PermissionManagerTest.php
+++ b/tests/phpunit/includes/Permissions/PermissionManagerTest.php
@@ -1274,7 +1274,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
/**
* @dataProvider provideGetRestrictionLevels
*/
- public function testGetRestrictionLevels( array $expected, $ns, array $userGroups = null ) {
+ public function testGetRestrictionLevels( array $expected, $ns, ?array $userGroups = null ) {
$this->overrideConfigValues( [
MainConfigNames::GroupPermissions => [
'*' => [ 'edit' => true ],
diff --git a/tests/phpunit/includes/ResourceLoader/ResourceLoaderTest.php b/tests/phpunit/includes/ResourceLoader/ResourceLoaderTest.php
index 9a9b11b48a09..f0259cf87ea3 100644
--- a/tests/phpunit/includes/ResourceLoader/ResourceLoaderTest.php
+++ b/tests/phpunit/includes/ResourceLoader/ResourceLoaderTest.php
@@ -1198,7 +1198,7 @@ END
$rl->respond( $context );
}
- private function getResourceLoaderWithTestModules( Config $config = null ) {
+ private function getResourceLoaderWithTestModules( ?Config $config = null ) {
$localBasePath = __DIR__ . '/../../data/resourceloader';
$remoteBasePath = '/w';
$rl = new EmptyResourceLoader( $config );
diff --git a/tests/phpunit/includes/ResourceLoader/WikiModuleTest.php b/tests/phpunit/includes/ResourceLoader/WikiModuleTest.php
index 566954dd11f4..73f6be19d050 100644
--- a/tests/phpunit/includes/ResourceLoader/WikiModuleTest.php
+++ b/tests/phpunit/includes/ResourceLoader/WikiModuleTest.php
@@ -346,7 +346,7 @@ class WikiModuleTest extends ResourceLoaderTestCase {
/**
* @dataProvider provideGetContent
*/
- public function testGetContent( $expected, $title, Content $contentObj = null ) {
+ public function testGetContent( $expected, $title, ?Content $contentObj = null ) {
$context = $this->getResourceLoaderContext( [], new EmptyResourceLoader );
$module = $this->getMockBuilder( WikiModule::class )
->onlyMethods( [ 'getContentObj' ] )->getMock();
diff --git a/tests/phpunit/includes/Revision/MutableRevisionRecordTest.php b/tests/phpunit/includes/Revision/MutableRevisionRecordTest.php
index 5816c8d05356..e233f9e5d4d7 100644
--- a/tests/phpunit/includes/Revision/MutableRevisionRecordTest.php
+++ b/tests/phpunit/includes/Revision/MutableRevisionRecordTest.php
@@ -44,7 +44,7 @@ class MutableRevisionRecordTest extends MediaWikiIntegrationTestCase {
public function testConstructorAndGetters(
PageIdentity $page,
$wikiId = RevisionRecord::LOCAL,
- string $expectedException = null
+ ?string $expectedException = null
) {
$rec = new MutableRevisionRecord( $page, $wikiId );
diff --git a/tests/phpunit/includes/Revision/RenderedRevisionTest.php b/tests/phpunit/includes/Revision/RenderedRevisionTest.php
index 996572b552a8..6551dc382ce5 100644
--- a/tests/phpunit/includes/Revision/RenderedRevisionTest.php
+++ b/tests/phpunit/includes/Revision/RenderedRevisionTest.php
@@ -102,7 +102,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
$page,
$id = null,
$visibility = 0,
- array $content = null
+ ?array $content = null
) {
$frank = new UserIdentityValue( 9, 'Frank' );
diff --git a/tests/phpunit/includes/Revision/RevisionArchiveRecordTest.php b/tests/phpunit/includes/Revision/RevisionArchiveRecordTest.php
index 4c53753e3172..0b6cc70527ae 100644
--- a/tests/phpunit/includes/Revision/RevisionArchiveRecordTest.php
+++ b/tests/phpunit/includes/Revision/RevisionArchiveRecordTest.php
@@ -140,7 +140,7 @@ class RevisionArchiveRecordTest extends MediaWikiIntegrationTestCase {
$row,
RevisionSlots $slots,
$wikiId = RevisionRecord::LOCAL,
- string $expectedException = null
+ ?string $expectedException = null
) {
$rec = new RevisionArchiveRecord( $page, $user, $comment, $row, $slots, $wikiId );
diff --git a/tests/phpunit/includes/Revision/RevisionStoreRecordTest.php b/tests/phpunit/includes/Revision/RevisionStoreRecordTest.php
index 8fde93db56ab..e245915009f9 100644
--- a/tests/phpunit/includes/Revision/RevisionStoreRecordTest.php
+++ b/tests/phpunit/includes/Revision/RevisionStoreRecordTest.php
@@ -152,7 +152,7 @@ class RevisionStoreRecordTest extends MediaWikiIntegrationTestCase {
$row,
RevisionSlots $slots,
$wikiId = RevisionRecord::LOCAL,
- string $expectedException = null
+ ?string $expectedException = null
) {
$rec = new RevisionStoreRecord( $page, $user, $comment, $row, $slots, $wikiId );
diff --git a/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php b/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php
index 3c29ac18c4d0..895117a13369 100644
--- a/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php
+++ b/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php
@@ -81,7 +81,7 @@ class DerivedPageDataUpdaterTest extends MediaWikiIntegrationTestCase {
* @return DerivedPageDataUpdater
*/
private function getDerivedPageDataUpdater(
- $page, RevisionRecord $rec = null, User $user = null
+ $page, ?RevisionRecord $rec = null, ?User $user = null
) {
if ( is_string( $page ) || $page instanceof Title ) {
$page = $this->getPage( $page );
@@ -781,7 +781,7 @@ class DerivedPageDataUpdaterTest extends MediaWikiIntegrationTestCase {
private function makeRevision(
PageIdentity $title,
$update,
- UserIdentity $user = null,
+ ?UserIdentity $user = null,
$comment = "testing",
$id = 0,
$parentId = 0
diff --git a/tests/phpunit/includes/Storage/RevisionSlotsUpdateTest.php b/tests/phpunit/includes/Storage/RevisionSlotsUpdateTest.php
index 405e5ca18b0a..06dd6e70900b 100644
--- a/tests/phpunit/includes/Storage/RevisionSlotsUpdateTest.php
+++ b/tests/phpunit/includes/Storage/RevisionSlotsUpdateTest.php
@@ -82,7 +82,7 @@ class RevisionSlotsUpdateTest extends MediaWikiIntegrationTestCase {
*/
public function testNewFromContent(
array $newContent,
- RevisionSlots $parentSlots = null,
+ ?RevisionSlots $parentSlots = null,
array $modified = []
) {
$update = RevisionSlotsUpdate::newFromContent( $newContent, $parentSlots );
diff --git a/tests/phpunit/includes/Storage/SqlBlobStoreTest.php b/tests/phpunit/includes/Storage/SqlBlobStoreTest.php
index 4270c30a8e1a..f12c696fa225 100644
--- a/tests/phpunit/includes/Storage/SqlBlobStoreTest.php
+++ b/tests/phpunit/includes/Storage/SqlBlobStoreTest.php
@@ -27,8 +27,8 @@ class SqlBlobStoreTest extends MediaWikiIntegrationTestCase {
* @return SqlBlobStore
*/
public function getBlobStore(
- WANObjectCache $cache = null,
- ExternalStoreAccess $extStore = null
+ ?WANObjectCache $cache = null,
+ ?ExternalStoreAccess $extStore = null
) {
$services = $this->getServiceContainer();
diff --git a/tests/phpunit/includes/actions/ActionEntryPointTest.php b/tests/phpunit/includes/actions/ActionEntryPointTest.php
index 8fd45557929f..0cb643bb74e6 100644
--- a/tests/phpunit/includes/actions/ActionEntryPointTest.php
+++ b/tests/phpunit/includes/actions/ActionEntryPointTest.php
@@ -58,7 +58,7 @@ class ActionEntryPointTest extends MediaWikiIntegrationTestCase {
*
* @return ActionEntryPoint
*/
- private function getEntryPoint( $environment = null, RequestContext $context = null ) {
+ private function getEntryPoint( $environment = null, ?RequestContext $context = null ) {
if ( !$environment ) {
$environment = new MockEnvironment();
}
diff --git a/tests/phpunit/includes/actions/ActionTest.php b/tests/phpunit/includes/actions/ActionTest.php
index afa461201437..d6a7008b9553 100644
--- a/tests/phpunit/includes/actions/ActionTest.php
+++ b/tests/phpunit/includes/actions/ActionTest.php
@@ -54,7 +54,7 @@ class ActionTest extends MediaWikiIntegrationTestCase {
*/
private function getAction(
string $requestedAction,
- WikiPage $wikiPage = null
+ ?WikiPage $wikiPage = null
) {
$context = $this->getContext( $requestedAction );
@@ -71,8 +71,8 @@ class ActionTest extends MediaWikiIntegrationTestCase {
* @return Article
*/
private function getArticle(
- WikiPage $wikiPage = null,
- IContextSource $context = null
+ ?WikiPage $wikiPage = null,
+ ?IContextSource $context = null
): Article {
$context ??= $this->getContext();
if ( $wikiPage !== null ) {
@@ -95,7 +95,7 @@ class ActionTest extends MediaWikiIntegrationTestCase {
* @return IContextSource
*/
private function getContext(
- string $requestedAction = null
+ ?string $requestedAction = null
): IContextSource {
$request = new FauxRequest( [ 'action' => $requestedAction ] );
diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php
index b6e2a5cc5f47..adbeb4bdf796 100644
--- a/tests/phpunit/includes/api/ApiBlockTest.php
+++ b/tests/phpunit/includes/api/ApiBlockTest.php
@@ -48,7 +48,7 @@ class ApiBlockTest extends ApiTestCase {
* @param Authority|null $blocker User to do the blocking, null to pick arbitrarily
* @return array result of doApiRequest
*/
- private function doBlock( array $extraParams = [], Authority $blocker = null ) {
+ private function doBlock( array $extraParams = [], ?Authority $blocker = null ) {
$this->assertNotNull( $this->mUser );
$params = [
diff --git a/tests/phpunit/includes/api/ApiMainTest.php b/tests/phpunit/includes/api/ApiMainTest.php
index 54ecfba9875a..bf38a8e0d586 100644
--- a/tests/phpunit/includes/api/ApiMainTest.php
+++ b/tests/phpunit/includes/api/ApiMainTest.php
@@ -1212,7 +1212,7 @@ class ApiMainTest extends ApiTestCase {
?string $expectedVary,
string $expectedCacheControl,
array $requestData = [],
- Config $config = null
+ ?Config $config = null
) {
$req = new FauxRequest( $requestData );
$ctx = new RequestContext();
diff --git a/tests/phpunit/includes/api/ApiOptionsTest.php b/tests/phpunit/includes/api/ApiOptionsTest.php
index d0714d39a490..3ca600c0d5ad 100644
--- a/tests/phpunit/includes/api/ApiOptionsTest.php
+++ b/tests/phpunit/includes/api/ApiOptionsTest.php
@@ -382,7 +382,7 @@ class ApiOptionsTest extends ApiTestCase {
/**
* @dataProvider provideOptionManupulation
*/
- public function testOptionManupulation( array $params, array $setOptions, array $result = null,
+ public function testOptionManupulation( array $params, array $setOptions, ?array $result = null,
$message = ''
) {
$this->mUserMock->method( 'isRegistered' )->willReturn( true );
diff --git a/tests/phpunit/includes/api/ApiStashEditTest.php b/tests/phpunit/includes/api/ApiStashEditTest.php
index 8c2c36bf3943..98b209f18599 100644
--- a/tests/phpunit/includes/api/ApiStashEditTest.php
+++ b/tests/phpunit/includes/api/ApiStashEditTest.php
@@ -61,7 +61,7 @@ class ApiStashEditTest extends ApiTestCase {
* @return array
*/
protected function doStash(
- array $params = [], User $user = null, $expectedResult = 'stashed'
+ array $params = [], ?User $user = null, $expectedResult = 'stashed'
) {
$params = array_merge( [
'action' => 'stashedit',
@@ -134,7 +134,7 @@ class ApiStashEditTest extends ApiTestCase {
* @param User|null $user User who made edit
* @return string
*/
- protected function getStashKey( $title = self::CLASS_NAME, $text = 'Content', User $user = null ) {
+ protected function getStashKey( $title = self::CLASS_NAME, $text = 'Content', ?User $user = null ) {
$titleObj = Title::newFromText( $title );
$content = new WikitextContent( $text );
if ( !$user ) {
diff --git a/tests/phpunit/includes/api/ApiTestCase.php b/tests/phpunit/includes/api/ApiTestCase.php
index 7a01b454b385..40c4acbdf3f7 100644
--- a/tests/phpunit/includes/api/ApiTestCase.php
+++ b/tests/phpunit/includes/api/ApiTestCase.php
@@ -115,8 +115,8 @@ abstract class ApiTestCase extends MediaWikiLangTestCase {
* - if $appendModule is true, the Api module $module
* @throws ApiUsageException
*/
- protected function doApiRequest( array $params, array $session = null,
- $appendModule = false, Authority $performer = null, $tokenType = null,
+ protected function doApiRequest( array $params, ?array $session = null,
+ $appendModule = false, ?Authority $performer = null, $tokenType = null,
$paramPrefix = null
) {
global $wgRequest;
@@ -220,8 +220,8 @@ abstract class ApiTestCase extends MediaWikiLangTestCase {
* @param string|null $paramPrefix Prefix to prepend to parameters
* @return array Result of the API call
*/
- protected function doApiRequestWithToken( array $params, array $session = null,
- Authority $performer = null, $tokenType = 'auto', $paramPrefix = null
+ protected function doApiRequestWithToken( array $params, ?array $session = null,
+ ?Authority $performer = null, $tokenType = 'auto', $paramPrefix = null
) {
return $this->doApiRequest( $params, $session, false, $performer, $tokenType, $paramPrefix );
}
@@ -257,7 +257,7 @@ abstract class ApiTestCase extends MediaWikiLangTestCase {
* @param int $httpCode
*/
protected function setExpectedApiException(
- $msg, $code = null, array $data = null, $httpCode = 0
+ $msg, $code = null, ?array $data = null, $httpCode = 0
) {
$expected = ApiUsageException::newWithMessage( null, $msg, $code, $data, $httpCode );
$this->expectException( ApiUsageException::class );
diff --git a/tests/phpunit/includes/api/ApiTestContext.php b/tests/phpunit/includes/api/ApiTestContext.php
index c750bac78650..23d3299f711b 100644
--- a/tests/phpunit/includes/api/ApiTestContext.php
+++ b/tests/phpunit/includes/api/ApiTestContext.php
@@ -16,7 +16,7 @@ class ApiTestContext extends RequestContext {
* @param Authority|null $performer
* @return DerivativeContext
*/
- public function newTestContext( WebRequest $request, Authority $performer = null ) {
+ public function newTestContext( WebRequest $request, ?Authority $performer = null ) {
$context = new DerivativeContext( $this );
$context->setRequest( $request );
if ( $performer !== null ) {
diff --git a/tests/phpunit/includes/api/ApiUserrightsTest.php b/tests/phpunit/includes/api/ApiUserrightsTest.php
index ec9971bf4a2d..2c66655d7f6e 100644
--- a/tests/phpunit/includes/api/ApiUserrightsTest.php
+++ b/tests/phpunit/includes/api/ApiUserrightsTest.php
@@ -67,7 +67,7 @@ class ApiUserrightsTest extends ApiTestCase {
* or 'userid' is specified in $params.
*/
protected function doSuccessfulRightsChange(
- $expectedGroups = 'sysop', array $params = [], User $user = null
+ $expectedGroups = 'sysop', array $params = [], ?User $user = null
) {
$expectedGroups = (array)$expectedGroups;
$params['action'] = 'userrights';
@@ -107,7 +107,7 @@ class ApiUserrightsTest extends ApiTestCase {
* provided in $params), pass null.
*/
private function doFailedRightsChange(
- $expectedCode, array $params = [], User $user = null
+ $expectedCode, array $params = [], ?User $user = null
) {
$params['action'] = 'userrights';
$userGroupManager = $this->getServiceContainer()->getUserGroupManager();
diff --git a/tests/phpunit/includes/api/RandomImageGenerator.php b/tests/phpunit/includes/api/RandomImageGenerator.php
index 0640f7fbaccc..2f9996b54cc3 100644
--- a/tests/phpunit/includes/api/RandomImageGenerator.php
+++ b/tests/phpunit/includes/api/RandomImageGenerator.php
@@ -51,7 +51,7 @@ class RandomImageGenerator {
* @param string|null $dir Directory, optional (will default to current working directory)
* @return string[] Filenames we just wrote
*/
- public function writeImages( int $number, string $format = 'svg', string $dir = null ): array {
+ public function writeImages( int $number, string $format = 'svg', ?string $dir = null ): array {
$filenames = $this->getRandomFilenames( $number, $format, $dir ?? getcwd() );
$imageWriteMethod = $this->getImageWriteMethod( $format );
foreach ( $filenames as $filename ) {
diff --git a/tests/phpunit/includes/api/query/ApiQueryTestBase.php b/tests/phpunit/includes/api/query/ApiQueryTestBase.php
index 40e5c2a4515f..17f24579d81e 100644
--- a/tests/phpunit/includes/api/query/ApiQueryTestBase.php
+++ b/tests/phpunit/includes/api/query/ApiQueryTestBase.php
@@ -100,8 +100,8 @@ STR;
* @param bool $appendModule
* @param User|null $user
*/
- protected function check( $values, array $session = null,
- $appendModule = false, User $user = null
+ protected function check( $values, ?array $session = null,
+ $appendModule = false, ?User $user = null
) {
[ $req, $exp ] = $this->validateRequestExpectedPair( $values );
$req['action'] ??= 'query';
diff --git a/tests/phpunit/includes/cache/LinkCacheTest.php b/tests/phpunit/includes/cache/LinkCacheTest.php
index 9466d7c407b5..e66470d51c2e 100644
--- a/tests/phpunit/includes/cache/LinkCacheTest.php
+++ b/tests/phpunit/includes/cache/LinkCacheTest.php
@@ -18,7 +18,7 @@ use Wikimedia\Rdbms\IDBAccessObject;
class LinkCacheTest extends MediaWikiIntegrationTestCase {
use LinkCacheTestTrait;
- private function newLinkCache( WANObjectCache $wanCache = null ) {
+ private function newLinkCache( ?WANObjectCache $wanCache = null ) {
if ( !$wanCache ) {
$wanCache = new WANObjectCache( [ 'cache' => new EmptyBagOStuff() ] );
}
diff --git a/tests/phpunit/includes/content/CssContentTest.php b/tests/phpunit/includes/content/CssContentTest.php
index 822b114f74e8..b217115d2334 100644
--- a/tests/phpunit/includes/content/CssContentTest.php
+++ b/tests/phpunit/includes/content/CssContentTest.php
@@ -111,7 +111,7 @@ class CssContentTest extends TextContentTest {
/**
* @dataProvider dataEquals
*/
- public function testEquals( Content $a, Content $b = null, $equal = false ) {
+ public function testEquals( Content $a, ?Content $b = null, $equal = false ) {
$this->assertEquals( $equal, $a->equals( $b ) );
}
}
diff --git a/tests/phpunit/includes/content/FallbackContentTest.php b/tests/phpunit/includes/content/FallbackContentTest.php
index 1cb4f23689ea..fc89de698fba 100644
--- a/tests/phpunit/includes/content/FallbackContentTest.php
+++ b/tests/phpunit/includes/content/FallbackContentTest.php
@@ -137,7 +137,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
/**
* @dataProvider provideEquals
*/
- public function testEquals( Content $a, Content $b = null, $equal = false ) {
+ public function testEquals( Content $a, ?Content $b = null, $equal = false ) {
$this->assertEquals( $equal, $a->equals( $b ) );
}
diff --git a/tests/phpunit/includes/content/TextContentTest.php b/tests/phpunit/includes/content/TextContentTest.php
index 443aaade7a39..ab3626ef8685 100644
--- a/tests/phpunit/includes/content/TextContentTest.php
+++ b/tests/phpunit/includes/content/TextContentTest.php
@@ -208,7 +208,7 @@ class TextContentTest extends MediaWikiLangTestCase {
/**
* @dataProvider dataEquals
*/
- public function testEquals( Content $a, Content $b = null, $equal = false ) {
+ public function testEquals( Content $a, ?Content $b = null, $equal = false ) {
$this->assertEquals( $equal, $a->equals( $b ) );
}
diff --git a/tests/phpunit/includes/filerepo/AuthenticatedFileEntryPointTest.php b/tests/phpunit/includes/filerepo/AuthenticatedFileEntryPointTest.php
index 5192b730571d..cf0f95c1c063 100644
--- a/tests/phpunit/includes/filerepo/AuthenticatedFileEntryPointTest.php
+++ b/tests/phpunit/includes/filerepo/AuthenticatedFileEntryPointTest.php
@@ -140,7 +140,7 @@ class AuthenticatedFileEntryPointTest extends MediaWikiIntegrationTestCase {
*
* @return AuthenticatedFileEntryPoint
*/
- private function getEntryPoint( MockEnvironment $environment = null, $request = null ) {
+ private function getEntryPoint( ?MockEnvironment $environment = null, $request = null ) {
if ( !$request && $environment ) {
$request = $environment->getFauxRequest();
}
diff --git a/tests/phpunit/includes/filerepo/Thumbnail404EntryPointTest.php b/tests/phpunit/includes/filerepo/Thumbnail404EntryPointTest.php
index 622b1a61ec37..68b9d199d17e 100644
--- a/tests/phpunit/includes/filerepo/Thumbnail404EntryPointTest.php
+++ b/tests/phpunit/includes/filerepo/Thumbnail404EntryPointTest.php
@@ -81,7 +81,7 @@ class Thumbnail404EntryPointTest extends MediaWikiIntegrationTestCase {
* @return Thumbnail404EntryPoint
*/
private function getEntryPoint(
- MockEnvironment $environment = null,
+ ?MockEnvironment $environment = null,
$request = null
) {
if ( !$request && $environment ) {
diff --git a/tests/phpunit/includes/filerepo/ThumbnailEntryPointTest.php b/tests/phpunit/includes/filerepo/ThumbnailEntryPointTest.php
index 72936cb0c3c4..395ba41d4158 100644
--- a/tests/phpunit/includes/filerepo/ThumbnailEntryPointTest.php
+++ b/tests/phpunit/includes/filerepo/ThumbnailEntryPointTest.php
@@ -109,7 +109,7 @@ class ThumbnailEntryPointTest extends MediaWikiIntegrationTestCase {
* @return ThumbnailEntryPoint
*/
private function getEntryPoint(
- MockEnvironment $environment = null,
+ ?MockEnvironment $environment = null,
$request = null
) {
if ( !$request && $environment ) {
diff --git a/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php b/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php
index 51bc0c47e882..7ee7b1435424 100644
--- a/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php
+++ b/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php
@@ -198,7 +198,7 @@ trait SerializationTestTrait {
private function validateObjectEquality(
object $expected,
object $actual,
- ReflectionClass $class = null
+ ?ReflectionClass $class = null
) {
if ( !$class ) {
$class = new ReflectionClass( $expected );
diff --git a/tests/phpunit/includes/libs/serialization/SerializationTestUtils.php b/tests/phpunit/includes/libs/serialization/SerializationTestUtils.php
index f73cf6fa8e43..4395d2b54ac9 100644
--- a/tests/phpunit/includes/libs/serialization/SerializationTestUtils.php
+++ b/tests/phpunit/includes/libs/serialization/SerializationTestUtils.php
@@ -206,7 +206,7 @@ class SerializationTestUtils {
public function getStoredSerializedInstance(
string $class,
string $testCaseName,
- string $version = null
+ ?string $version = null
) {
$classFile = self::classToFile( $class );
$curPath = "$this->serializedDataPath/{$this->getCurrentVersion()}-$classFile-$testCaseName.$this->ext";
diff --git a/tests/phpunit/includes/logging/DatabaseLogEntryTest.php b/tests/phpunit/includes/logging/DatabaseLogEntryTest.php
index 4ff0a2e50d70..307de195b54e 100644
--- a/tests/phpunit/includes/logging/DatabaseLogEntryTest.php
+++ b/tests/phpunit/includes/logging/DatabaseLogEntryTest.php
@@ -23,8 +23,8 @@ class DatabaseLogEntryTest extends MediaWikiIntegrationTestCase {
*/
public function testNewFromId( $id,
array $selectFields,
- array $row = null,
- array $expectedFields = null
+ ?array $row = null,
+ ?array $expectedFields = null
) {
$row = $row ? (object)$row : null;
$db = $this->createMock( IReadableDatabase::class );
diff --git a/tests/phpunit/includes/media/SvgHandlerTest.php b/tests/phpunit/includes/media/SvgHandlerTest.php
index 0390a805b911..59d321bf383a 100644
--- a/tests/phpunit/includes/media/SvgHandlerTest.php
+++ b/tests/phpunit/includes/media/SvgHandlerTest.php
@@ -207,7 +207,7 @@ class SvgHandlerTest extends MediaWikiMediaTestCase {
$width,
$height,
array $params,
- array $paramsExpected = null
+ ?array $paramsExpected = null
) {
$this->overrideConfigValue( MainConfigNames::SVGMaxSize, 1000 );
diff --git a/tests/phpunit/includes/page/ArticleTest.php b/tests/phpunit/includes/page/ArticleTest.php
index d42797f1e6c2..00f9a8a4010a 100644
--- a/tests/phpunit/includes/page/ArticleTest.php
+++ b/tests/phpunit/includes/page/ArticleTest.php
@@ -21,7 +21,7 @@ class ArticleTest extends \MediaWikiIntegrationTestCase {
*
* @return Article
*/
- private function newArticle( Title $title, User $user = null ): Article {
+ private function newArticle( Title $title, ?User $user = null ): Article {
if ( !$user ) {
$user = $this->getTestUser()->getUser();
}
diff --git a/tests/phpunit/includes/page/WikiPageDbTest.php b/tests/phpunit/includes/page/WikiPageDbTest.php
index da277f87af4c..198c3fdf95d7 100644
--- a/tests/phpunit/includes/page/WikiPageDbTest.php
+++ b/tests/phpunit/includes/page/WikiPageDbTest.php
@@ -62,7 +62,7 @@ class WikiPageDbTest extends MediaWikiLangTestCase {
*
* @return WikiPage
*/
- protected function createPage( $page, $content, $model = null, Authority $performer = null ) {
+ protected function createPage( $page, $content, $model = null, ?Authority $performer = null ) {
if ( is_string( $page ) || $page instanceof Title ) {
$page = $this->newPage( $page, $model );
}
diff --git a/tests/phpunit/includes/parser/MagicWordFactoryTest.php b/tests/phpunit/includes/parser/MagicWordFactoryTest.php
index 52b41cde9321..da570f427c5a 100644
--- a/tests/phpunit/includes/parser/MagicWordFactoryTest.php
+++ b/tests/phpunit/includes/parser/MagicWordFactoryTest.php
@@ -16,7 +16,7 @@ use UnexpectedValueException;
* @author Derick N. Alangi
*/
class MagicWordFactoryTest extends MediaWikiIntegrationTestCase {
- private function makeMagicWordFactory( Language $contLang = null ) {
+ private function makeMagicWordFactory( ?Language $contLang = null ) {
$services = $this->getServiceContainer();
return new MagicWordFactory( $contLang ?:
$services->getLanguageFactory()->getLanguage( 'en' ),
diff --git a/tests/phpunit/includes/parser/ParserCacheTest.php b/tests/phpunit/includes/parser/ParserCacheTest.php
index ec24cdd66fb9..46b18c3f5356 100644
--- a/tests/phpunit/includes/parser/ParserCacheTest.php
+++ b/tests/phpunit/includes/parser/ParserCacheTest.php
@@ -79,10 +79,10 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
* @return ParserCache
*/
private function createParserCache(
- HookContainer $hookContainer = null,
- BagOStuff $storage = null,
- LoggerInterface $logger = null,
- WikiPageFactory $wikiPageFactory = null
+ ?HookContainer $hookContainer = null,
+ ?BagOStuff $storage = null,
+ ?LoggerInterface $logger = null,
+ ?WikiPageFactory $wikiPageFactory = null
): ParserCache {
if ( !$wikiPageFactory ) {
$wikiPageMock = $this->createMock( WikiPage::class );
diff --git a/tests/phpunit/includes/parser/ParserOptionsTest.php b/tests/phpunit/includes/parser/ParserOptionsTest.php
index 583a2594e6d5..0ebe76642514 100644
--- a/tests/phpunit/includes/parser/ParserOptionsTest.php
+++ b/tests/phpunit/includes/parser/ParserOptionsTest.php
@@ -169,7 +169,7 @@ class ParserOptionsTest extends MediaWikiLangTestCase {
* @param array $options Options to set
* @param array|null $usedOptions
*/
- public function testIsSafeToCache( bool $expect, array $options, array $usedOptions = null ) {
+ public function testIsSafeToCache( bool $expect, array $options, ?array $usedOptions = null ) {
$popt = ParserOptions::newFromAnon();
foreach ( $options as $name => $value ) {
$popt->setOption( $name, $value );
diff --git a/tests/phpunit/includes/parser/RevisionOutputCacheTest.php b/tests/phpunit/includes/parser/RevisionOutputCacheTest.php
index e34f1cc7afc9..a895a07acd0d 100644
--- a/tests/phpunit/includes/parser/RevisionOutputCacheTest.php
+++ b/tests/phpunit/includes/parser/RevisionOutputCacheTest.php
@@ -69,8 +69,8 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
* @return RevisionOutputCache
*/
private function createRevisionOutputCache(
- BagOStuff $storage = null,
- LoggerInterface $logger = null,
+ ?BagOStuff $storage = null,
+ ?LoggerInterface $logger = null,
$expiry = 3600,
$epoch = '19900220000000'
): RevisionOutputCache {
diff --git a/tests/phpunit/includes/poolcounter/PoolWorkArticleViewCurrentTest.php b/tests/phpunit/includes/poolcounter/PoolWorkArticleViewCurrentTest.php
index fd59024f5809..429c44e44c4e 100644
--- a/tests/phpunit/includes/poolcounter/PoolWorkArticleViewCurrentTest.php
+++ b/tests/phpunit/includes/poolcounter/PoolWorkArticleViewCurrentTest.php
@@ -29,7 +29,7 @@ class PoolWorkArticleViewCurrentTest extends PoolWorkArticleViewTest {
*/
protected function newPoolWorkArticleView(
WikiPage $page,
- RevisionRecord $rev = null,
+ ?RevisionRecord $rev = null,
$options = null
) {
if ( !$options ) {
diff --git a/tests/phpunit/includes/poolcounter/PoolWorkArticleViewOldTest.php b/tests/phpunit/includes/poolcounter/PoolWorkArticleViewOldTest.php
index 0a2a2495b07b..7ea61b92ed81 100644
--- a/tests/phpunit/includes/poolcounter/PoolWorkArticleViewOldTest.php
+++ b/tests/phpunit/includes/poolcounter/PoolWorkArticleViewOldTest.php
@@ -30,7 +30,7 @@ class PoolWorkArticleViewOldTest extends PoolWorkArticleViewTest {
*/
protected function newPoolWorkArticleView(
WikiPage $page,
- RevisionRecord $rev = null,
+ ?RevisionRecord $rev = null,
$options = null
) {
if ( !$options ) {
diff --git a/tests/phpunit/includes/poolcounter/PoolWorkArticleViewTest.php b/tests/phpunit/includes/poolcounter/PoolWorkArticleViewTest.php
index f5352cbc2d2c..982aaa12c456 100644
--- a/tests/phpunit/includes/poolcounter/PoolWorkArticleViewTest.php
+++ b/tests/phpunit/includes/poolcounter/PoolWorkArticleViewTest.php
@@ -37,7 +37,7 @@ class PoolWorkArticleViewTest extends MediaWikiIntegrationTestCase {
*/
protected function newPoolWorkArticleView(
WikiPage $page,
- RevisionRecord $rev = null,
+ ?RevisionRecord $rev = null,
$options = null
) {
if ( !$options ) {
diff --git a/tests/phpunit/includes/recentchanges/CategoryMembershipChangeTest.php b/tests/phpunit/includes/recentchanges/CategoryMembershipChangeTest.php
index 1db3ec9049f9..cc8cced7a616 100644
--- a/tests/phpunit/includes/recentchanges/CategoryMembershipChangeTest.php
+++ b/tests/phpunit/includes/recentchanges/CategoryMembershipChangeTest.php
@@ -66,7 +66,7 @@ class CategoryMembershipChangeTest extends MediaWikiLangTestCase {
self::$revUser = self::$pageRev->getUser( RevisionRecord::RAW );
}
- private function newChange( RevisionRecord $revision = null ) {
+ private function newChange( ?RevisionRecord $revision = null ) {
$title = Title::makeTitle( NS_MAIN, self::$pageName );
$blcFactory = $this->getServiceContainer()->getBacklinkCacheFactory();
$change = new CategoryMembershipChange(
diff --git a/tests/phpunit/includes/search/PrefixSearchTest.php b/tests/phpunit/includes/search/PrefixSearchTest.php
index 6614a886ca60..0673c26d61e4 100644
--- a/tests/phpunit/includes/search/PrefixSearchTest.php
+++ b/tests/phpunit/includes/search/PrefixSearchTest.php
@@ -63,7 +63,7 @@ class PrefixSearchTest extends MediaWikiLangTestCase {
] );
}
- protected function searchProvision( array $results = null ) {
+ protected function searchProvision( ?array $results = null ) {
if ( $results === null ) {
$this->overrideConfigValue( MainConfigNames::Hooks, [] );
} else {
diff --git a/tests/phpunit/includes/search/SearchEnginePrefixTest.php b/tests/phpunit/includes/search/SearchEnginePrefixTest.php
index d9697fc5b163..86b963f26c6e 100644
--- a/tests/phpunit/includes/search/SearchEnginePrefixTest.php
+++ b/tests/phpunit/includes/search/SearchEnginePrefixTest.php
@@ -65,7 +65,7 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase {
$this->search->setNamespaces( [] );
}
- protected function searchProvision( array $results = null ) {
+ protected function searchProvision( ?array $results = null ) {
if ( $results === null ) {
$this->overrideConfigValue( MainConfigNames::Hooks, [] );
} else {
diff --git a/tests/phpunit/includes/search/SearchResultThumbnailProviderTest.php b/tests/phpunit/includes/search/SearchResultThumbnailProviderTest.php
index 760257bef734..29f555b540bc 100644
--- a/tests/phpunit/includes/search/SearchResultThumbnailProviderTest.php
+++ b/tests/phpunit/includes/search/SearchResultThumbnailProviderTest.php
@@ -134,7 +134,7 @@ class SearchResultThumbnailProviderTest extends MediaWikiIntegrationTestCase {
* @param int[] $thumbnailIds
* @param int|null $size
*/
- public function testGetThumbnails( array $pageIds, array $thumbnailIds, int $size = null ) {
+ public function testGetThumbnails( array $pageIds, array $thumbnailIds, ?int $size = null ) {
$pageIdentities = array_intersect_key( $this->titles, array_fill_keys( $pageIds, null ) );
$thumbnails = $this->thumbnailProvider->getThumbnails( $pageIdentities, $size );
diff --git a/tests/phpunit/includes/session/SessionBackendTest.php b/tests/phpunit/includes/session/SessionBackendTest.php
index 1fb0472d3794..2fb66d6539fc 100644
--- a/tests/phpunit/includes/session/SessionBackendTest.php
+++ b/tests/phpunit/includes/session/SessionBackendTest.php
@@ -65,7 +65,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
* @param string|null $id
* @return SessionBackend
*/
- protected function getBackend( User $user = null, $id = null ) {
+ protected function getBackend( ?User $user = null, $id = null ) {
if ( !$this->config ) {
$this->config = new HashConfig();
$this->manager = null;
diff --git a/tests/phpunit/includes/session/TestUtils.php b/tests/phpunit/includes/session/TestUtils.php
index 520f8bb1c2bc..31aefcaa634d 100644
--- a/tests/phpunit/includes/session/TestUtils.php
+++ b/tests/phpunit/includes/session/TestUtils.php
@@ -23,7 +23,7 @@ class TestUtils {
* @param SessionManager|null $manager
* @return ScopedCallback|null
*/
- public static function setSessionManagerSingleton( SessionManager $manager = null ) {
+ public static function setSessionManagerSingleton( ?SessionManager $manager = null ) {
session_write_close();
$staticAccess = TestingAccessWrapper::newFromClass( SessionManager::class );
diff --git a/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php b/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
index 83b2c6c40fd8..fe4b84d12554 100644
--- a/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
+++ b/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
@@ -69,7 +69,7 @@ class ChangesListSpecialPageTest extends AbstractChangesListSpecialPageTestCase
private function buildQuery(
array $requestOptions,
- User $user = null
+ ?User $user = null
): array {
$context = new RequestContext;
$context->setRequest( new FauxRequest( $requestOptions ) );
@@ -122,7 +122,7 @@ class ChangesListSpecialPageTest extends AbstractChangesListSpecialPageTestCase
array $expected,
array $requestOptions,
string $message,
- User $user = null
+ ?User $user = null
) {
$queryConditions = $this->buildQuery( $requestOptions, $user );
diff --git a/tests/phpunit/includes/specials/ContribsPagerTest.php b/tests/phpunit/includes/specials/ContribsPagerTest.php
index bd03c9896fbc..688a384f0b4e 100644
--- a/tests/phpunit/includes/specials/ContribsPagerTest.php
+++ b/tests/phpunit/includes/specials/ContribsPagerTest.php
@@ -70,7 +70,7 @@ class ContribsPagerTest extends MediaWikiIntegrationTestCase {
] );
}
- private function getContribsPager( array $options, UserIdentity $targetUser = null ) {
+ private function getContribsPager( array $options, ?UserIdentity $targetUser = null ) {
return new ContribsPager(
new RequestContext(),
$options,
diff --git a/tests/phpunit/includes/specials/SpecialPageExecutor.php b/tests/phpunit/includes/specials/SpecialPageExecutor.php
index bce67a8539b5..61091b7145c0 100644
--- a/tests/phpunit/includes/specials/SpecialPageExecutor.php
+++ b/tests/phpunit/includes/specials/SpecialPageExecutor.php
@@ -34,9 +34,9 @@ class SpecialPageExecutor {
public function executeSpecialPage(
SpecialPage $page,
$subPage = '',
- WebRequest $request = null,
+ ?WebRequest $request = null,
$language = null,
- Authority $performer = null,
+ ?Authority $performer = null,
$fullHtml = false
) {
$context = $this->newContext( $request, $language, $performer );
@@ -69,9 +69,9 @@ class SpecialPageExecutor {
* @return DerivativeContext
*/
private function newContext(
- WebRequest $request = null,
+ ?WebRequest $request = null,
$language = null,
- Authority $performer = null
+ ?Authority $performer = null
) {
$context = new DerivativeContext( RequestContext::getMain() );
diff --git a/tests/phpunit/includes/specials/SpecialPageTestBase.php b/tests/phpunit/includes/specials/SpecialPageTestBase.php
index 7cabaf63c1bb..377f73cccec3 100644
--- a/tests/phpunit/includes/specials/SpecialPageTestBase.php
+++ b/tests/phpunit/includes/specials/SpecialPageTestBase.php
@@ -67,9 +67,9 @@ abstract class SpecialPageTestBase extends MediaWikiIntegrationTestCase {
*/
protected function executeSpecialPage(
$subPage = '',
- WebRequest $request = null,
+ ?WebRequest $request = null,
$language = null,
- Authority $performer = null,
+ ?Authority $performer = null,
$fullHtml = false
) {
return ( new SpecialPageExecutor() )->executeSpecialPage(
diff --git a/tests/phpunit/includes/specials/SpecialRecentChangesTest.php b/tests/phpunit/includes/specials/SpecialRecentChangesTest.php
index d49956bfce9e..33b56fbfd83b 100644
--- a/tests/phpunit/includes/specials/SpecialRecentChangesTest.php
+++ b/tests/phpunit/includes/specials/SpecialRecentChangesTest.php
@@ -227,9 +227,9 @@ class SpecialRecentChangesTest extends AbstractChangesListSpecialPageTestCase {
public function __construct(
$dense,
- WatchedItemStoreInterface $watchedItemStore = null,
- MessageCache $messageCache = null,
- \MediaWiki\User\Options\UserOptionsLookup $userOptionsLookup = null
+ ?WatchedItemStoreInterface $watchedItemStore = null,
+ ?MessageCache $messageCache = null,
+ ?\MediaWiki\User\Options\UserOptionsLookup $userOptionsLookup = null
) {
parent::__construct( $watchedItemStore, $messageCache, $userOptionsLookup );
$this->dense = $dense;
diff --git a/tests/phpunit/includes/specials/redirects/SpecialTalkPageTest.php b/tests/phpunit/includes/specials/redirects/SpecialTalkPageTest.php
index fe3da7efcee6..94dfa5f834a7 100644
--- a/tests/phpunit/includes/specials/redirects/SpecialTalkPageTest.php
+++ b/tests/phpunit/includes/specials/redirects/SpecialTalkPageTest.php
@@ -18,7 +18,7 @@ class SpecialTalkPageTest extends MediaWikiIntegrationTestCase {
private function executeSpecialPageAndGetOutput(
string $subpage = '',
- string $target = null
+ ?string $target = null
): OutputPage {
$services = $this->getServiceContainer();
$context = new RequestContext();
diff --git a/tests/phpunit/includes/title/NamespaceInfoTest.php b/tests/phpunit/includes/title/NamespaceInfoTest.php
index 280ae3affc79..ac1e5f76c71f 100644
--- a/tests/phpunit/includes/title/NamespaceInfoTest.php
+++ b/tests/phpunit/includes/title/NamespaceInfoTest.php
@@ -372,7 +372,7 @@ class NamespaceInfoTest extends MediaWikiIntegrationTestCase {
* @covers \MediaWiki\Title\NamespaceInfo::hasSubpages
* @dataProvider provideHasSubpages
*/
- public function testHasSubpages( $ns, $expected, array $namespacesWithSubpages = null ) {
+ public function testHasSubpages( $ns, $expected, ?array $namespacesWithSubpages = null ) {
$obj = $this->newObj( $namespacesWithSubpages
? [ MainConfigNames::NamespacesWithSubpages => $namespacesWithSubpages ]
: [] );
diff --git a/tests/phpunit/includes/user/TalkPageNotificationManagerTest.php b/tests/phpunit/includes/user/TalkPageNotificationManagerTest.php
index 70aada71125c..97c7f34d5494 100644
--- a/tests/phpunit/includes/user/TalkPageNotificationManagerTest.php
+++ b/tests/phpunit/includes/user/TalkPageNotificationManagerTest.php
@@ -40,7 +40,7 @@ class TalkPageNotificationManagerTest extends MediaWikiIntegrationTestCase {
private function getManager(
bool $disableAnonTalk = false,
bool $isReadOnly = false,
- RevisionLookup $revisionLookup = null
+ ?RevisionLookup $revisionLookup = null
) {
$services = $this->getServiceContainer();
return new TalkPageNotificationManager(
diff --git a/tests/phpunit/includes/user/UserGroupManagerTest.php b/tests/phpunit/includes/user/UserGroupManagerTest.php
index ef1853db1fa8..020feafd9127 100644
--- a/tests/phpunit/includes/user/UserGroupManagerTest.php
+++ b/tests/phpunit/includes/user/UserGroupManagerTest.php
@@ -65,8 +65,8 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
*/
private function getManager(
array $configOverrides = [],
- UserEditTracker $userEditTrackerOverride = null,
- callable $callback = null
+ ?UserEditTracker $userEditTrackerOverride = null,
+ ?callable $callback = null
): UserGroupManager {
$services = $this->getServiceContainer();
return new UserGroupManager(
@@ -145,7 +145,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
UserGroupManager $manager,
UserIdentity $user,
string $group,
- string $expiry = null
+ ?string $expiry = null
) {
$this->assertContains( $group, $manager->getUserGroups( $user ) );
$memberships = $manager->getUserGroupMemberships( $user );
diff --git a/tests/phpunit/integration/includes/CommentFormatter/CommentFormatterTest.php b/tests/phpunit/integration/includes/CommentFormatter/CommentFormatterTest.php
index dfbf20136ab9..6c545ed04af5 100644
--- a/tests/phpunit/integration/includes/CommentFormatter/CommentFormatterTest.php
+++ b/tests/phpunit/integration/includes/CommentFormatter/CommentFormatterTest.php
@@ -33,7 +33,7 @@ class CommentFormatterTest extends MediaWikiIntegrationTestCase {
}
public function preprocess(
- string $comment, LinkTarget $selfLinkTarget = null, $samePage = false,
+ string $comment, ?LinkTarget $selfLinkTarget = null, $samePage = false,
$wikiId = null, $enableSectionLinks = true
) {
if ( $comment === '' || $comment === '*' ) {
@@ -49,7 +49,7 @@ class CommentFormatterTest extends MediaWikiIntegrationTestCase {
}
public function preprocessUnsafe(
- $comment, LinkTarget $selfLinkTarget = null, $samePage = false, $wikiId = null,
+ $comment, ?LinkTarget $selfLinkTarget = null, $samePage = false, $wikiId = null,
$enableSectionLinks = true
) {
return CommentFormatterTestUtils::dumpArray( [
diff --git a/tests/phpunit/integration/includes/CommentFormatter/RowCommentFormatterTest.php b/tests/phpunit/integration/includes/CommentFormatter/RowCommentFormatterTest.php
index 8ff2272dd3bf..642da7043fab 100644
--- a/tests/phpunit/integration/includes/CommentFormatter/RowCommentFormatterTest.php
+++ b/tests/phpunit/integration/includes/CommentFormatter/RowCommentFormatterTest.php
@@ -21,7 +21,7 @@ class RowCommentFormatterTest extends \MediaWikiIntegrationTestCase {
}
public function preprocess(
- string $comment, LinkTarget $selfLinkTarget = null, $samePage = false,
+ string $comment, ?LinkTarget $selfLinkTarget = null, $samePage = false,
$wikiId = null, $enableSectionLinks = true
) {
if ( $comment === '' || $comment === '*' ) {
diff --git a/tests/phpunit/integration/includes/Permissions/RateLimiterTest.php b/tests/phpunit/integration/includes/Permissions/RateLimiterTest.php
index 5def5aa2767a..36d959bb6b6e 100644
--- a/tests/phpunit/integration/includes/Permissions/RateLimiterTest.php
+++ b/tests/phpunit/integration/includes/Permissions/RateLimiterTest.php
@@ -370,7 +370,7 @@ class RateLimiterTest extends MediaWikiIntegrationTestCase {
protected function newRateLimiter(
array $limits,
array $excludedIPs,
- WRStatsFactory $statsFactory = null
+ ?WRStatsFactory $statsFactory = null
): RateLimiter {
$statsFactory ??= new WRStatsFactory( new BagOStuffStatsStore( new HashBagOStuff() ) );
diff --git a/tests/phpunit/integration/includes/Rest/Handler/HTMLHandlerTestTrait.php b/tests/phpunit/integration/includes/Rest/Handler/HTMLHandlerTestTrait.php
index 887bea3524a8..ed6ba434fb62 100644
--- a/tests/phpunit/integration/includes/Rest/Handler/HTMLHandlerTestTrait.php
+++ b/tests/phpunit/integration/includes/Rest/Handler/HTMLHandlerTestTrait.php
@@ -58,7 +58,7 @@ trait HTMLHandlerTestTrait {
WikiPage $page,
array $queryParams = [],
array $config = [],
- Authority $authority = null
+ ?Authority $authority = null
): array {
$handler = $this->newHandler();
$request = new RequestData( [
@@ -92,7 +92,7 @@ trait HTMLHandlerTestTrait {
int $revId,
array $queryParams = [],
array $config = [],
- Authority $authority = null
+ ?Authority $authority = null
): array {
$handler = $this->newHandler();
$request = new RequestData( [
diff --git a/tests/phpunit/integration/includes/Rest/Handler/Helper/HtmlOutputRendererHelperTest.php b/tests/phpunit/integration/includes/Rest/Handler/Helper/HtmlOutputRendererHelperTest.php
index d08dee5bdbae..4e03f25d23a0 100644
--- a/tests/phpunit/integration/includes/Rest/Handler/Helper/HtmlOutputRendererHelperTest.php
+++ b/tests/phpunit/integration/includes/Rest/Handler/Helper/HtmlOutputRendererHelperTest.php
@@ -152,7 +152,7 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
string $html,
$rev,
PageIdentity $page,
- string $version = null
+ ?string $version = null
): ParserOutput {
static $counter = 0;
$lang = $parserOpts->getTargetLanguage();
diff --git a/tests/phpunit/integration/includes/Rest/Handler/Helper/PageContentHelperTest.php b/tests/phpunit/integration/includes/Rest/Handler/Helper/PageContentHelperTest.php
index 2e746a928dca..2f095a95ba08 100644
--- a/tests/phpunit/integration/includes/Rest/Handler/Helper/PageContentHelperTest.php
+++ b/tests/phpunit/integration/includes/Rest/Handler/Helper/PageContentHelperTest.php
@@ -38,7 +38,7 @@ class PageContentHelperTest extends MediaWikiIntegrationTestCase {
*/
private function newHelper(
array $params = [],
- Authority $authority = null
+ ?Authority $authority = null
): PageContentHelper {
$helper = new PageContentHelper(
new ServiceOptions(
diff --git a/tests/phpunit/integration/includes/Rest/Handler/Helper/RevisionContentHelperTest.php b/tests/phpunit/integration/includes/Rest/Handler/Helper/RevisionContentHelperTest.php
index 4620bb23e245..9e809a73ea44 100644
--- a/tests/phpunit/integration/includes/Rest/Handler/Helper/RevisionContentHelperTest.php
+++ b/tests/phpunit/integration/includes/Rest/Handler/Helper/RevisionContentHelperTest.php
@@ -33,7 +33,7 @@ class RevisionContentHelperTest extends MediaWikiIntegrationTestCase {
*/
private function newHelper(
array $params = [],
- Authority $authority = null
+ ?Authority $authority = null
): RevisionContentHelper {
$helper = new RevisionContentHelper(
new ServiceOptions(
diff --git a/tests/phpunit/integration/includes/Rest/Handler/RevisionSourceHandlerTest.php b/tests/phpunit/integration/includes/Rest/Handler/RevisionSourceHandlerTest.php
index 7ba4904830fc..a0ad931aed84 100644
--- a/tests/phpunit/integration/includes/Rest/Handler/RevisionSourceHandlerTest.php
+++ b/tests/phpunit/integration/includes/Rest/Handler/RevisionSourceHandlerTest.php
@@ -39,7 +39,7 @@ class RevisionSourceHandlerTest extends MediaWikiIntegrationTestCase {
* @return RevisionSourceHandler
* @throws Exception
*/
- private function newHandler( BagOStuff $cache = null ): RevisionSourceHandler {
+ private function newHandler( ?BagOStuff $cache = null ): RevisionSourceHandler {
$handler = new RevisionSourceHandler(
$this->getServiceContainer()->getPageRestHelperFactory()
);
diff --git a/tests/phpunit/integration/includes/parser/Parsoid/HtmlToContentTransformTest.php b/tests/phpunit/integration/includes/parser/Parsoid/HtmlToContentTransformTest.php
index 8c07609d30ae..5b5b6e3849b1 100644
--- a/tests/phpunit/integration/includes/parser/Parsoid/HtmlToContentTransformTest.php
+++ b/tests/phpunit/integration/includes/parser/Parsoid/HtmlToContentTransformTest.php
@@ -66,7 +66,7 @@ class HtmlToContentTransformTest extends MediaWikiIntegrationTestCase {
);
}
- private function createHtmlToContentTransformWithOriginalData( $html = '', array $options = null ) {
+ private function createHtmlToContentTransformWithOriginalData( $html = '', ?array $options = null ) {
$transform = $this->createHtmlToContentTransform( $html );
$options ??= [
diff --git a/tests/phpunit/maintenance/DumpAsserter.php b/tests/phpunit/maintenance/DumpAsserter.php
index 53ec058b50e6..24a18b8f8dd9 100644
--- a/tests/phpunit/maintenance/DumpAsserter.php
+++ b/tests/phpunit/maintenance/DumpAsserter.php
@@ -557,7 +557,7 @@ class DumpAsserter {
*
* @return int
*/
- public function getLineNumber( XMLReader $xml = null ) {
+ public function getLineNumber( ?XMLReader $xml = null ) {
$xml ??= $this->xml;
if ( $xml->nodeType == XMLReader::NONE ) {
@@ -680,7 +680,7 @@ class DumpAsserter {
return $text;
}
- private function getAttributeArray( XMLReader $xml = null ) {
+ private function getAttributeArray( ?XMLReader $xml = null ) {
if ( !$xml ) {
$xml = $this->xml;
}
diff --git a/tests/phpunit/mocks/permissions/MockAuthorityTrait.php b/tests/phpunit/mocks/permissions/MockAuthorityTrait.php
index f2f48651b5ce..275423be8be1 100644
--- a/tests/phpunit/mocks/permissions/MockAuthorityTrait.php
+++ b/tests/phpunit/mocks/permissions/MockAuthorityTrait.php
@@ -269,7 +269,7 @@ trait MockAuthorityTrait {
private function mockAuthority(
UserIdentity $user,
callable $permissionCallback,
- Block $block = null,
+ ?Block $block = null,
bool $isTemp = false
): Authority {
$mock = $this->createMock( Authority::class );
@@ -428,7 +428,7 @@ trait MockAuthorityTrait {
return $permissionManager;
}
- private function newUser( Block $block = null, bool $isTemp = false ): User {
+ private function newUser( ?Block $block = null, bool $isTemp = false ): User {
/** @var User&MockObject $actor */
$actor = $this->createNoOpMock( User::class, [ 'getBlock', 'isNewbie', 'toRateLimitSubject' ] );
$actor->method( 'getBlock' )->willReturn( $block );
diff --git a/tests/phpunit/suites/ParserIntegrationTest.php b/tests/phpunit/suites/ParserIntegrationTest.php
index 3713f806b7ef..b73ba9f54f4e 100644
--- a/tests/phpunit/suites/ParserIntegrationTest.php
+++ b/tests/phpunit/suites/ParserIntegrationTest.php
@@ -50,7 +50,7 @@ class ParserIntegrationTest extends PHPUnit\Framework\TestCase {
string $fileName,
ParserTest $test,
ParserTestMode $mode,
- string $skipMessage = null
+ ?string $skipMessage = null
) {
parent::__construct(
'testParse',
diff --git a/tests/phpunit/suites/ParserTestTopLevelSuite.php b/tests/phpunit/suites/ParserTestTopLevelSuite.php
index 18a9347a6778..83bd67b59c81 100644
--- a/tests/phpunit/suites/ParserTestTopLevelSuite.php
+++ b/tests/phpunit/suites/ParserTestTopLevelSuite.php
@@ -74,7 +74,7 @@ class ParserTestTopLevelSuite extends TestSuite {
return new self( $flags );
}
- public function __construct( $flags, array $parserTestFlags = null ) {
+ public function __construct( $flags, ?array $parserTestFlags = null ) {
parent::__construct();
$this->ptRecorder = new PhpunitTestRecorder;
diff --git a/tests/phpunit/suites/SuiteEventsTrait.php b/tests/phpunit/suites/SuiteEventsTrait.php
index b599bb28d600..87524d2f0388 100644
--- a/tests/phpunit/suites/SuiteEventsTrait.php
+++ b/tests/phpunit/suites/SuiteEventsTrait.php
@@ -15,7 +15,7 @@ trait SuiteEventsTrait {
/**
* @inheritDoc
*/
- public function run( TestResult $result = null ): TestResult {
+ public function run( ?TestResult $result = null ): TestResult {
// setUp / tearDown handling based on code in TestSuite::run()
// (except in the parent only beforeClass / afterClass are run)
$result ??= $this->createResult();
diff --git a/tests/phpunit/unit/includes/Message/MessageFormatterFactoryTest.php b/tests/phpunit/unit/includes/Message/MessageFormatterFactoryTest.php
index 8680d93b7ab4..4688061fb8ff 100644
--- a/tests/phpunit/unit/includes/Message/MessageFormatterFactoryTest.php
+++ b/tests/phpunit/unit/includes/Message/MessageFormatterFactoryTest.php
@@ -21,7 +21,7 @@ class MessageFormatterFactoryTest extends MediaWikiUnitTestCase {
* @param string $lang
* @param string|null $format
*/
- public function testGetTextFormatter( string $lang, string $format = null ) {
+ public function testGetTextFormatter( string $lang, ?string $format = null ) {
if ( $format ) {
$factory = new MessageFormatterFactory( $format );
} else {
diff --git a/tests/phpunit/unit/includes/Rest/Handler/ActionModuleBasedHandlerTestTrait.php b/tests/phpunit/unit/includes/Rest/Handler/ActionModuleBasedHandlerTestTrait.php
index 3282e609a3b2..837cc9e8f50f 100644
--- a/tests/phpunit/unit/includes/Rest/Handler/ActionModuleBasedHandlerTestTrait.php
+++ b/tests/phpunit/unit/includes/Rest/Handler/ActionModuleBasedHandlerTestTrait.php
@@ -35,7 +35,7 @@ trait ActionModuleBasedHandlerTestTrait {
ApiMain $main,
$name,
$resultData,
- Exception $throwException = null
+ ?Exception $throwException = null
) {
/** @var ApiBase|MockObject $module */
$module = $this->getMockBuilder( ApiBase::class )
diff --git a/tests/phpunit/unit/includes/Rest/Handler/HandlerTestTrait.php b/tests/phpunit/unit/includes/Rest/Handler/HandlerTestTrait.php
index cf0695c65072..3a64f2a7794d 100644
--- a/tests/phpunit/unit/includes/Rest/Handler/HandlerTestTrait.php
+++ b/tests/phpunit/unit/includes/Rest/Handler/HandlerTestTrait.php
@@ -52,8 +52,8 @@ trait HandlerTestTrait {
RequestInterface $request,
$config = [],
$hooks = [],
- Authority $authority = null,
- Session $session = null,
+ ?Authority $authority = null,
+ ?Session $session = null,
$routerOrModule = null
) {
$formatter = $this->getDummyTextFormatter( true );
@@ -153,7 +153,7 @@ trait HandlerTestTrait {
*/
private function validateHandler(
Handler $handler,
- Validator $validator = null
+ ?Validator $validator = null
) {
if ( !$validator ) {
$serviceContainer = $this->getServiceContainer();
@@ -209,8 +209,8 @@ trait HandlerTestTrait {
$hooks = [],
$validatedParams = [],
$validatedBody = [],
- Authority $authority = null,
- Session $session = null,
+ ?Authority $authority = null,
+ ?Session $session = null,
$routerOrModule = null
): ResponseInterface {
// supply defaults for required fields in $config
@@ -262,8 +262,8 @@ trait HandlerTestTrait {
$hooks = [],
$validatedParams = [],
$validatedBody = [],
- Authority $authority = null,
- Session $session = null
+ ?Authority $authority = null,
+ ?Session $session = null
): array {
$response = $this->executeHandler( $handler, $request, $config, $hooks,
$validatedParams, $validatedBody, $authority, $session );
diff --git a/tests/phpunit/unit/includes/Rest/Handler/SearchHandlerTest.php b/tests/phpunit/unit/includes/Rest/Handler/SearchHandlerTest.php
index 037a59290efb..001e65e9e6a8 100644
--- a/tests/phpunit/unit/includes/Rest/Handler/SearchHandlerTest.php
+++ b/tests/phpunit/unit/includes/Rest/Handler/SearchHandlerTest.php
@@ -75,7 +75,7 @@ class SearchHandlerTest extends MediaWikiUnitTestCase {
$redirectLookup = null,
$pageStore = null,
$mockTitleFormatter = null,
- HookContainer $hookContainer = null
+ ?HookContainer $hookContainer = null
) {
$sources = [
MainConfigNames::SearchType => 'test',
diff --git a/tests/phpunit/unit/includes/Revision/SlotRoleRegistryTest.php b/tests/phpunit/unit/includes/Revision/SlotRoleRegistryTest.php
index 76f29cfa5baf..415f78b8c967 100644
--- a/tests/phpunit/unit/includes/Revision/SlotRoleRegistryTest.php
+++ b/tests/phpunit/unit/includes/Revision/SlotRoleRegistryTest.php
@@ -30,7 +30,7 @@ class SlotRoleRegistryTest extends MediaWikiUnitTestCase {
return $mock;
}
- private function newSlotRoleRegistry( NameTableStore $roleNameStore = null ) {
+ private function newSlotRoleRegistry( ?NameTableStore $roleNameStore = null ) {
if ( !$roleNameStore ) {
$roleNameStore = $this->makeNameTableStore();
}
diff --git a/tests/phpunit/unit/includes/auth/AuthenticationProviderTestTrait.php b/tests/phpunit/unit/includes/auth/AuthenticationProviderTestTrait.php
index 7284d6cfaeb0..7605e02c914f 100644
--- a/tests/phpunit/unit/includes/auth/AuthenticationProviderTestTrait.php
+++ b/tests/phpunit/unit/includes/auth/AuthenticationProviderTestTrait.php
@@ -33,11 +33,11 @@ trait AuthenticationProviderTestTrait {
*/
private function initProvider(
AbstractAuthenticationProvider $provider,
- Config $config = null,
- LoggerInterface $logger = null,
- AuthManager $manager = null,
- HookContainer $hookContainer = null,
- UserNameUtils $userNameUtils = null
+ ?Config $config = null,
+ ?LoggerInterface $logger = null,
+ ?AuthManager $manager = null,
+ ?HookContainer $hookContainer = null,
+ ?UserNameUtils $userNameUtils = null
) {
$provider->init(
$logger ?? new NullLogger(),
diff --git a/tests/phpunit/unit/includes/block/BlockUtilsTest.php b/tests/phpunit/unit/includes/block/BlockUtilsTest.php
index deabdc4d51f1..32f897d11221 100644
--- a/tests/phpunit/unit/includes/block/BlockUtilsTest.php
+++ b/tests/phpunit/unit/includes/block/BlockUtilsTest.php
@@ -26,7 +26,7 @@ class BlockUtilsTest extends MediaWikiUnitTestCase {
*/
private function getUtils(
array $options = [],
- UserIdentityLookup $userIdentityLookup = null
+ ?UserIdentityLookup $userIdentityLookup = null
) {
$baseOptions = [
MainConfigNames::BlockCIDRLimit => [
diff --git a/tests/phpunit/unit/includes/libs/ParamValidator/TypeDefTest.php b/tests/phpunit/unit/includes/libs/ParamValidator/TypeDefTest.php
index a258a8451c5c..ab4fa38b7bc2 100644
--- a/tests/phpunit/unit/includes/libs/ParamValidator/TypeDefTest.php
+++ b/tests/phpunit/unit/includes/libs/ParamValidator/TypeDefTest.php
@@ -67,7 +67,7 @@ class TypeDefTest extends TestCase {
}
/** @dataProvider provideFailureMessage */
- public function testFailureMessage( $expect, $code, array $data = null, $suffix = null ) {
+ public function testFailureMessage( $expect, $code, ?array $data = null, $suffix = null ) {
$typeDef = $this->getMockBuilder( TypeDef::class )
->setConstructorArgs( [ new SimpleCallbacks( [] ) ] )
->getMockForAbstractClass();
diff --git a/tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php b/tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php
index 7d34478e24fe..ce99106e8f1d 100644
--- a/tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php
+++ b/tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php
@@ -83,7 +83,7 @@ class DBConnRefTest extends TestCase {
* @param ILoadBalancer|null $lb
* @return IDatabase
*/
- private function getDBConnRef( ILoadBalancer $lb = null ) {
+ private function getDBConnRef( ?ILoadBalancer $lb = null ) {
$lb ??= $this->getLoadBalancerMock();
return new DBConnRef( $lb, [ DB_PRIMARY, [], 'mywiki', 0 ], DB_PRIMARY );
}
diff --git a/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php b/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php
index 3c513068fd5a..d246b76f9448 100644
--- a/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php
+++ b/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php
@@ -129,7 +129,7 @@ class DatabaseTest extends TestCase {
/**
* @dataProvider provideTableName
*/
- public function testTableName( $expected, $table, $format, array $alias = null ) {
+ public function testTableName( $expected, $table, $format, ?array $alias = null ) {
// Use MockDatabase to avoid useless stub SQLPlatformTestHelper::addIdentifierQuotes
$db = new MockDatabase();
if ( $alias ) {
diff --git a/tests/phpunit/unit/includes/mail/EmailUserTest.php b/tests/phpunit/unit/includes/mail/EmailUserTest.php
index 6b8392690a20..01cf063d1551 100644
--- a/tests/phpunit/unit/includes/mail/EmailUserTest.php
+++ b/tests/phpunit/unit/includes/mail/EmailUserTest.php
@@ -28,12 +28,12 @@ use Wikimedia\Message\ITextFormatter;
class EmailUserTest extends MediaWikiUnitTestCase {
private function getEmailUser(
Authority $sender,
- UserOptionsLookup $userOptionsLookup = null,
- CentralIdLookup $centralIdLookup = null,
- UserFactory $userFactory = null,
+ ?UserOptionsLookup $userOptionsLookup = null,
+ ?CentralIdLookup $centralIdLookup = null,
+ ?UserFactory $userFactory = null,
array $configOverrides = [],
array $hooks = [],
- IEmailer $emailer = null
+ ?IEmailer $emailer = null
): EmailUser {
$options = new ServiceOptions(
EmailUser::CONSTRUCTOR_OPTIONS,
@@ -66,8 +66,8 @@ class EmailUserTest extends MediaWikiUnitTestCase {
User $target,
User $sender,
StatusValue $expected,
- UserOptionsLookup $userOptionsLookup = null,
- CentralIdLookup $centralIdLookup = null
+ ?UserOptionsLookup $userOptionsLookup = null,
+ ?CentralIdLookup $centralIdLookup = null
) {
$userFactory = $this->createMock( UserFactory::class );
$userFactory->method( 'newFromAuthority' )->willReturn( $sender );
@@ -350,7 +350,7 @@ class EmailUserTest extends MediaWikiUnitTestCase {
Authority $sender,
StatusValue $expected,
array $hooks = [],
- IEmailer $emailer = null
+ ?IEmailer $emailer = null
) {
$userFactory = $this->createMock( UserFactory::class );
$userFactory->method( 'newFromUserIdentity' )
diff --git a/tests/phpunit/unit/includes/page/DeletePageTest.php b/tests/phpunit/unit/includes/page/DeletePageTest.php
index eeeb662afb3b..6d771012011e 100644
--- a/tests/phpunit/unit/includes/page/DeletePageTest.php
+++ b/tests/phpunit/unit/includes/page/DeletePageTest.php
@@ -79,11 +79,11 @@ class DeletePageTest extends MediaWikiUnitTestCase {
private function getDeletePage(
ProperPageIdentity $page,
- Authority $deleter = null,
- ServiceOptions $options = null,
- RevisionStore $revStore = null,
- WikiPageFactory $wpFactory = null,
- NamespaceInfo $nsInfo = null
+ ?Authority $deleter = null,
+ ?ServiceOptions $options = null,
+ ?RevisionStore $revStore = null,
+ ?WikiPageFactory $wpFactory = null,
+ ?NamespaceInfo $nsInfo = null
): DeletePage {
if ( !$wpFactory ) {
$wpFactory = $this->createMock( WikiPageFactory::class );
@@ -131,9 +131,9 @@ class DeletePageTest extends MediaWikiUnitTestCase {
public function testPermissions(
Authority $authority,
bool $expectedGood,
- string $expectedMessage = null,
- ServiceOptions $options = null,
- RevisionStore $revStore = null
+ ?string $expectedMessage = null,
+ ?ServiceOptions $options = null,
+ ?RevisionStore $revStore = null
) {
$dp = $this->getDeletePage(
$this->getMockPage(),
diff --git a/tests/phpunit/unit/includes/page/UndeletePageTest.php b/tests/phpunit/unit/includes/page/UndeletePageTest.php
index f010f9761ded..542911750aa1 100644
--- a/tests/phpunit/unit/includes/page/UndeletePageTest.php
+++ b/tests/phpunit/unit/includes/page/UndeletePageTest.php
@@ -38,10 +38,10 @@ class UndeletePageTest extends MediaWikiUnitTestCase {
* @return UndeletePage
*/
private function getUndeletePage(
- ProperPageIdentity $page = null,
- WikiPageFactory $wpFactory = null,
- NamespaceInfo $namespaceInfo = null,
- ArchivedRevisionLookup $archivedRevisionLookup = null
+ ?ProperPageIdentity $page = null,
+ ?WikiPageFactory $wpFactory = null,
+ ?NamespaceInfo $namespaceInfo = null,
+ ?ArchivedRevisionLookup $archivedRevisionLookup = null
): UndeletePage {
return new UndeletePage(
$this->createHookContainer(),
diff --git a/tests/phpunit/unit/includes/parser/MagicWordArrayTest.php b/tests/phpunit/unit/includes/parser/MagicWordArrayTest.php
index 94e8c79c4b61..37ccf1d318dd 100644
--- a/tests/phpunit/unit/includes/parser/MagicWordArrayTest.php
+++ b/tests/phpunit/unit/includes/parser/MagicWordArrayTest.php
@@ -119,7 +119,7 @@ class MagicWordArrayTest extends MediaWikiUnitTestCase {
public function testMatchStartAndRemove(
string $input,
$expectedMatches,
- string $expectedText = null
+ ?string $expectedText = null
) {
$array = new MagicWordArray( [ 'ID' ], $this->getFactory() );
$text = $input;
@@ -143,7 +143,7 @@ class MagicWordArrayTest extends MediaWikiUnitTestCase {
public function testMatchAndRemove(
string $input,
array $expectedMatches = [],
- string $expectedText = null
+ ?string $expectedText = null
) {
$array = new MagicWordArray( [ 'ID' ], $this->getFactory() );
$text = $input;
@@ -167,7 +167,7 @@ class MagicWordArrayTest extends MediaWikiUnitTestCase {
public function testMatchAndRemoveMultiple(
string $input,
array $expectedMatches = [],
- string $expectedText = null
+ ?string $expectedText = null
) {
$array = new MagicWordArray( array_keys( self::MAGIC_WORDS ), $this->getFactory() );
$text = $input;
diff --git a/tests/phpunit/unit/includes/session/SessionProviderTestTrait.php b/tests/phpunit/unit/includes/session/SessionProviderTestTrait.php
index c53a0529d3c9..c7965b0b158a 100644
--- a/tests/phpunit/unit/includes/session/SessionProviderTestTrait.php
+++ b/tests/phpunit/unit/includes/session/SessionProviderTestTrait.php
@@ -32,11 +32,11 @@ trait SessionProviderTestTrait {
*/
private function initProvider(
SessionProvider $provider,
- LoggerInterface $logger = null,
- Config $config = null,
- SessionManager $manager = null,
- HookContainer $hookContainer = null,
- UserNameUtils $userNameUtils = null
+ ?LoggerInterface $logger = null,
+ ?Config $config = null,
+ ?SessionManager $manager = null,
+ ?HookContainer $hookContainer = null,
+ ?UserNameUtils $userNameUtils = null
) {
$provider->init(
$logger ?? new NullLogger(),
diff --git a/tests/phpunit/unit/includes/watchlist/WatchedItemQueryServiceUnitTest.php b/tests/phpunit/unit/includes/watchlist/WatchedItemQueryServiceUnitTest.php
index 4c156ec7a1fc..10160d84f7c4 100644
--- a/tests/phpunit/unit/includes/watchlist/WatchedItemQueryServiceUnitTest.php
+++ b/tests/phpunit/unit/includes/watchlist/WatchedItemQueryServiceUnitTest.php
@@ -45,7 +45,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiUnitTestCase {
*/
private function newService(
IDatabase $mockDb,
- UserOptionsLookup $userOptionsLookup = null
+ ?UserOptionsLookup $userOptionsLookup = null
) {
return new WatchedItemQueryService(
$this->getMockDbProvider( $mockDb ),