From 06aeda306c260f1b22ca5ee5e9b59361cc13ff92 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Sat, 1 Jun 2024 10:15:22 +0100
Subject: [PATCH] Issue #3427999 by andypost, Ayesh, bbrala: [PHP 8.4] Fix
 implicitly nullable type declarations

---
 .../Access/AccessArgumentsResolverFactory.php |  2 +-
 ...ccessArgumentsResolverFactoryInterface.php |  2 +-
 core/lib/Drupal/Core/Access/AccessManager.php |  6 ++--
 .../Core/Access/AccessManagerInterface.php    |  6 ++--
 .../Core/Access/AccessibleInterface.php       |  2 +-
 .../Drupal/Core/Access/CustomAccessCheck.php  |  2 +-
 .../Drupal/Core/Access/RouteProcessorCsrf.php |  2 +-
 .../Drupal/Core/Action/ActionInterface.php    |  2 +-
 .../Action/Plugin/Action/DeleteAction.php     |  2 +-
 .../Core/Action/Plugin/Action/EmailAction.php |  2 +-
 .../Core/Action/Plugin/Action/GotoAction.php  |  2 +-
 .../Action/Plugin/Action/MessageAction.php    |  2 +-
 .../Action/Plugin/Action/PublishAction.php    |  2 +-
 .../Core/Action/Plugin/Action/SaveAction.php  |  2 +-
 .../Action/Plugin/Action/UnpublishAction.php  |  2 +-
 core/lib/Drupal/Core/Ajax/InsertCommand.php   |  2 +-
 core/lib/Drupal/Core/Asset/AssetResolver.php  |  4 +--
 .../Core/Asset/AssetResolverInterface.php     |  4 +--
 core/lib/Drupal/Core/Block/BlockManager.php   |  2 +-
 .../Core/Cache/ChainedFastBackendFactory.php  |  2 +-
 .../lib/Drupal/Core/Command/GenerateTheme.php |  2 +-
 .../Core/Config/ConfigCollectionInfo.php      |  2 +-
 .../Drupal/Core/Config/ConfigInstaller.php    |  2 +-
 .../Core/Config/ConfigInstallerInterface.php  |  2 +-
 core/lib/Drupal/Core/Config/ConfigManager.php |  4 +--
 .../Config/ConfigModuleOverridesEvent.php     |  2 +-
 .../Config/Entity/ConfigEntityStorage.php     |  4 +--
 .../Entity/ConfigEntityStorageInterface.php   |  2 +-
 .../Config/Entity/ConfigEntityUpdater.php     |  2 +-
 .../lib/Drupal/Core/Config/Schema/Mapping.php |  2 +-
 .../Drupal/Core/Config/StorageComparer.php    |  2 +-
 .../Drupal/Core/Config/TypedConfigManager.php |  2 +-
 core/lib/Drupal/Core/Database/Query/Merge.php |  2 +-
 .../lib/Drupal/Core/Database/Query/Select.php |  4 +--
 .../Core/Database/Query/SelectExtender.php    |  4 +--
 .../Core/Database/Query/SelectInterface.php   |  4 +--
 .../lib/Drupal/Core/Database/Query/Update.php |  2 +-
 .../Core/Database/RowCountException.php       |  2 +-
 .../Core/Database/StatementInterface.php      |  2 +-
 .../Database/StatementPrefetchIterator.php    |  2 +-
 .../Database/StatementWrapperIterator.php     |  2 +-
 .../DependencyInjection/ContainerBuilder.php  |  2 +-
 core/lib/Drupal/Core/Display/VariantBase.php  |  2 +-
 .../Drupal/Core/Display/VariantInterface.php  |  2 +-
 .../Drupal/Core/Entity/ContentEntityBase.php  |  2 +-
 .../Core/Entity/ContentEntityNullStorage.php  |  4 +--
 .../Core/Entity/ContentEntityStorageBase.php  |  6 ++--
 .../Entity/Controller/EntityController.php    |  8 ++---
 .../Entity/EntityAccessControlHandler.php     | 10 +++---
 .../EntityAccessControlHandlerInterface.php   |  6 ++--
 core/lib/Drupal/Core/Entity/EntityBase.php    |  4 +--
 .../Entity/EntityConstraintViolationList.php  |  2 +-
 ...EntityConstraintViolationListInterface.php |  2 +-
 .../Entity/EntityDefinitionUpdateManager.php  |  2 +-
 ...EntityDefinitionUpdateManagerInterface.php |  2 +-
 .../Drupal/Core/Entity/EntityInterface.php    |  2 +-
 .../SelectionPluginManager.php                |  2 +-
 .../SelectionPluginManagerInterface.php       |  2 +-
 .../Drupal/Core/Entity/EntityRepository.php   |  8 ++---
 .../Core/Entity/EntityRepositoryInterface.php |  8 ++---
 .../Drupal/Core/Entity/EntityStorageBase.php  |  8 ++---
 .../Core/Entity/EntityStorageInterface.php    |  4 +--
 .../Drupal/Core/Entity/EntityTypeEvent.php    |  2 +-
 .../Entity/EntityTypeEventSubscriberTrait.php |  2 +-
 .../Drupal/Core/Entity/EntityTypeListener.php |  2 +-
 .../Entity/EntityTypeListenerInterface.php    |  2 +-
 .../Drupal/Core/Entity/EntityTypeManager.php  |  2 +-
 .../Entity/EntityTypeManagerInterface.php     |  2 +-
 .../Drupal/Core/Entity/EntityViewBuilder.php  |  2 +-
 .../Entity/EntityViewBuilderInterface.php     |  2 +-
 .../KeyValueStore/KeyValueEntityStorage.php   |  2 +-
 .../Entity/Sql/SqlContentEntityStorage.php    |  8 ++---
 .../Sql/SqlContentEntityStorageSchema.php     | 16 ++++-----
 .../Entity/Sql/SqlEntityStorageInterface.php  |  2 +-
 .../SqlFieldableEntityTypeListenerTrait.php   |  6 ++--
 .../Entity/TypedData/EntityDataDefinition.php |  2 +-
 .../EntityDataDefinitionInterface.php         |  2 +-
 core/lib/Drupal/Core/Entity/entity.api.php    |  2 +-
 .../Core/Extension/ExtensionDiscovery.php     |  4 +--
 .../Core/Field/ChangedFieldItemList.php       |  2 +-
 core/lib/Drupal/Core/Field/FieldItemBase.php  |  2 +-
 core/lib/Drupal/Core/Field/FieldItemList.php  |  4 +--
 .../Core/Field/FieldItemListInterface.php     |  2 +-
 .../Field/FieldStorageDefinitionEvent.php     |  2 +-
 .../Core/Field/FieldTypePluginManager.php     |  2 +-
 .../Core/Field/FieldUpdateActionBase.php      |  2 +-
 .../Plugin/Field/FieldType/BooleanItem.php    |  8 ++---
 .../Field/FieldType/EntityReferenceItem.php   |  8 ++---
 .../Plugin/Field/FieldType/LanguageItem.php   |  8 ++---
 core/lib/Drupal/Core/File/FileSystem.php      |  2 +-
 .../Drupal/Core/File/FileSystemInterface.php  |  2 +-
 .../MimeType/ExtensionMimeTypeGuesser.php     |  2 +-
 .../Core/Form/EnforcedResponseException.php   |  2 +-
 .../Exception/BrokenPostRequestException.php  |  2 +-
 .../Drupal/Core/Form/FormAjaxException.php    |  2 +-
 core/lib/Drupal/Core/Form/FormBuilder.php     |  2 +-
 .../CacheableAccessDeniedHttpException.php    |  2 +-
 .../CacheableBadRequestHttpException.php      |  2 +-
 .../CacheableConflictHttpException.php        |  2 +-
 .../Exception/CacheableGoneHttpException.php  |  2 +-
 .../Http/Exception/CacheableHttpException.php |  2 +-
 .../CacheableLengthRequiredHttpException.php  |  2 +-
 ...CacheableMethodNotAllowedHttpException.php |  2 +-
 .../CacheableNotAcceptableHttpException.php   |  2 +-
 .../CacheableNotFoundHttpException.php        |  2 +-
 ...cheablePreconditionFailedHttpException.php |  2 +-
 ...eablePreconditionRequiredHttpException.php |  2 +-
 ...cheableServiceUnavailableHttpException.php |  2 +-
 .../CacheableTooManyRequestsHttpException.php |  2 +-
 .../CacheableUnauthorizedHttpException.php    |  2 +-
 ...heableUnprocessableEntityHttpException.php |  2 +-
 ...eableUnsupportedMediaTypeHttpException.php |  2 +-
 .../ImageToolkitOperationManager.php          |  2 +-
 .../Exception/InstallerException.php          |  2 +-
 .../Core/Installer/InstallerRedirectTrait.php |  2 +-
 .../Drupal/Core/Language/LanguageManager.php  |  2 +-
 .../Language/LanguageManagerInterface.php     |  2 +-
 .../Core/Layout/LayoutPluginManager.php       |  4 +--
 .../Layout/LayoutPluginManagerInterface.php   |  4 +--
 core/lib/Drupal/Core/Logger/LoggerChannel.php |  4 +--
 .../Core/Logger/LoggerChannelInterface.php    |  4 +--
 .../Core/Menu/ContextualLinkDefault.php       |  2 +-
 .../Drupal/Core/Menu/LocalActionDefault.php   |  2 +-
 .../lib/Drupal/Core/Menu/LocalTaskDefault.php |  2 +-
 .../Core/Menu/MenuParentFormSelector.php      |  8 ++---
 .../Menu/MenuParentFormSelectorInterface.php  |  4 +--
 .../ParamNotConvertedException.php            |  2 +-
 .../lib/Drupal/Core/Path/CurrentPathStack.php |  4 +--
 .../NullPathProcessorManager.php              |  2 +-
 .../OutboundPathProcessorInterface.php        |  2 +-
 .../PathProcessor/PathProcessorManager.php    |  2 +-
 .../Plugin/CategorizingPluginManagerTrait.php |  4 +--
 .../Core/Plugin/DefaultPluginManager.php      |  2 +-
 .../Constraint/PluginExistsConstraint.php     |  2 +-
 .../Core/Queue/DelayedRequeueException.php    |  2 +-
 .../Core/Queue/SuspendQueueException.php      |  2 +-
 .../Core/Recipe/RecipeFileException.php       |  2 +-
 core/lib/Drupal/Core/Render/Renderer.php      |  2 +-
 .../OutboundRouteProcessorInterface.php       |  2 +-
 .../RouteProcessor/RouteProcessorCurrent.php  |  2 +-
 .../RouteProcessor/RouteProcessorManager.php  |  2 +-
 core/lib/Drupal/Core/Routing/AdminContext.php |  2 +-
 .../lib/Drupal/Core/Routing/NullGenerator.php |  4 +--
 .../lib/Drupal/Core/Routing/RouteProvider.php |  2 +-
 core/lib/Drupal/Core/Routing/UrlGenerator.php |  4 +--
 .../Core/StringTranslation/ByteSizeMarkup.php |  2 +-
 .../PluralTranslatableMarkup.php              |  2 +-
 .../StringTranslation/TranslatableMarkup.php  |  2 +-
 .../Drupal/Core/Template/TwigEnvironment.php  |  2 +-
 .../Drupal/Core/Test/EnvironmentCleaner.php   |  2 +-
 .../Core/Test/EnvironmentCleanerInterface.php |  2 +-
 core/lib/Drupal/Core/Test/JUnitConverter.php  |  2 +-
 .../Drupal/Core/Test/PhpUnitTestRunner.php    |  4 +--
 .../Theme/Component/ComponentValidator.php    |  2 +-
 core/lib/Drupal/Core/Theme/ThemeManager.php   |  4 +--
 .../Core/Theme/ThemeManagerInterface.php      |  2 +-
 .../Core/TypedData/ListDataDefinition.php     |  2 +-
 .../Core/TypedData/MapDataDefinition.php      |  2 +-
 .../TypedData/OptionsProviderInterface.php    |  8 ++---
 core/lib/Drupal/Core/TypedData/TypedData.php  |  6 ++--
 .../Core/TypedData/TypedDataInterface.php     |  4 +--
 .../lib/Drupal/Core/Update/UpdateRegistry.php |  2 +-
 core/lib/Drupal/Core/Url.php                  |  4 +--
 core/lib/Drupal/Core/Utility/Token.php        |  6 ++--
 .../Plugin/migrate/destination/BlockedIp.php  |  2 +-
 .../src/BigPipePlaceholderTestCases.php       |  2 +-
 core/modules/block/src/BlockListBuilder.php   |  2 +-
 core/modules/block/src/BlockRepository.php    |  2 +-
 .../src/Controller/BlockListController.php    |  2 +-
 .../Plugin/migrate/process/BlockPluginId.php  |  2 +-
 .../migrate/process/BlockVisibility.php       |  2 +-
 .../Plugin/migrate/process/RolesLookup.php    |  2 +-
 .../Kernel/Migrate/d6/MigrateBlockTest.php    |  2 +-
 .../migrate/process/BlockRegionTest.php       |  2 +-
 .../src/Access/AccessGroupAnd.php             |  2 +-
 .../src/Plugin/CKEditor5PluginManager.php     |  2 +-
 .../CKEditor5PluginManagerInterface.php       |  2 +-
 ...mentalCompatibilityConstraintValidator.php |  2 +-
 .../CKEditor5TestBase.php                     |  2 +-
 .../src/CommentAccessControlHandler.php       |  2 +-
 .../comment/src/CommentFieldItemList.php      |  2 +-
 core/modules/comment/src/CommentForm.php      |  2 +-
 .../modules/comment/src/CommentStatistics.php |  2 +-
 .../Menu/LocalTask/UnapprovedComments.php     |  2 +-
 .../migrate/destination/EntityComment.php     |  4 +--
 .../src/Plugin/views/field/LastTimestamp.php  |  2 +-
 .../Plugin/views/field/NodeNewComments.php    |  2 +-
 .../src/Functional/CommentNonNodeTest.php     |  2 +-
 .../tests/src/Functional/CommentTestBase.php  |  2 +-
 .../src/ConfigEntityMapper.php                |  2 +-
 .../src/ConfigMapperManager.php               |  2 +-
 .../src/ConfigMapperManagerInterface.php      |  2 +-
 .../src/ConfigNamesMapper.php                 |  2 +-
 .../src/Form/ConfigTranslationAddForm.php     |  2 +-
 .../src/Form/ConfigTranslationDeleteForm.php  |  2 +-
 .../src/Form/ConfigTranslationEditForm.php    |  2 +-
 .../src/Form/ConfigTranslationFormBase.php    |  2 +-
 .../ConfigTranslationContextualLink.php       |  2 +-
 .../LocalTask/ConfigTranslationLocalTask.php  |  2 +-
 .../src/Controller/ContactController.php      |  2 +-
 core/modules/contact/src/MessageForm.php      |  2 +-
 .../content_moderation.module                 |  2 +-
 .../src/Form/ContentModerationStateForm.php   |  2 +-
 .../src/Form/EntityModerationForm.php         |  2 +-
 .../Plugin/Action/ModerationOptOutPublish.php |  2 +-
 .../Action/ModerationOptOutUnpublish.php      |  2 +-
 .../src/Form/ContentTranslationDeleteForm.php |  2 +-
 .../ContentTranslationWorkflowsTest.php       |  2 +-
 .../d6/MigrateTaxonomyTermTranslationTest.php |  2 +-
 .../modules/datetime/src/DateTimeComputed.php |  2 +-
 .../src/Plugin/views/field/DblogMessage.php   |  2 +-
 core/modules/editor/editor.api.php            |  2 +-
 core/modules/editor/editor.module             |  2 +-
 .../editor/src/EditorXssFilter/Standard.php   |  2 +-
 .../editor/src/EditorXssFilterInterface.php   |  2 +-
 .../modules/editor_test/editor_test.module    |  2 +-
 .../src/EditorXssFilter/Insecure.php          |  2 +-
 .../src/Plugin/migrate/process/FieldType.php  |  4 +--
 .../Plugin/migrate/process/ProcessField.php   |  4 +--
 .../Plugin/migrate/process/d7/FieldBundle.php |  2 +-
 .../modules/field_test/field_test.field.inc   |  2 +-
 .../src/Form/NestedEntityTestForm.php         |  2 +-
 .../field_test_boolean_access_denied.module   |  2 +-
 .../FieldLayoutEntityFormDisplayEditForm.php  |  2 +-
 .../FieldLayoutEntityViewDisplayEditForm.php  |  2 +-
 .../src/Access/FieldReuseAccessCheck.php      |  2 +-
 .../Controller/FieldConfigListController.php  |  2 +-
 .../src/Form/FieldStorageConfigEditForm.php   |  2 +-
 core/modules/file/file.module                 |  2 +-
 .../file/src/FileAccessControlHandler.php     |  2 +-
 .../Plugin/migrate/process/d6/FieldFile.php   |  2 +-
 .../file/src/Plugin/views/field/File.php      |  2 +-
 .../src/Functional/FileFieldWidgetTest.php    |  2 +-
 core/modules/filter/filter.module             |  4 +--
 .../src/Controller/FilterController.php       |  2 +-
 .../src/Plugin/DataType/FilterFormat.php      |  8 ++---
 .../src/Plugin/Filter/FilterCaption.php       |  2 +-
 .../src/Plugin/migrate/process/FilterID.php   |  2 +-
 .../process/d6/FilterFormatPermission.php     |  2 +-
 .../help/src/Plugin/Search/HelpSearch.php     |  2 +-
 .../views/field/HistoryUserTimestamp.php      |  2 +-
 .../image/src/Form/ImageEffectAddForm.php     |  2 +-
 .../image/src/Form/ImageEffectDeleteForm.php  |  2 +-
 .../image/src/Form/ImageEffectEditForm.php    |  2 +-
 .../image/src/Form/ImageEffectFormBase.php    |  2 +-
 .../Plugin/Field/FieldWidget/ImageWidget.php  |  2 +-
 .../image_access_test_hidden.module           |  2 +-
 .../src/Access/EntityAccessChecker.php        |  2 +-
 .../Access/RelationshipRouteAccessCheck.php   |  2 +-
 .../src/Access/TemporaryQueryGuard.php        |  2 +-
 .../jsonapi/src/Controller/EntityResource.php |  2 +-
 .../jsonapi/src/Controller/FileUpload.php     |  4 +--
 .../src/Entity/EntityValidationTrait.php      |  2 +-
 .../ResourceResponseValidator.php             |  2 +-
 .../EntityAccessDeniedHttpException.php       |  2 +-
 .../UnprocessableHttpEntityException.php      |  2 +-
 core/modules/jsonapi/src/IncludeResolver.php  |  2 +-
 .../LabelOnlyResourceObject.php               |  2 +-
 .../src/JsonApiResource/Relationship.php      |  2 +-
 .../src/JsonApiResource/ResourceObject.php    |  4 +--
 .../src/Normalizer/EntityDenormalizerBase.php |  2 +-
 .../Normalizer/ResourceObjectNormalizer.php   |  2 +-
 .../Revisions/VersionNotFoundException.php    |  2 +-
 .../jsonapi/src/Serializer/Serializer.php     |  4 +--
 .../tests/src/Functional/BlockContentTest.php |  4 +--
 .../tests/src/Functional/BlockTest.php        |  6 ++--
 .../tests/src/Functional/CommentTest.php      |  6 ++--
 .../Functional/ConfigurableLanguageTest.php   |  2 +-
 .../ContentLanguageSettingsTest.php           |  4 +--
 .../EntityTestComputedFieldTest.php           |  4 +--
 .../tests/src/Functional/EntityTestTest.php   |  2 +-
 .../tests/src/Functional/MediaTest.php        |  2 +-
 .../Functional/ResourceResponseTestTrait.php  |  2 +-
 .../tests/src/Functional/ResourceTestBase.php | 18 +++++-----
 .../tests/src/Functional/ShortcutTest.php     |  2 +-
 .../jsonapi/tests/src/Functional/TermTest.php |  6 ++--
 .../jsonapi/tests/src/Functional/UserTest.php |  2 +-
 .../LinkCollectionNormalizerTest.php          |  2 +-
 core/modules/language/language.module         |  2 +-
 .../Config/LanguageConfigFactoryOverride.php  |  2 +-
 ...LanguageConfigFactoryOverrideInterface.php |  2 +-
 .../src/ConfigurableLanguageManager.php       |  2 +-
 .../src/Form/NegotiationConfigureForm.php     |  2 +-
 .../src/HttpKernel/PathProcessorLanguage.php  |  2 +-
 .../LanguageNegotiationMethodInterface.php    |  2 +-
 .../LanguageNegotiationBrowser.php            |  2 +-
 .../LanguageNegotiationContentEntity.php      |  4 +--
 .../LanguageNegotiationSelected.php           |  2 +-
 .../LanguageNegotiationSession.php            |  4 +--
 .../LanguageNegotiationUI.php                 |  2 +-
 .../LanguageNegotiationUrl.php                |  4 +--
 .../LanguageNegotiationUrlFallback.php        |  2 +-
 .../language_entity_field_access_test.module  |  2 +-
 .../LanguageNegotiationTest.php               |  2 +-
 .../src/Access/LayoutPreviewAccessAllowed.php |  2 +-
 .../src/Field/LayoutSectionItemList.php       |  2 +-
 .../layout_builder/src/Form/AddBlockForm.php  |  2 +-
 .../src/Form/ConfigureBlockFormBase.php       |  2 +-
 .../src/Form/ConfigureSectionForm.php         |  2 +-
 .../src/Form/DefaultsEntityForm.php           |  2 +-
 .../src/Form/DiscardLayoutChangesForm.php     |  2 +-
 .../src/Form/LayoutBuilderDisableForm.php     |  2 +-
 .../LayoutBuilderEntityViewDisplayForm.php    |  2 +-
 .../src/Form/LayoutRebuildConfirmFormBase.php |  2 +-
 .../layout_builder/src/Form/MoveBlockForm.php |  2 +-
 .../src/Form/OverridesEntityForm.php          |  2 +-
 .../src/Form/RemoveBlockForm.php              |  2 +-
 .../src/Form/RevertOverridesForm.php          |  2 +-
 .../src/Form/UpdateBlockForm.php              |  2 +-
 .../SectionStorage/DefaultsSectionStorage.php |  2 +-
 .../OverridesSectionStorage.php               |  2 +-
 .../src/SectionStorageInterface.php           |  2 +-
 .../SimpleConfigSectionStorage.php            |  2 +-
 .../TestStateBasedSectionStorage.php          |  2 +-
 core/modules/locale/locale.translation.inc    |  2 +-
 .../media/src/OEmbed/ProviderException.php    |  2 +-
 core/modules/media/src/OEmbed/Resource.php    | 10 +++---
 .../media/src/OEmbed/ResourceException.php    |  2 +-
 .../media_library/src/Form/OEmbedForm.php     |  2 +-
 .../src/MediaLibraryUiBuilder.php             |  4 +--
 .../media_library_test.module                 |  2 +-
 .../src/Kernel/MediaLibraryAccessTest.php     |  2 +-
 .../menu_ui/src/Form/MenuLinkEditForm.php     |  2 +-
 .../menu_ui/src/Form/MenuLinkResetForm.php    |  2 +-
 .../tests/src/Functional/MenuUiTest.php       |  2 +-
 .../migrate/src/Audit/AuditException.php      |  2 +-
 .../src/Exception/RequirementsException.php   |  2 +-
 core/modules/migrate/src/MigrateException.php |  2 +-
 .../modules/migrate/src/MigrateExecutable.php |  4 +--
 .../src/MigrateExecutableInterface.php        |  2 +-
 ...otatedClassDiscoveryAutomatedProviders.php |  2 +-
 .../BadPluginDefinitionException.php          |  2 +-
 .../MigrateDestinationPluginManager.php       |  2 +-
 .../src/Plugin/MigratePluginManager.php       |  2 +-
 .../Plugin/MigratePluginManagerInterface.php  |  2 +-
 core/modules/migrate/src/Plugin/Migration.php |  2 +-
 .../migrate/src/Plugin/MigrationInterface.php |  2 +-
 .../ComponentEntityDisplayBase.php            |  2 +-
 .../src/Plugin/migrate/destination/Config.php |  2 +-
 .../src/Plugin/migrate/destination/Entity.php |  2 +-
 .../migrate/destination/EntityConfigBase.php  |  2 +-
 .../migrate/destination/EntityContentBase.php |  4 +--
 .../migrate/src/Plugin/migrate/id_map/Sql.php |  4 +--
 .../Plugin/migrate/process/EntityExists.php   |  2 +-
 .../migrate/process/MakeUniqueEntityField.php |  2 +-
 .../Plugin/migrate/process/MenuLinkParent.php |  2 +-
 .../migrate/process/MigrationLookup.php       |  2 +-
 .../src/Plugin/migrate/process/Route.php      |  2 +-
 .../src/Plugin/migrate/source/SqlBase.php     |  2 +-
 .../migrate/tests/src/Kernel/SqlBaseTest.php  |  2 +-
 .../src/Plugin/MigrateFieldPluginManager.php  |  2 +-
 .../MigrateFieldPluginManagerInterface.php    |  2 +-
 .../Plugin/migrate/source/ContentEntity.php   |  2 +-
 .../Plugin/migrate/source/DrupalSqlBase.php   |  2 +-
 .../src/Plugin/migrate/source/EmptySource.php |  2 +-
 .../src/Functional/MigrateUpgradeTestBase.php |  2 +-
 .../tests/src/Kernel/mysql/SchemaTest.php     |  2 +-
 .../navigation/src/Form/LayoutForm.php        |  2 +-
 .../NavigationSectionStorage.php              |  2 +-
 core/modules/node/src/Entity/Node.php         |  2 +-
 .../modules/node/src/Form/NodePreviewForm.php |  2 +-
 .../node/src/Form/NodeRevisionDeleteForm.php  |  2 +-
 .../node/src/Form/NodeRevisionRevertForm.php  |  2 +-
 .../node/src/NodeAccessControlHandler.php     |  6 ++--
 .../node/src/Plugin/Search/NodeSearch.php     |  2 +-
 .../src/Plugin/migrate/source/d6/Node.php     |  2 +-
 .../src/Plugin/migrate/source/d7/Node.php     |  2 +-
 .../node/src/Plugin/views/field/Node.php      |  2 +-
 core/modules/options/options.api.php          |  2 +-
 core/modules/options/options.module           |  2 +-
 .../Plugin/Field/FieldType/ListItemBase.php   |  8 ++---
 .../Plugin/views/argument/NumberListField.php |  2 +-
 .../Plugin/views/argument/StringListField.php |  2 +-
 .../src/Plugin/views/filter/ListField.php     |  2 +-
 .../tests/options_test/options_test.module    |  4 +--
 .../Field/FieldType/PathFieldItemList.php     |  2 +-
 .../src/PathProcessor/AliasPathProcessor.php  |  2 +-
 .../tests/src/Kernel/pgsql/SchemaTest.php     |  2 +-
 .../Plugin/rest/resource/EntityResource.php   |  4 +--
 .../src/Plugin/views/display/RestExport.php   |  2 +-
 .../src/Plugin/views/row/DataFieldRow.php     |  2 +-
 .../tests/modules/rest_test/rest_test.module  |  2 +-
 .../tests/src/Kernel/RequestHandlerTest.php   |  2 +-
 .../search/src/Form/SearchPageForm.php        |  2 +-
 .../migrate/destination/EntitySearchPage.php  |  2 +-
 .../src/Plugin/views/argument/Search.php      |  2 +-
 .../search/src/Plugin/views/filter/Search.php |  2 +-
 core/modules/search/src/SearchQuery.php       |  2 +-
 .../Migrate/d7/MigrateSearchPageTest.php      |  2 +-
 .../serialization/src/Encoder/JsonEncoder.php |  2 +-
 .../src/Normalizer/NormalizerBase.php         |  4 +--
 .../src/SerializationTestNormalizer.php       |  2 +-
 .../ContentEntityNormalizerTest.php           |  2 +-
 core/modules/shortcut/shortcut.module         |  2 +-
 .../shortcut/src/Form/SwitchShortcutSet.php   |  4 +--
 .../migrate/destination/ShortcutSetUsers.php  |  2 +-
 .../tests/src/Kernel/sqlite/SchemaTest.php    |  2 +-
 .../system/src/Form/ThemeAdminForm.php        |  2 +-
 .../system/src/PathBasedBreadcrumbBuilder.php |  2 +-
 .../migrate/destination/d7/ThemeSettings.php  |  2 +-
 .../action_test/src/Plugin/Action/NoType.php  |  2 +-
 .../src/Plugin/Action/SaveEntity.php          |  2 +-
 .../modules/entity_test/entity_test.module    |  2 +-
 .../src/EntityTestDefinitionSubscriber.php    |  2 +-
 .../Plugin/Field/FieldType/FieldTestItem.php  |  2 +-
 .../src/FormTestControllerObject.php          |  2 +-
 .../ContextualLink/TestContextualLink.php     |  2 +-
 .../Menu/LocalAction/TestLocalAction.php      |  2 +-
 .../Menu/LocalAction/TestLocalAction4.php     |  2 +-
 .../Menu/LocalAction/TestLocalAction5.php     |  2 +-
 .../LocalAction/TestLocalActionWithConfig.php |  2 +-
 .../Menu/LocalTask/TestTaskWithUserInput.php  |  2 +-
 .../Menu/LocalTask/TestTasksSettingsSub1.php  |  2 +-
 .../new_dependency_test/src/Service.php       |  2 +-
 .../src/ServiceWithDependency.php             |  2 +-
 .../url_alter_test/src/PathProcessorTest.php  |  2 +-
 .../Menu/LinksetControllerTestBase.php        |  2 +-
 .../tests/src/Functional/Pager/PagerTest.php  |  4 +--
 .../SecurityAdvisoriesFetcherTest.php         |  4 +--
 .../SecurityFileUploadEventSubscriberTest.php |  2 +-
 .../taxonomy/src/Form/OverviewTerms.php       |  2 +-
 .../views/argument_validator/TermName.php     |  2 +-
 .../Plugin/views/field/TaxonomyIndexTid.php   |  2 +-
 .../Plugin/views/filter/TaxonomyIndexTid.php  |  2 +-
 core/modules/taxonomy/src/TermStorage.php     |  2 +-
 .../taxonomy/src/TermStorageSchema.php        |  2 +-
 .../MigrateTermLocalizedTranslationTest.php   |  2 +-
 .../Migrate/d7/MigrateTaxonomyTermTest.php    |  2 +-
 .../d7/MigrateTaxonomyTermTranslationTest.php |  2 +-
 .../MigrateTermLocalizedTranslationTest.php   |  2 +-
 core/modules/text/src/TextProcessed.php       |  2 +-
 .../text/tests/src/Kernel/TextSummaryTest.php |  2 +-
 .../Functional/ToolbarCacheContextsTest.php   |  2 +-
 .../tests/src/Functional/UpdateTestBase.php   |  2 +-
 core/modules/user/src/AccountForm.php         |  2 +-
 .../user/src/Controller/UserController.php    |  2 +-
 .../EventSubscriber/UserFloodSubscriber.php   |  2 +-
 .../user/src/Form/EntityPermissionsForm.php   |  2 +-
 .../user/src/Form/UserPasswordResetForm.php   |  2 +-
 .../Form/UserPermissionsRoleSpecificForm.php  |  2 +-
 .../user/src/Plugin/Action/BlockUser.php      |  2 +-
 .../user/src/Plugin/Action/CancelUser.php     |  2 +-
 .../src/Plugin/Action/ChangeUserRoleBase.php  |  2 +-
 .../user/src/Plugin/Action/UnblockUser.php    |  2 +-
 .../UserSelection.php                         |  2 +-
 .../LanguageNegotiationUser.php               |  2 +-
 .../LanguageNegotiationUserAdmin.php          |  2 +-
 .../user/src/Plugin/Search/UserSearch.php     |  2 +-
 .../Plugin/migrate/destination/EntityUser.php |  4 +--
 .../migrate/destination/EntityUserRole.php    |  2 +-
 .../Plugin/migrate/destination/UserData.php   |  2 +-
 .../resource/UserRegistrationResource.php     |  4 +--
 .../Plugin/views/argument_validator/User.php  |  2 +-
 .../src/Plugin/views/field/Permissions.php    |  2 +-
 .../user/src/Plugin/views/field/Roles.php     |  2 +-
 .../user/src/Plugin/views/filter/Current.php  |  2 +-
 .../user/src/UserAccessControlHandler.php     |  2 +-
 .../user_access_test/user_access_test.module  |  2 +-
 .../tests/src/Functional/UserLoginTest.php    |  2 +-
 ...tectedUserFieldConstraintValidatorTest.php |  2 +-
 .../src/Entity/Render/EntityFieldRenderer.php |  2 +-
 core/modules/views/src/Form/ViewsForm.php     |  4 +--
 .../views/src/Form/ViewsFormMainForm.php      |  2 +-
 .../ViewsSelection.php                        |  2 +-
 .../views/src/Plugin/views/HandlerBase.php    |  2 +-
 .../views/src/Plugin/views/PluginBase.php     |  4 +--
 .../src/Plugin/views/ViewsPluginInterface.php |  2 +-
 .../src/Plugin/views/area/AreaPluginBase.php  |  2 +-
 .../views/src/Plugin/views/area/Entity.php    |  2 +-
 .../views/argument/ArgumentPluginBase.php     |  2 +-
 .../src/Plugin/views/argument/Formula.php     |  2 +-
 .../src/Plugin/views/argument/ManyToOne.php   |  2 +-
 .../Plugin/views/argument/StringArgument.php  |  2 +-
 .../views/display/DisplayPluginBase.php       |  4 +--
 .../views/display/DisplayPluginInterface.php  |  4 +--
 .../views/src/Plugin/views/display/Page.php   |  4 +--
 .../views/src/Plugin/views/field/Boolean.php  |  2 +-
 .../views/src/Plugin/views/field/BulkForm.php |  2 +-
 .../src/Plugin/views/field/EntityField.php    |  2 +-
 .../src/Plugin/views/field/EntityLabel.php    |  2 +-
 .../Plugin/views/field/FieldPluginBase.php    |  2 +-
 .../views/src/Plugin/views/field/Markup.php   |  2 +-
 .../Plugin/views/filter/BooleanOperator.php   |  2 +-
 .../views/src/Plugin/views/filter/Broken.php  |  2 +-
 .../views/src/Plugin/views/filter/Bundle.php  |  2 +-
 .../Plugin/views/filter/FilterPluginBase.php  |  4 +--
 .../src/Plugin/views/filter/InOperator.php    |  2 +-
 .../src/Plugin/views/filter/ManyToOne.php     |  2 +-
 .../views/src/Plugin/views/pager/None.php     |  2 +-
 .../views/src/Plugin/views/query/Sql.php      |  8 ++---
 .../relationship/RelationshipPluginBase.php   |  2 +-
 .../views/src/Plugin/views/row/EntityRow.php  |  4 +--
 .../src/Plugin/views/sort/GroupByNumeric.php  |  2 +-
 .../Plugin/views/style/StylePluginBase.php    |  2 +-
 .../src/Plugin/Action/TestAction.php          |  2 +-
 .../src/Plugin/Action/BatchUserAction.php     |  2 +-
 .../views_entity_test.module                  |  2 +-
 .../src/Plugin/views/query/QueryTest.php      |  2 +-
 .../src/Unit/Plugin/Block/ViewsBlockTest.php  |  2 +-
 .../Unit/Routing/ViewPageControllerTest.php   |  2 +-
 core/modules/views/views.module               |  2 +-
 .../views_ui/src/Form/Ajax/ConfigHandler.php  |  2 +-
 core/modules/views_ui/src/ViewUI.php          |  4 +--
 .../src/Form/WorkflowStateDeleteForm.php      |  2 +-
 .../src/Form/WorkflowTransitionDeleteForm.php |  2 +-
 .../workflows/src/Plugin/WorkflowTypeBase.php |  2 +-
 .../workflows/src/WorkflowTypeInterface.php   |  2 +-
 .../EntitySchemaSubscriber.php                |  2 +-
 .../src/Form/WorkspaceDeleteForm.php          |  2 +-
 .../src/Form/WorkspaceMergeForm.php           |  2 +-
 .../src/Form/WorkspacePublishForm.php         |  2 +-
 .../workspaces/src/WorkspaceAssociation.php   |  2 +-
 .../src/WorkspaceAssociationInterface.php     |  2 +-
 core/phpcs.xml.dist                           |  1 +
 .../BuildTests/Framework/BuildTestBase.php    |  2 +-
 .../FunctionalJavascriptTests/JSWebAssert.php | 10 +++---
 .../Asset/AssetOptimizationTest.php           |  2 +-
 .../Asset/LibraryDiscoveryIntegrationTest.php |  4 +--
 .../Database/DriverSpecificSchemaTestBase.php |  2 +-
 .../DriverSpecificTransactionTestBase.php     |  4 +--
 .../Core/Datetime/DatelistElementFormTest.php |  4 +--
 .../Core/Datetime/DatetimeElementFormTest.php | 10 +++---
 .../Core/DrupalKernel/DrupalKernelTest.php    |  2 +-
 .../Entity/EntityAccessControlHandlerTest.php |  2 +-
 .../Commands/TestSiteInstallCommand.php       |  2 +-
 core/tests/Drupal/Tests/BrowserTestBase.php   |  2 +-
 .../ProxyBuilder/ProxyBuilderTest.php         |  2 +-
 .../PhpTransliterationTest.php                |  2 +-
 .../Tests/Component/Utility/XssTest.php       |  4 +--
 .../Composer/Plugin/Scaffold/Fixtures.php     |  2 +-
 .../Tests/Core/Cache/VariationCacheTest.php   |  2 +-
 .../Core/Entity/EntityResolverManagerTest.php |  4 +--
 .../Tests/Core/Field/FieldItemListTest.php    |  4 +--
 ...EntityContextDefinitionIsSatisfiedTest.php |  2 +-
 .../DefaultSingleLazyPluginCollectionTest.php |  2 +-
 .../Plugin/LazyPluginCollectionTestBase.php   |  2 +-
 .../Tests/Core/Plugin/TestPluginManager.php   |  2 +-
 .../Core/ProxyBuilder/ProxyBuilderTest.php    |  2 +-
 .../Drupal/Tests/Core/Render/RendererTest.php |  2 +-
 .../Tests/Core/Routing/UrlGeneratorTest.php   |  2 +-
 .../Core/Security/RequestSanitizerTest.php    |  2 +-
 .../Session/AccessPolicyProcessorTest.php     | 10 +++---
 .../Core/Utility/UnroutedUrlAssemblerTest.php |  4 +--
 core/tests/Drupal/Tests/PhpCs/SortTest.php    |  2 +-
 core/tests/Drupal/Tests/WebAssert.php         | 34 +++++++++----------
 545 files changed, 722 insertions(+), 721 deletions(-)

diff --git a/core/lib/Drupal/Core/Access/AccessArgumentsResolverFactory.php b/core/lib/Drupal/Core/Access/AccessArgumentsResolverFactory.php
index 2bf807149db0..ace302b7d467 100644
--- a/core/lib/Drupal/Core/Access/AccessArgumentsResolverFactory.php
+++ b/core/lib/Drupal/Core/Access/AccessArgumentsResolverFactory.php
@@ -15,7 +15,7 @@ class AccessArgumentsResolverFactory implements AccessArgumentsResolverFactoryIn
   /**
    * {@inheritdoc}
    */
-  public function getArgumentsResolver(RouteMatchInterface $route_match, AccountInterface $account, Request $request = NULL) {
+  public function getArgumentsResolver(RouteMatchInterface $route_match, AccountInterface $account, ?Request $request = NULL) {
     $route = $route_match->getRouteObject();
 
     // Defaults for the parameters defined on the route object need to be added
diff --git a/core/lib/Drupal/Core/Access/AccessArgumentsResolverFactoryInterface.php b/core/lib/Drupal/Core/Access/AccessArgumentsResolverFactoryInterface.php
index c62c5276b922..27ea3867b2de 100644
--- a/core/lib/Drupal/Core/Access/AccessArgumentsResolverFactoryInterface.php
+++ b/core/lib/Drupal/Core/Access/AccessArgumentsResolverFactoryInterface.php
@@ -24,6 +24,6 @@ interface AccessArgumentsResolverFactoryInterface {
    * @return \Drupal\Component\Utility\ArgumentsResolverInterface
    *   The parametrized arguments resolver instance.
    */
-  public function getArgumentsResolver(RouteMatchInterface $route_match, AccountInterface $account, Request $request = NULL);
+  public function getArgumentsResolver(RouteMatchInterface $route_match, AccountInterface $account, ?Request $request = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/Access/AccessManager.php b/core/lib/Drupal/Core/Access/AccessManager.php
index 7650fb672417..cac1b7609b20 100644
--- a/core/lib/Drupal/Core/Access/AccessManager.php
+++ b/core/lib/Drupal/Core/Access/AccessManager.php
@@ -79,7 +79,7 @@ public function __construct(RouteProviderInterface $route_provider, ParamConvert
   /**
    * {@inheritdoc}
    */
-  public function checkNamedRoute($route_name, array $parameters = [], AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function checkNamedRoute($route_name, array $parameters = [], ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     try {
       $route = $this->routeProvider->getRouteByName($route_name);
 
@@ -108,7 +108,7 @@ public function checkNamedRoute($route_name, array $parameters = [], AccountInte
   /**
    * {@inheritdoc}
    */
-  public function checkRequest(Request $request, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function checkRequest(Request $request, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $route_match = RouteMatch::createFromRequest($request);
     return $this->check($route_match, $account, $request, $return_as_object);
   }
@@ -116,7 +116,7 @@ public function checkRequest(Request $request, AccountInterface $account = NULL,
   /**
    * {@inheritdoc}
    */
-  public function check(RouteMatchInterface $route_match, AccountInterface $account = NULL, Request $request = NULL, $return_as_object = FALSE) {
+  public function check(RouteMatchInterface $route_match, ?AccountInterface $account = NULL, ?Request $request = NULL, $return_as_object = FALSE) {
     if (!isset($account)) {
       $account = $this->currentUser;
     }
diff --git a/core/lib/Drupal/Core/Access/AccessManagerInterface.php b/core/lib/Drupal/Core/Access/AccessManagerInterface.php
index 2ea6a6a9c2ad..7fc86ad08a13 100644
--- a/core/lib/Drupal/Core/Access/AccessManagerInterface.php
+++ b/core/lib/Drupal/Core/Access/AccessManagerInterface.php
@@ -33,7 +33,7 @@ interface AccessManagerInterface {
    *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
    *   access is either explicitly forbidden or "no opinion".
    */
-  public function checkNamedRoute($route_name, array $parameters = [], AccountInterface $account = NULL, $return_as_object = FALSE);
+  public function checkNamedRoute($route_name, array $parameters = [], ?AccountInterface $account = NULL, $return_as_object = FALSE);
 
   /**
    * Execute access checks against the incoming request.
@@ -53,7 +53,7 @@ public function checkNamedRoute($route_name, array $parameters = [], AccountInte
    *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
    *   access is either explicitly forbidden or "no opinion".
    */
-  public function checkRequest(Request $request, AccountInterface $account = NULL, $return_as_object = FALSE);
+  public function checkRequest(Request $request, ?AccountInterface $account = NULL, $return_as_object = FALSE);
 
   /**
    * Checks a route against applicable access check services.
@@ -78,6 +78,6 @@ public function checkRequest(Request $request, AccountInterface $account = NULL,
    *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
    *   access is either explicitly forbidden or "no opinion".
    */
-  public function check(RouteMatchInterface $route_match, AccountInterface $account = NULL, Request $request = NULL, $return_as_object = FALSE);
+  public function check(RouteMatchInterface $route_match, ?AccountInterface $account = NULL, ?Request $request = NULL, $return_as_object = FALSE);
 
 }
diff --git a/core/lib/Drupal/Core/Access/AccessibleInterface.php b/core/lib/Drupal/Core/Access/AccessibleInterface.php
index eea600ae3918..61a7b27c37ff 100644
--- a/core/lib/Drupal/Core/Access/AccessibleInterface.php
+++ b/core/lib/Drupal/Core/Access/AccessibleInterface.php
@@ -29,6 +29,6 @@ interface AccessibleInterface {
    *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
    *   access is either explicitly forbidden or "no opinion".
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE);
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE);
 
 }
diff --git a/core/lib/Drupal/Core/Access/CustomAccessCheck.php b/core/lib/Drupal/Core/Access/CustomAccessCheck.php
index c7f00b547daa..20ed9a251f12 100644
--- a/core/lib/Drupal/Core/Access/CustomAccessCheck.php
+++ b/core/lib/Drupal/Core/Access/CustomAccessCheck.php
@@ -51,7 +51,7 @@ public function __construct(
    * @return \Drupal\Core\Access\AccessResultInterface
    *   The access result.
    */
-  public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account, Request $request = NULL) {
+  public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account, ?Request $request = NULL) {
     try {
       $callable = $this->callableResolver->getCallableFromDefinition($route->getRequirement('_custom_access'));
     }
diff --git a/core/lib/Drupal/Core/Access/RouteProcessorCsrf.php b/core/lib/Drupal/Core/Access/RouteProcessorCsrf.php
index d0aec3018557..6b70d7c63c30 100644
--- a/core/lib/Drupal/Core/Access/RouteProcessorCsrf.php
+++ b/core/lib/Drupal/Core/Access/RouteProcessorCsrf.php
@@ -33,7 +33,7 @@ public function __construct(CsrfTokenGenerator $csrf_token) {
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($route_name, Route $route, array &$parameters, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     if ($route->hasRequirement('_csrf_token')) {
       $path = ltrim($route->getPath(), '/');
       // Replace the path parameters with values from the parameters array.
diff --git a/core/lib/Drupal/Core/Action/ActionInterface.php b/core/lib/Drupal/Core/Action/ActionInterface.php
index 5158f96a1f12..622e519f614f 100644
--- a/core/lib/Drupal/Core/Action/ActionInterface.php
+++ b/core/lib/Drupal/Core/Action/ActionInterface.php
@@ -56,6 +56,6 @@ public function executeMultiple(array $objects);
    *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
    *   access is either explicitly forbidden or "no opinion".
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE);
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE);
 
 }
diff --git a/core/lib/Drupal/Core/Action/Plugin/Action/DeleteAction.php b/core/lib/Drupal/Core/Action/Plugin/Action/DeleteAction.php
index 6a7994a977ab..05382c2a066d 100644
--- a/core/lib/Drupal/Core/Action/Plugin/Action/DeleteAction.php
+++ b/core/lib/Drupal/Core/Action/Plugin/Action/DeleteAction.php
@@ -94,7 +94,7 @@ public function execute($object = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     return $object->access('delete', $account, $return_as_object);
   }
 
diff --git a/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php b/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php
index dab1c6d14326..369d47ac0e97 100644
--- a/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php
+++ b/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php
@@ -209,7 +209,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $result = AccessResult::allowed();
     return $return_as_object ? $result : $result->isAllowed();
   }
diff --git a/core/lib/Drupal/Core/Action/Plugin/Action/GotoAction.php b/core/lib/Drupal/Core/Action/Plugin/Action/GotoAction.php
index 565529af7223..92e92e006489 100644
--- a/core/lib/Drupal/Core/Action/Plugin/Action/GotoAction.php
+++ b/core/lib/Drupal/Core/Action/Plugin/Action/GotoAction.php
@@ -133,7 +133,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $access = AccessResult::allowed();
     return $return_as_object ? $access : $access->isAllowed();
   }
diff --git a/core/lib/Drupal/Core/Action/Plugin/Action/MessageAction.php b/core/lib/Drupal/Core/Action/Plugin/Action/MessageAction.php
index a498d2dccef3..9b1aba2439e1 100644
--- a/core/lib/Drupal/Core/Action/Plugin/Action/MessageAction.php
+++ b/core/lib/Drupal/Core/Action/Plugin/Action/MessageAction.php
@@ -127,7 +127,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $result = AccessResult::allowed();
     return $return_as_object ? $result : $result->isAllowed();
   }
diff --git a/core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php b/core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php
index 0c79430a3f07..6aa0df0c7007 100644
--- a/core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php
+++ b/core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php
@@ -27,7 +27,7 @@ public function execute($entity = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $key = $object->getEntityType()->getKey('published');
 
     /** @var \Drupal\Core\Entity\EntityInterface $object */
diff --git a/core/lib/Drupal/Core/Action/Plugin/Action/SaveAction.php b/core/lib/Drupal/Core/Action/Plugin/Action/SaveAction.php
index e9fbbd62e728..3db0e999c115 100644
--- a/core/lib/Drupal/Core/Action/Plugin/Action/SaveAction.php
+++ b/core/lib/Drupal/Core/Action/Plugin/Action/SaveAction.php
@@ -69,7 +69,7 @@ public function execute($entity = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     // It's not necessary to check the changed field access here, because
     // Drupal\Core\Field\ChangedFieldItemList would anyway return 'not allowed'.
     // Also changing the changed field value is only a workaround to trigger an
diff --git a/core/lib/Drupal/Core/Action/Plugin/Action/UnpublishAction.php b/core/lib/Drupal/Core/Action/Plugin/Action/UnpublishAction.php
index b8ef0f3db66e..8b44880ea024 100644
--- a/core/lib/Drupal/Core/Action/Plugin/Action/UnpublishAction.php
+++ b/core/lib/Drupal/Core/Action/Plugin/Action/UnpublishAction.php
@@ -27,7 +27,7 @@ public function execute($entity = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $key = $object->getEntityType()->getKey('published');
 
     /** @var \Drupal\Core\Entity\EntityInterface $object */
diff --git a/core/lib/Drupal/Core/Ajax/InsertCommand.php b/core/lib/Drupal/Core/Ajax/InsertCommand.php
index 65479c3fb4dc..92f5155b7930 100644
--- a/core/lib/Drupal/Core/Ajax/InsertCommand.php
+++ b/core/lib/Drupal/Core/Ajax/InsertCommand.php
@@ -55,7 +55,7 @@ class InsertCommand implements CommandInterface, CommandWithAttachedAssetsInterf
    * @param array $settings
    *   An array of JavaScript settings to be passed to any attached behaviors.
    */
-  public function __construct($selector, $content, array $settings = NULL) {
+  public function __construct($selector, $content, ?array $settings = NULL) {
     $this->selector = $selector;
     $this->content = $content;
     $this->settings = $settings;
diff --git a/core/lib/Drupal/Core/Asset/AssetResolver.php b/core/lib/Drupal/Core/Asset/AssetResolver.php
index 2d3f8ebee66d..e21fddf91a87 100644
--- a/core/lib/Drupal/Core/Asset/AssetResolver.php
+++ b/core/lib/Drupal/Core/Asset/AssetResolver.php
@@ -121,7 +121,7 @@ protected function getLibrariesToLoad(AttachedAssetsInterface $assets) {
   /**
    * {@inheritdoc}
    */
-  public function getCssAssets(AttachedAssetsInterface $assets, $optimize, LanguageInterface $language = NULL) {
+  public function getCssAssets(AttachedAssetsInterface $assets, $optimize, ?LanguageInterface $language = NULL) {
     if (!$assets->getLibraries()) {
       return [];
     }
@@ -225,7 +225,7 @@ protected function getJsSettingsAssets(AttachedAssetsInterface $assets) {
   /**
    * {@inheritdoc}
    */
-  public function getJsAssets(AttachedAssetsInterface $assets, $optimize, LanguageInterface $language = NULL) {
+  public function getJsAssets(AttachedAssetsInterface $assets, $optimize, ?LanguageInterface $language = NULL) {
     if (!$assets->getLibraries() && !$assets->getSettings()) {
       return [[], []];
     }
diff --git a/core/lib/Drupal/Core/Asset/AssetResolverInterface.php b/core/lib/Drupal/Core/Asset/AssetResolverInterface.php
index 30f0901df2ca..0fac59ca44ac 100644
--- a/core/lib/Drupal/Core/Asset/AssetResolverInterface.php
+++ b/core/lib/Drupal/Core/Asset/AssetResolverInterface.php
@@ -51,7 +51,7 @@ interface AssetResolverInterface {
    * @return array
    *   A (possibly optimized) collection of CSS assets.
    */
-  public function getCssAssets(AttachedAssetsInterface $assets, $optimize, LanguageInterface $language = NULL);
+  public function getCssAssets(AttachedAssetsInterface $assets, $optimize, ?LanguageInterface $language = NULL);
 
   /**
    * Returns the JavaScript assets for the current response's libraries.
@@ -83,6 +83,6 @@ public function getCssAssets(AttachedAssetsInterface $assets, $optimize, Languag
    *   - at index one: the (possibly optimized) collection of JavaScript assets
    *     for the bottom of the page
    */
-  public function getJsAssets(AttachedAssetsInterface $assets, $optimize, LanguageInterface $language = NULL);
+  public function getJsAssets(AttachedAssetsInterface $assets, $optimize, ?LanguageInterface $language = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/Block/BlockManager.php b/core/lib/Drupal/Core/Block/BlockManager.php
index 0741e1579403..95f487858cad 100644
--- a/core/lib/Drupal/Core/Block/BlockManager.php
+++ b/core/lib/Drupal/Core/Block/BlockManager.php
@@ -71,7 +71,7 @@ public function processDefinition(&$definition, $plugin_id) {
   /**
    * {@inheritdoc}
    */
-  public function getSortedDefinitions(array $definitions = NULL) {
+  public function getSortedDefinitions(?array $definitions = NULL) {
     // Sort the plugins first by category, then by admin label.
     $definitions = $this->traitGetSortedDefinitions($definitions, 'admin_label');
     // Do not display the 'broken' plugin in the UI.
diff --git a/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php b/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php
index 6109806eec94..4c4c6a26df95 100644
--- a/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php
+++ b/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php
@@ -54,7 +54,7 @@ public function setContainer(ContainerInterface $container): void {
    *   - 'cache.backend.apcu' (if the PHP process has APCu enabled)
    *   - NULL (if the PHP process doesn't have APCu enabled)
    */
-  public function __construct(Settings $settings = NULL, $consistent_service_name = NULL, $fast_service_name = NULL) {
+  public function __construct(?Settings $settings = NULL, $consistent_service_name = NULL, $fast_service_name = NULL) {
     // Default the consistent backend to the site's default backend.
     if (!isset($consistent_service_name)) {
       $cache_settings = isset($settings) ? $settings->get('cache') : [];
diff --git a/core/lib/Drupal/Core/Command/GenerateTheme.php b/core/lib/Drupal/Core/Command/GenerateTheme.php
index 55d344e366a6..121775fdda33 100644
--- a/core/lib/Drupal/Core/Command/GenerateTheme.php
+++ b/core/lib/Drupal/Core/Command/GenerateTheme.php
@@ -39,7 +39,7 @@ class GenerateTheme extends Command {
   /**
    * {@inheritdoc}
    */
-  public function __construct(string $name = NULL, ?string $root = NULL) {
+  public function __construct(?string $name = NULL, ?string $root = NULL) {
     parent::__construct($name);
 
     $this->root = $root ?? dirname(__DIR__, 5);
diff --git a/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php b/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php
index c68ac7255e68..d033ef0ddea8 100644
--- a/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php
+++ b/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php
@@ -32,7 +32,7 @@ class ConfigCollectionInfo extends Event {
    *   Exception thrown if $collection is equal to
    *   \Drupal\Core\Config\StorageInterface::DEFAULT_COLLECTION.
    */
-  public function addCollection($collection, ConfigFactoryOverrideInterface $override_service = NULL) {
+  public function addCollection($collection, ?ConfigFactoryOverrideInterface $override_service = NULL) {
     if ($collection == StorageInterface::DEFAULT_COLLECTION) {
       throw new \InvalidArgumentException('Can not add the default collection to the ConfigCollectionInfo object');
     }
diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php
index 665c4ff2d58f..70933f8fb0eb 100644
--- a/core/lib/Drupal/Core/Config/ConfigInstaller.php
+++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php
@@ -177,7 +177,7 @@ public function installDefaultConfig($type, $name) {
   /**
    * {@inheritdoc}
    */
-  public function installOptionalConfig(StorageInterface $storage = NULL, $dependency = []) {
+  public function installOptionalConfig(?StorageInterface $storage = NULL, $dependency = []) {
     $profile = $this->drupalGetProfile();
     $enabled_extensions = $this->getEnabledExtensions();
     $existing_config = $this->getActiveStorages()->listAll();
diff --git a/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php b/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php
index 72ae7e7fc879..d6ac429ce38b 100644
--- a/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php
+++ b/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php
@@ -51,7 +51,7 @@ public function installDefaultConfig($type, $name);
    *   'theme', or 'config') and the dependency name as the value
    *   ('node', 'olivero', 'views.view.frontpage').
    */
-  public function installOptionalConfig(StorageInterface $storage = NULL, $dependency = []);
+  public function installOptionalConfig(?StorageInterface $storage = NULL, $dependency = []);
 
   /**
    * Installs all default configuration in the specified collection.
diff --git a/core/lib/Drupal/Core/Config/ConfigManager.php b/core/lib/Drupal/Core/Config/ConfigManager.php
index fc49f26bc64c..72e33d1c5429 100644
--- a/core/lib/Drupal/Core/Config/ConfigManager.php
+++ b/core/lib/Drupal/Core/Config/ConfigManager.php
@@ -266,7 +266,7 @@ public function getConfigDependencyManager() {
   /**
    * {@inheritdoc}
    */
-  public function findConfigEntityDependencies($type, array $names, ConfigDependencyManager $dependency_manager = NULL) {
+  public function findConfigEntityDependencies($type, array $names, ?ConfigDependencyManager $dependency_manager = NULL) {
     if (!$dependency_manager) {
       $dependency_manager = $this->getConfigDependencyManager();
     }
@@ -280,7 +280,7 @@ public function findConfigEntityDependencies($type, array $names, ConfigDependen
   /**
    * {@inheritdoc}
    */
-  public function findConfigEntityDependenciesAsEntities($type, array $names, ConfigDependencyManager $dependency_manager = NULL) {
+  public function findConfigEntityDependenciesAsEntities($type, array $names, ?ConfigDependencyManager $dependency_manager = NULL) {
     $dependencies = $this->findConfigEntityDependencies($type, $names, $dependency_manager);
     $entities = [];
     $definitions = $this->entityTypeManager->getDefinitions();
diff --git a/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php b/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php
index 21ebf27e723d..689425ff1606 100644
--- a/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php
+++ b/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php
@@ -40,7 +40,7 @@ class ConfigModuleOverridesEvent extends Event {
    * @param \Drupal\Core\Language\LanguageInterface $language
    *   (optional) The language for this configuration.
    */
-  public function __construct(array $names, LanguageInterface $language = NULL) {
+  public function __construct(array $names, ?LanguageInterface $language = NULL) {
     $this->names = $names;
     $this->language = $language;
     $this->overrides = [];
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
index 8443c1aa7cb1..82bbb9720b37 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
@@ -141,7 +141,7 @@ public static function getIDFromConfigName($config_name, $config_prefix) {
   /**
    * {@inheritdoc}
    */
-  protected function doLoadMultiple(array $ids = NULL) {
+  protected function doLoadMultiple(?array $ids = NULL) {
     $prefix = $this->getPrefix();
 
     // Get the names of the configuration entities we are going to load.
@@ -464,7 +464,7 @@ public function loadOverrideFree($id) {
   /**
    * {@inheritdoc}
    */
-  public function loadMultipleOverrideFree(array $ids = NULL) {
+  public function loadMultipleOverrideFree(?array $ids = NULL) {
     $this->overrideFree = TRUE;
     $entities = $this->loadMultiple($ids);
     $this->overrideFree = FALSE;
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php
index 2ce93c3e4ec5..4adf7826444c 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php
@@ -80,6 +80,6 @@ public function loadOverrideFree($id);
    *   An array of entity objects indexed by their IDs. Returns an empty array
    *   if no matching entities are found.
    */
-  public function loadMultipleOverrideFree(array $ids = NULL);
+  public function loadMultipleOverrideFree(?array $ids = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php
index bad8ae78bd9c..bd3128fe19d4 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php
@@ -106,7 +106,7 @@ public static function create(ContainerInterface $container) {
    *   Thrown when used twice in the same update function for different entity
    *   types. This method should only be called once per update function.
    */
-  public function update(array &$sandbox, $entity_type_id, callable $callback = NULL, bool $continue_on_error = FALSE) {
+  public function update(array &$sandbox, $entity_type_id, ?callable $callback = NULL, bool $continue_on_error = FALSE) {
     $storage = $this->entityTypeManager->getStorage($entity_type_id);
 
     if (isset($sandbox[self::SANDBOX_KEY]) && $sandbox[self::SANDBOX_KEY]['entity_type'] !== $entity_type_id) {
diff --git a/core/lib/Drupal/Core/Config/Schema/Mapping.php b/core/lib/Drupal/Core/Config/Schema/Mapping.php
index 99f48104f6a7..313914eb1268 100644
--- a/core/lib/Drupal/Core/Config/Schema/Mapping.php
+++ b/core/lib/Drupal/Core/Config/Schema/Mapping.php
@@ -25,7 +25,7 @@ class Mapping extends ArrayElement {
   /**
    * {@inheritdoc}
    */
-  public function __construct(DataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL) {
+  public function __construct(DataDefinitionInterface $definition, $name = NULL, ?TypedDataInterface $parent = NULL) {
     assert($definition instanceof MapDataDefinition);
     // Validate basic structure.
     foreach ($definition['mapping'] as $key => $key_definition) {
diff --git a/core/lib/Drupal/Core/Config/StorageComparer.php b/core/lib/Drupal/Core/Config/StorageComparer.php
index ef2d1945b6c0..afdcdde24437 100644
--- a/core/lib/Drupal/Core/Config/StorageComparer.php
+++ b/core/lib/Drupal/Core/Config/StorageComparer.php
@@ -220,7 +220,7 @@ public function getChangelist($op = NULL, $collection = StorageInterface::DEFAUL
    *   (optional) Array to sort that can be used to sort the changelist. This
    *   array must contain all the items that are in the change list.
    */
-  protected function addChangeList($collection, $op, array $changes, array $sort_order = NULL) {
+  protected function addChangeList($collection, $op, array $changes, ?array $sort_order = NULL) {
     // Only add changes that aren't already listed.
     $changes = array_diff($changes, $this->changelist[$collection][$op]);
     $this->changelist[$collection][$op] = array_merge($this->changelist[$collection][$op], $changes);
diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php
index 2be8256ff094..17346fedf071 100644
--- a/core/lib/Drupal/Core/Config/TypedConfigManager.php
+++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php
@@ -56,7 +56,7 @@ class TypedConfigManager extends TypedDataManager implements TypedConfigManagerI
    * @param \Drupal\Core\DependencyInjection\ClassResolverInterface $class_resolver
    *   (optional) The class resolver.
    */
-  public function __construct(StorageInterface $configStorage, StorageInterface $schemaStorage, CacheBackendInterface $cache, ModuleHandlerInterface $module_handler, ClassResolverInterface $class_resolver = NULL) {
+  public function __construct(StorageInterface $configStorage, StorageInterface $schemaStorage, CacheBackendInterface $cache, ModuleHandlerInterface $module_handler, ?ClassResolverInterface $class_resolver = NULL) {
     $this->configStorage = $configStorage;
     $this->schemaStorage = $schemaStorage;
     $this->setCacheBackend($cache, 'typed_config_definitions');
diff --git a/core/lib/Drupal/Core/Database/Query/Merge.php b/core/lib/Drupal/Core/Database/Query/Merge.php
index 2e7a00cb7f9d..c5685741e9fa 100644
--- a/core/lib/Drupal/Core/Database/Query/Merge.php
+++ b/core/lib/Drupal/Core/Database/Query/Merge.php
@@ -189,7 +189,7 @@ public function updateFields(array $fields) {
    * @return $this
    *   The called object.
    */
-  public function expression($field, $expression, array $arguments = NULL) {
+  public function expression($field, $expression, ?array $arguments = NULL) {
     $this->expressionFields[$field] = [
       'expression' => $expression,
       'arguments' => $arguments,
diff --git a/core/lib/Drupal/Core/Database/Query/Select.php b/core/lib/Drupal/Core/Database/Query/Select.php
index cccdc6ad5e96..ad29bbf50561 100644
--- a/core/lib/Drupal/Core/Database/Query/Select.php
+++ b/core/lib/Drupal/Core/Database/Query/Select.php
@@ -437,7 +437,7 @@ public function escapeField($string) {
   /**
    * {@inheritdoc}
    */
-  public function getArguments(PlaceholderInterface $queryPlaceholder = NULL) {
+  public function getArguments(?PlaceholderInterface $queryPlaceholder = NULL) {
     if (!isset($queryPlaceholder)) {
       $queryPlaceholder = $this;
     }
@@ -455,7 +455,7 @@ public function isPrepared() {
   /**
    * {@inheritdoc}
    */
-  public function preExecute(SelectInterface $query = NULL) {
+  public function preExecute(?SelectInterface $query = NULL) {
     // If no query object is passed in, use $this.
     if (!isset($query)) {
       $query = $this;
diff --git a/core/lib/Drupal/Core/Database/Query/SelectExtender.php b/core/lib/Drupal/Core/Database/Query/SelectExtender.php
index 0681813f04cc..61d91867a892 100644
--- a/core/lib/Drupal/Core/Database/Query/SelectExtender.php
+++ b/core/lib/Drupal/Core/Database/Query/SelectExtender.php
@@ -292,7 +292,7 @@ public function escapeField($string) {
   /**
    * {@inheritdoc}
    */
-  public function getArguments(PlaceholderInterface $queryPlaceholder = NULL) {
+  public function getArguments(?PlaceholderInterface $queryPlaceholder = NULL) {
     return $this->query->getArguments($queryPlaceholder);
   }
 
@@ -306,7 +306,7 @@ public function isPrepared() {
   /**
    * {@inheritdoc}
    */
-  public function preExecute(SelectInterface $query = NULL) {
+  public function preExecute(?SelectInterface $query = NULL) {
     // If no query object is passed in, use $this.
     if (!isset($query)) {
       $query = $this;
diff --git a/core/lib/Drupal/Core/Database/Query/SelectInterface.php b/core/lib/Drupal/Core/Database/Query/SelectInterface.php
index 2293c45ffe05..f3a161af2da6 100644
--- a/core/lib/Drupal/Core/Database/Query/SelectInterface.php
+++ b/core/lib/Drupal/Core/Database/Query/SelectInterface.php
@@ -161,7 +161,7 @@ public function escapeField($string);
    * @return array
    *   An associative array of all placeholder arguments for this query.
    */
-  public function getArguments(PlaceholderInterface $queryPlaceholder = NULL);
+  public function getArguments(?PlaceholderInterface $queryPlaceholder = NULL);
 
   /* Query building operations */
 
@@ -490,7 +490,7 @@ public function isPrepared();
    * @return bool
    *   TRUE if the validation was successful, FALSE if not.
    */
-  public function preExecute(SelectInterface $query = NULL);
+  public function preExecute(?SelectInterface $query = NULL);
 
   /**
    * Runs the query against the database.
diff --git a/core/lib/Drupal/Core/Database/Query/Update.php b/core/lib/Drupal/Core/Database/Query/Update.php
index f1ac9ceba355..f9add858545a 100644
--- a/core/lib/Drupal/Core/Database/Query/Update.php
+++ b/core/lib/Drupal/Core/Database/Query/Update.php
@@ -99,7 +99,7 @@ public function fields(array $fields) {
    * @return $this
    *   The called object.
    */
-  public function expression($field, $expression, array $arguments = NULL) {
+  public function expression($field, $expression, ?array $arguments = NULL) {
     $this->expressionFields[$field] = [
       'expression' => $expression,
       'arguments' => $arguments,
diff --git a/core/lib/Drupal/Core/Database/RowCountException.php b/core/lib/Drupal/Core/Database/RowCountException.php
index c3272e0ea90b..c2c2c6a8b271 100644
--- a/core/lib/Drupal/Core/Database/RowCountException.php
+++ b/core/lib/Drupal/Core/Database/RowCountException.php
@@ -7,7 +7,7 @@
  */
 class RowCountException extends \RuntimeException implements DatabaseException {
 
-  public function __construct($message = '', $code = 0, \Exception $previous = NULL) {
+  public function __construct($message = '', $code = 0, ?\Exception $previous = NULL) {
     if (empty($message)) {
       $message = "rowCount() is supported for DELETE, INSERT, or UPDATE statements performed with structured query builders only, since they would not be portable across database engines otherwise. If the query builders are not sufficient, use a prepareStatement() with an \$allow_row_count argument set to TRUE, execute() the Statement and get the number of matched rows via rowCount().";
     }
diff --git a/core/lib/Drupal/Core/Database/StatementInterface.php b/core/lib/Drupal/Core/Database/StatementInterface.php
index c269c9819b55..be86951f970a 100644
--- a/core/lib/Drupal/Core/Database/StatementInterface.php
+++ b/core/lib/Drupal/Core/Database/StatementInterface.php
@@ -126,7 +126,7 @@ public function fetchField($index = 0);
    *   The object of specified class or \stdClass if not specified. Returns
    *   FALSE or NULL if there is no next row.
    */
-  public function fetchObject(string $class_name = NULL, array $constructor_arguments = []);
+  public function fetchObject(?string $class_name = NULL, array $constructor_arguments = []);
 
   /**
    * Fetches the next row and returns it as an associative array.
diff --git a/core/lib/Drupal/Core/Database/StatementPrefetchIterator.php b/core/lib/Drupal/Core/Database/StatementPrefetchIterator.php
index 4e7ef8fb3272..40f2f2bf297d 100644
--- a/core/lib/Drupal/Core/Database/StatementPrefetchIterator.php
+++ b/core/lib/Drupal/Core/Database/StatementPrefetchIterator.php
@@ -275,7 +275,7 @@ public function fetchField($index = 0) {
   /**
    * {@inheritdoc}
    */
-  public function fetchObject(string $class_name = NULL, array $constructor_arguments = []) {
+  public function fetchObject(?string $class_name = NULL, array $constructor_arguments = []) {
     if (!isset($class_name)) {
       return $this->fetch(\PDO::FETCH_OBJ);
     }
diff --git a/core/lib/Drupal/Core/Database/StatementWrapperIterator.php b/core/lib/Drupal/Core/Database/StatementWrapperIterator.php
index cc1a25ed5237..980ef74ed2e1 100644
--- a/core/lib/Drupal/Core/Database/StatementWrapperIterator.php
+++ b/core/lib/Drupal/Core/Database/StatementWrapperIterator.php
@@ -235,7 +235,7 @@ public function fetchAssoc() {
   /**
    * {@inheritdoc}
    */
-  public function fetchObject(string $class_name = NULL, array $constructor_arguments = []) {
+  public function fetchObject(?string $class_name = NULL, array $constructor_arguments = []) {
     if ($class_name) {
       $row = $this->clientStatement->fetchObject($class_name, $constructor_arguments);
     }
diff --git a/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php b/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php
index b646b874b37e..278aab3673b2 100644
--- a/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php
+++ b/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php
@@ -21,7 +21,7 @@ class ContainerBuilder extends SymfonyContainerBuilder implements ContainerInter
   /**
    * {@inheritdoc}
    */
-  public function __construct(ParameterBagInterface $parameterBag = NULL) {
+  public function __construct(?ParameterBagInterface $parameterBag = NULL) {
     parent::__construct($parameterBag);
     $this->setResourceTracking(FALSE);
   }
diff --git a/core/lib/Drupal/Core/Display/VariantBase.php b/core/lib/Drupal/Core/Display/VariantBase.php
index 6a801859d23f..dafb060d59f6 100644
--- a/core/lib/Drupal/Core/Display/VariantBase.php
+++ b/core/lib/Drupal/Core/Display/VariantBase.php
@@ -130,7 +130,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s
   /**
    * {@inheritdoc}
    */
-  public function access(AccountInterface $account = NULL) {
+  public function access(?AccountInterface $account = NULL) {
     return TRUE;
   }
 
diff --git a/core/lib/Drupal/Core/Display/VariantInterface.php b/core/lib/Drupal/Core/Display/VariantInterface.php
index 948f59019cb3..4f47ea1937d0 100644
--- a/core/lib/Drupal/Core/Display/VariantInterface.php
+++ b/core/lib/Drupal/Core/Display/VariantInterface.php
@@ -71,7 +71,7 @@ public function setWeight($weight);
    * @return bool
    *   TRUE if this display variant is accessible, FALSE otherwise.
    */
-  public function access(AccountInterface $account = NULL);
+  public function access(?AccountInterface $account = NULL);
 
   /**
    * Builds and returns the renderable array for the display variant.
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
index b70022f29d99..cbb7896cc09c 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
@@ -727,7 +727,7 @@ public function toArray() {
   /**
    * {@inheritdoc}
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     if ($operation == 'create') {
       return $this->entityTypeManager()
         ->getAccessControlHandler($this->entityTypeId)
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
index 1a72442e6dda..b713264f2f56 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
@@ -14,14 +14,14 @@ class ContentEntityNullStorage extends ContentEntityStorageBase {
   /**
    * {@inheritdoc}
    */
-  public function loadMultiple(array $ids = NULL) {
+  public function loadMultiple(?array $ids = NULL) {
     return [];
   }
 
   /**
    * {@inheritdoc}
    */
-  protected function doLoadMultiple(array $ids = NULL) {
+  protected function doLoadMultiple(?array $ids = NULL) {
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
index d056c7bf4e7d..574d3871db07 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
@@ -597,7 +597,7 @@ public function finalizePurge(FieldStorageDefinitionInterface $storage_definitio
   /**
    * {@inheritdoc}
    */
-  protected function preLoad(array &$ids = NULL) {
+  protected function preLoad(?array &$ids = NULL) {
     $entities = [];
 
     // Call hook_entity_preload().
@@ -1080,7 +1080,7 @@ protected function cleanIds(array $ids, $entity_key = 'id') {
    * @return \Drupal\Core\Entity\ContentEntityInterface[]
    *   Array of entities from the persistent cache.
    */
-  protected function getFromPersistentCache(array &$ids = NULL) {
+  protected function getFromPersistentCache(?array &$ids = NULL) {
     if (!$this->entityType->isPersistentlyCacheable() || empty($ids)) {
       return [];
     }
@@ -1187,7 +1187,7 @@ public function loadUnchanged($id) {
    *   (optional) If specified, the cache is reset for the entities with the
    *   given ids only.
    */
-  public function resetCache(array $ids = NULL) {
+  public function resetCache(?array $ids = NULL) {
     if ($ids) {
       parent::resetCache($ids);
       if ($this->entityType->isPersistentlyCacheable()) {
diff --git a/core/lib/Drupal/Core/Entity/Controller/EntityController.php b/core/lib/Drupal/Core/Entity/Controller/EntityController.php
index 15e7153189e0..8240d9a5f8b0 100644
--- a/core/lib/Drupal/Core/Entity/Controller/EntityController.php
+++ b/core/lib/Drupal/Core/Entity/Controller/EntityController.php
@@ -261,7 +261,7 @@ public function addBundleTitle(RouteMatchInterface $route_match, $entity_type_id
    * @return string|null
    *   The title for the entity view page, if an entity was found.
    */
-  public function title(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
+  public function title(RouteMatchInterface $route_match, ?EntityInterface $_entity = NULL) {
     if ($entity = $this->doGetEntity($route_match, $_entity)) {
       return $entity->label();
     }
@@ -278,7 +278,7 @@ public function title(RouteMatchInterface $route_match, EntityInterface $_entity
    * @return string|null
    *   The title for the entity edit page, if an entity was found.
    */
-  public function editTitle(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
+  public function editTitle(RouteMatchInterface $route_match, ?EntityInterface $_entity = NULL) {
     if ($entity = $this->doGetEntity($route_match, $_entity)) {
       return $this->t('Edit %label', ['%label' => $entity->label()]);
     }
@@ -296,7 +296,7 @@ public function editTitle(RouteMatchInterface $route_match, EntityInterface $_en
    * @return string
    *   The title for the entity delete page.
    */
-  public function deleteTitle(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
+  public function deleteTitle(RouteMatchInterface $route_match, ?EntityInterface $_entity = NULL) {
     if ($entity = $this->doGetEntity($route_match, $_entity)) {
       return $this->t('Delete %label', ['%label' => $entity->label()]);
     }
@@ -315,7 +315,7 @@ public function deleteTitle(RouteMatchInterface $route_match, EntityInterface $_
    *   The entity, if it is passed in directly or if the first parameter of the
    *   active route is an entity; otherwise, NULL.
    */
-  protected function doGetEntity(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
+  protected function doGetEntity(RouteMatchInterface $route_match, ?EntityInterface $_entity = NULL) {
     if ($_entity) {
       $entity = $_entity;
     }
diff --git a/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php b/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php
index c4c0674bf9e6..5d7ba3aa5fa5 100644
--- a/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php
+++ b/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php
@@ -58,7 +58,7 @@ public function __construct(EntityTypeInterface $entity_type) {
   /**
    * {@inheritdoc}
    */
-  public function access(EntityInterface $entity, $operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access(EntityInterface $entity, $operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $account = $this->prepareUser($account);
     $langcode = $entity->language()->getId();
 
@@ -231,7 +231,7 @@ public function resetCache() {
   /**
    * {@inheritdoc}
    */
-  public function createAccess($entity_bundle = NULL, AccountInterface $account = NULL, array $context = [], $return_as_object = FALSE) {
+  public function createAccess($entity_bundle = NULL, ?AccountInterface $account = NULL, array $context = [], $return_as_object = FALSE) {
     $account = $this->prepareUser($account);
     $context += [
       'entity_type_id' => $this->entityTypeId,
@@ -305,7 +305,7 @@ protected function checkCreateAccess(AccountInterface $account, array $context,
    * @return \Drupal\Core\Session\AccountInterface
    *   Returns the current account object.
    */
-  protected function prepareUser(AccountInterface $account = NULL) {
+  protected function prepareUser(?AccountInterface $account = NULL) {
     if (!$account) {
       $account = \Drupal::currentUser();
     }
@@ -315,7 +315,7 @@ protected function prepareUser(AccountInterface $account = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function fieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account = NULL, FieldItemListInterface $items = NULL, $return_as_object = FALSE) {
+  public function fieldAccess($operation, FieldDefinitionInterface $field_definition, ?AccountInterface $account = NULL, ?FieldItemListInterface $items = NULL, $return_as_object = FALSE) {
     $account = $this->prepareUser($account);
 
     // Get the default access restriction that lives within this field.
@@ -388,7 +388,7 @@ function (callable $hook, string $module) use ($operation, $field_definition, $a
    * @return \Drupal\Core\Access\AccessResultInterface
    *   The access result.
    */
-  protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+  protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
     if (!$items instanceof FieldItemListInterface || $operation !== 'view') {
       return AccessResult::allowed();
     }
diff --git a/core/lib/Drupal/Core/Entity/EntityAccessControlHandlerInterface.php b/core/lib/Drupal/Core/Entity/EntityAccessControlHandlerInterface.php
index 92e09562d54f..64651f03c5e9 100644
--- a/core/lib/Drupal/Core/Entity/EntityAccessControlHandlerInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityAccessControlHandlerInterface.php
@@ -36,7 +36,7 @@ interface EntityAccessControlHandlerInterface {
    *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
    *   access is either explicitly forbidden or "no opinion".
    */
-  public function access(EntityInterface $entity, $operation, AccountInterface $account = NULL, $return_as_object = FALSE);
+  public function access(EntityInterface $entity, $operation, ?AccountInterface $account = NULL, $return_as_object = FALSE);
 
   /**
    * Checks access to create an entity.
@@ -60,7 +60,7 @@ public function access(EntityInterface $entity, $operation, AccountInterface $ac
    *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
    *   access is either explicitly forbidden or "no opinion".
    */
-  public function createAccess($entity_bundle = NULL, AccountInterface $account = NULL, array $context = [], $return_as_object = FALSE);
+  public function createAccess($entity_bundle = NULL, ?AccountInterface $account = NULL, array $context = [], $return_as_object = FALSE);
 
   /**
    * Clears all cached access checks.
@@ -110,6 +110,6 @@ public function setModuleHandler(ModuleHandlerInterface $module_handler);
    *
    * @see \Drupal\Core\Entity\EntityAccessControlHandlerInterface::access()
    */
-  public function fieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account = NULL, FieldItemListInterface $items = NULL, $return_as_object = FALSE);
+  public function fieldAccess($operation, FieldDefinitionInterface $field_definition, ?AccountInterface $account = NULL, ?FieldItemListInterface $items = NULL, $return_as_object = FALSE);
 
 }
diff --git a/core/lib/Drupal/Core/Entity/EntityBase.php b/core/lib/Drupal/Core/Entity/EntityBase.php
index 8a32728bf2b5..f18253f1579e 100644
--- a/core/lib/Drupal/Core/Entity/EntityBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityBase.php
@@ -318,7 +318,7 @@ public function uriRelationships() {
   /**
    * {@inheritdoc}
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     if ($operation == 'create') {
       return $this->entityTypeManager()
         ->getAccessControlHandler($this->entityTypeId)
@@ -506,7 +506,7 @@ public static function load($id) {
   /**
    * {@inheritdoc}
    */
-  public static function loadMultiple(array $ids = NULL) {
+  public static function loadMultiple(?array $ids = NULL) {
     $entity_type_repository = \Drupal::service('entity_type.repository');
     $entity_type_manager = \Drupal::entityTypeManager();
     $storage = $entity_type_manager->getStorage($entity_type_repository->getEntityTypeFromClass(static::class));
diff --git a/core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php b/core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php
index ee9af88b22a8..2537c6bfd7c2 100644
--- a/core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php
+++ b/core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php
@@ -160,7 +160,7 @@ public function filterByFields(array $field_names) {
   /**
    * {@inheritdoc}
    */
-  public function filterByFieldAccess(AccountInterface $account = NULL) {
+  public function filterByFieldAccess(?AccountInterface $account = NULL) {
     $filtered_fields = [];
     foreach ($this->getFieldNames() as $field_name) {
       if (!$this->entity->get($field_name)->access('edit', $account)) {
diff --git a/core/lib/Drupal/Core/Entity/EntityConstraintViolationListInterface.php b/core/lib/Drupal/Core/Entity/EntityConstraintViolationListInterface.php
index c344e2a29792..0f6db71217d4 100644
--- a/core/lib/Drupal/Core/Entity/EntityConstraintViolationListInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityConstraintViolationListInterface.php
@@ -88,7 +88,7 @@ public function filterByFields(array $field_names);
    *
    * @return $this
    */
-  public function filterByFieldAccess(AccountInterface $account = NULL);
+  public function filterByFieldAccess(?AccountInterface $account = NULL);
 
   /**
    * Returns the names of all violated fields.
diff --git a/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php b/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php
index 47c836088702..72449e7a8d6d 100644
--- a/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php
+++ b/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php
@@ -187,7 +187,7 @@ public function installFieldableEntityType(EntityTypeInterface $entity_type, arr
   /**
    * {@inheritdoc}
    */
-  public function updateFieldableEntityType(EntityTypeInterface $entity_type, array $field_storage_definitions, array &$sandbox = NULL) {
+  public function updateFieldableEntityType(EntityTypeInterface $entity_type, array $field_storage_definitions, ?array &$sandbox = NULL) {
     $original = $this->getEntityType($entity_type->id());
 
     if ($this->requiresEntityDataMigration($entity_type, $original) && $sandbox === NULL) {
diff --git a/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php
index edae57c9e44e..5f28d54fdafe 100644
--- a/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php
@@ -170,7 +170,7 @@ public function uninstallEntityType(EntityTypeInterface $entity_type);
    *   or a Batch API callback. If the entity schema update requires a data
    *   migration, this parameter is mandatory. Defaults to NULL.
    */
-  public function updateFieldableEntityType(EntityTypeInterface $entity_type, array $field_storage_definitions, array &$sandbox = NULL);
+  public function updateFieldableEntityType(EntityTypeInterface $entity_type, array $field_storage_definitions, ?array &$sandbox = NULL);
 
   /**
    * Returns a field storage definition ready to be manipulated.
diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php
index b154eca3b255..592a265477ee 100644
--- a/core/lib/Drupal/Core/Entity/EntityInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityInterface.php
@@ -194,7 +194,7 @@ public static function load($id);
    * @return static[]
    *   An array of entity objects indexed by their IDs.
    */
-  public static function loadMultiple(array $ids = NULL);
+  public static function loadMultiple(?array $ids = NULL);
 
   /**
    * Constructs a new entity object, without permanently saving it.
diff --git a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php
index 5bca2897bb84..5e9b2cd3c6d8 100644
--- a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php
+++ b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php
@@ -91,7 +91,7 @@ public function getSelectionGroups($entity_type_id) {
   /**
    * {@inheritdoc}
    */
-  public function getSelectionHandler(FieldDefinitionInterface $field_definition, EntityInterface $entity = NULL) {
+  public function getSelectionHandler(FieldDefinitionInterface $field_definition, ?EntityInterface $entity = NULL) {
     $options = $field_definition->getSetting('handler_settings') ?: [];
     $options += [
       'target_type' => $field_definition->getFieldStorageDefinition()->getSetting('target_type'),
diff --git a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManagerInterface.php
index 4d8437de7151..b0570c90dab9 100644
--- a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManagerInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManagerInterface.php
@@ -46,6 +46,6 @@ public function getSelectionGroups($entity_type_id);
    * @return \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface
    *   The selection plugin.
    */
-  public function getSelectionHandler(FieldDefinitionInterface $field_definition, EntityInterface $entity = NULL);
+  public function getSelectionHandler(FieldDefinitionInterface $field_definition, ?EntityInterface $entity = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/Entity/EntityRepository.php b/core/lib/Drupal/Core/Entity/EntityRepository.php
index 76ea90b24a26..2f117986d910 100644
--- a/core/lib/Drupal/Core/Entity/EntityRepository.php
+++ b/core/lib/Drupal/Core/Entity/EntityRepository.php
@@ -127,14 +127,14 @@ public function getTranslationFromContext(EntityInterface $entity, $langcode = N
   /**
    * {@inheritdoc}
    */
-  public function getActive($entity_type_id, $entity_id, array $contexts = NULL) {
+  public function getActive($entity_type_id, $entity_id, ?array $contexts = NULL) {
     return current($this->getActiveMultiple($entity_type_id, [$entity_id], $contexts)) ?: NULL;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getActiveMultiple($entity_type_id, array $entity_ids, array $contexts = NULL) {
+  public function getActiveMultiple($entity_type_id, array $entity_ids, ?array $contexts = NULL) {
     $active = [];
 
     if (!isset($contexts)) {
@@ -171,14 +171,14 @@ public function getActiveMultiple($entity_type_id, array $entity_ids, array $con
   /**
    * {@inheritdoc}
    */
-  public function getCanonical($entity_type_id, $entity_id, array $contexts = NULL) {
+  public function getCanonical($entity_type_id, $entity_id, ?array $contexts = NULL) {
     return current($this->getCanonicalMultiple($entity_type_id, [$entity_id], $contexts)) ?: NULL;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getCanonicalMultiple($entity_type_id, array $entity_ids, array $contexts = NULL) {
+  public function getCanonicalMultiple($entity_type_id, array $entity_ids, ?array $contexts = NULL) {
     $entities = $this->entityTypeManager->getStorage($entity_type_id)
       ->loadMultiple($entity_ids);
 
diff --git a/core/lib/Drupal/Core/Entity/EntityRepositoryInterface.php b/core/lib/Drupal/Core/Entity/EntityRepositoryInterface.php
index 43328232eeab..cba3eb5002a6 100644
--- a/core/lib/Drupal/Core/Entity/EntityRepositoryInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityRepositoryInterface.php
@@ -109,7 +109,7 @@ public function getTranslationFromContext(EntityInterface $entity, $langcode = N
    * @return \Drupal\Core\Entity\EntityInterface|null
    *   An entity object variant or NULL if the entity does not exist.
    */
-  public function getActive($entity_type_id, $entity_id, array $contexts = NULL);
+  public function getActive($entity_type_id, $entity_id, ?array $contexts = NULL);
 
   /**
    * Retrieves the active entity variants matching the specified context.
@@ -129,7 +129,7 @@ public function getActive($entity_type_id, $entity_id, array $contexts = NULL);
    *
    * @see getActive()
    */
-  public function getActiveMultiple($entity_type_id, array $entity_ids, array $contexts = NULL);
+  public function getActiveMultiple($entity_type_id, array $entity_ids, ?array $contexts = NULL);
 
   /**
    * Retrieves the canonical entity variant matching the specified context.
@@ -157,7 +157,7 @@ public function getActiveMultiple($entity_type_id, array $entity_ids, array $con
    * @return \Drupal\Core\Entity\EntityInterface|null
    *   An entity object variant or NULL if the entity does not exist.
    */
-  public function getCanonical($entity_type_id, $entity_id, array $contexts = NULL);
+  public function getCanonical($entity_type_id, $entity_id, ?array $contexts = NULL);
 
   /**
    * Retrieves the canonical entity variants matching the specified context.
@@ -177,6 +177,6 @@ public function getCanonical($entity_type_id, $entity_id, array $contexts = NULL
    *
    * @see getCanonical()
    */
-  public function getCanonicalMultiple($entity_type_id, array $entity_ids, array $contexts = NULL);
+  public function getCanonicalMultiple($entity_type_id, array $entity_ids, ?array $contexts = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php
index 2abbdcd31c3c..a1171201414f 100644
--- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php
@@ -153,7 +153,7 @@ public function loadUnchanged($id) {
   /**
    * {@inheritdoc}
    */
-  public function resetCache(array $ids = NULL) {
+  public function resetCache(?array $ids = NULL) {
     if ($this->entityType->isStaticallyCacheable() && isset($ids)) {
       foreach ($ids as $id) {
         $this->memoryCache->delete($this->buildCacheId($id));
@@ -266,7 +266,7 @@ public function load($id) {
   /**
    * {@inheritdoc}
    */
-  public function loadMultiple(array $ids = NULL) {
+  public function loadMultiple(?array $ids = NULL) {
     $entities = [];
     $preloaded_entities = [];
 
@@ -347,7 +347,7 @@ public function loadMultiple(array $ids = NULL) {
    * @return \Drupal\Core\Entity\EntityInterface[]
    *   Associative array of entities, keyed on the entity ID.
    */
-  abstract protected function doLoadMultiple(array $ids = NULL);
+  abstract protected function doLoadMultiple(?array $ids = NULL);
 
   /**
    * Gathers entities from a 'preload' step.
@@ -359,7 +359,7 @@ abstract protected function doLoadMultiple(array $ids = NULL);
    * @return \Drupal\Core\Entity\EntityInterface[]
    *   Associative array of entities, keyed by the entity ID.
    */
-  protected function preLoad(array &$ids = NULL) {
+  protected function preLoad(?array &$ids = NULL) {
     return [];
   }
 
diff --git a/core/lib/Drupal/Core/Entity/EntityStorageInterface.php b/core/lib/Drupal/Core/Entity/EntityStorageInterface.php
index 336b7c2c41c6..f62b420d3c46 100644
--- a/core/lib/Drupal/Core/Entity/EntityStorageInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityStorageInterface.php
@@ -32,7 +32,7 @@ interface EntityStorageInterface {
    *   (optional) If specified, the cache is reset for the entities with the
    *   given ids only.
    */
-  public function resetCache(array $ids = NULL);
+  public function resetCache(?array $ids = NULL);
 
   /**
    * Loads one or more entities.
@@ -44,7 +44,7 @@ public function resetCache(array $ids = NULL);
    *   An array of entity objects indexed by their IDs. Returns an empty array
    *   if no matching entities are found.
    */
-  public function loadMultiple(array $ids = NULL);
+  public function loadMultiple(?array $ids = NULL);
 
   /**
    * Loads one entity.
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeEvent.php b/core/lib/Drupal/Core/Entity/EntityTypeEvent.php
index df7a8127a616..d31d6235ab2e 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeEvent.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeEvent.php
@@ -32,7 +32,7 @@ class EntityTypeEvent extends Event {
    *   (optional) The original entity type. This should be passed only when
    *   updating the entity type.
    */
-  public function __construct(EntityTypeInterface $entity_type, EntityTypeInterface $original = NULL) {
+  public function __construct(EntityTypeInterface $entity_type, ?EntityTypeInterface $original = NULL) {
     $this->entityType = $entity_type;
     $this->original = $original;
   }
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeEventSubscriberTrait.php b/core/lib/Drupal/Core/Entity/EntityTypeEventSubscriberTrait.php
index 417de18f6652..05aa84a04472 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeEventSubscriberTrait.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeEventSubscriberTrait.php
@@ -74,7 +74,7 @@ public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeI
   /**
    * {@inheritdoc}
    */
-  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeListener.php b/core/lib/Drupal/Core/Entity/EntityTypeListener.php
index 0768dee0c892..c3eaa97dda6f 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeListener.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeListener.php
@@ -149,7 +149,7 @@ public function onEntityTypeDelete(EntityTypeInterface $entity_type) {
   /**
    * {@inheritdoc}
    */
-  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
     $entity_type_id = $entity_type->id();
 
     // @todo Forward this to all interested handlers, not only storage, once
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php
index b00e6829d8a0..c5775eab29f1 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php
@@ -51,7 +51,7 @@ public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeI
    *   or a Batch API callback. If the entity schema update requires a data
    *   migration, this parameter is mandatory. Defaults to NULL.
    */
-  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL);
+  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL);
 
   /**
    * Reacts to the deletion of the entity type.
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeManager.php b/core/lib/Drupal/Core/Entity/EntityTypeManager.php
index 5c5eef039ae5..eb1486de4735 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeManager.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeManager.php
@@ -271,7 +271,7 @@ public function getHandler($entity_type_id, $handler_type) {
   /**
    * {@inheritdoc}
    */
-  public function createHandlerInstance($class, EntityTypeInterface $definition = NULL) {
+  public function createHandlerInstance($class, ?EntityTypeInterface $definition = NULL) {
     if (is_subclass_of($class, 'Drupal\Core\Entity\EntityHandlerInterface')) {
       $handler = $class::createInstance($this->container, $definition);
     }
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php
index b453fe330b5d..06f7f8e96925 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php
@@ -132,7 +132,7 @@ public function getHandler($entity_type_id, $handler_type);
    * @return object
    *   A handler instance.
    */
-  public function createHandlerInstance($class, EntityTypeInterface $definition = NULL);
+  public function createHandlerInstance($class, ?EntityTypeInterface $definition = NULL);
 
   /**
    * {@inheritdoc}
diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
index 46a90168a4e5..149ea3ca32ce 100644
--- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
+++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
@@ -399,7 +399,7 @@ public function getCacheTags() {
   /**
    * {@inheritdoc}
    */
-  public function resetCache(array $entities = NULL) {
+  public function resetCache(?array $entities = NULL) {
     // If no set of specific entities is provided, invalidate the entity view
     // builder's cache tag. This will invalidate all entities rendered by this
     // view builder.
diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilderInterface.php b/core/lib/Drupal/Core/Entity/EntityViewBuilderInterface.php
index 8951a18d14ed..cf2a187a2f66 100644
--- a/core/lib/Drupal/Core/Entity/EntityViewBuilderInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityViewBuilderInterface.php
@@ -78,7 +78,7 @@ public function viewMultiple(array $entities = [], $view_mode = 'full', $langcod
    * @param \Drupal\Core\Entity\EntityInterface[] $entities
    *   (optional) If specified, the cache is reset for the given entities only.
    */
-  public function resetCache(array $entities = NULL);
+  public function resetCache(?array $entities = NULL);
 
   /**
    * Builds a renderable array for the value of a single field in an entity.
diff --git a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php b/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
index d6da061fc0fe..3c97ad50499a 100644
--- a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
+++ b/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
@@ -118,7 +118,7 @@ public function doCreate(array $values = []) {
   /**
    * {@inheritdoc}
    */
-  public function doLoadMultiple(array $ids = NULL) {
+  public function doLoadMultiple(?array $ids = NULL) {
     if (empty($ids)) {
       $entities = $this->keyValueStore->getAll();
     }
diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
index e67614336ab1..6d383ce3f518 100644
--- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
+++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
@@ -342,7 +342,7 @@ public function setTemporary($temporary) {
   /**
    * {@inheritdoc}
    */
-  public function getTableMapping(array $storage_definitions = NULL) {
+  public function getTableMapping(?array $storage_definitions = NULL) {
     // If a new set of field storage definitions is passed, for instance when
     // comparing old and new storage schema, we compute the table mapping
     // without caching.
@@ -384,7 +384,7 @@ public function getCustomTableMapping(ContentEntityTypeInterface $entity_type, a
   /**
    * {@inheritdoc}
    */
-  protected function doLoadMultiple(array $ids = NULL) {
+  protected function doLoadMultiple(?array $ids = NULL) {
     // Attempt to load entities from the persistent cache. This will remove IDs
     // that were loaded from $ids.
     $entities_from_cache = $this->getFromPersistentCache($ids);
@@ -408,7 +408,7 @@ protected function doLoadMultiple(array $ids = NULL) {
    * @return \Drupal\Core\Entity\ContentEntityInterface[]
    *   Array of entities from the storage.
    */
-  protected function getFromStorage(array $ids = NULL) {
+  protected function getFromStorage(?array $ids = NULL) {
     $entities = [];
 
     if (!empty($ids)) {
@@ -1522,7 +1522,7 @@ public function onFieldableEntityTypeCreate(EntityTypeInterface $entity_type, ar
   /**
    * {@inheritdoc}
    */
-  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
     $this->wrapSchemaException(function () use ($entity_type, $original, $field_storage_definitions, $original_field_storage_definitions, &$sandbox) {
       $this->getStorageSchema()->onFieldableEntityTypeUpdate($entity_type, $original, $field_storage_definitions, $original_field_storage_definitions, $sandbox);
     });
diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
index 1a794a145f3f..3b3abae2a04d 100644
--- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
+++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
@@ -189,7 +189,7 @@ protected function updateBackupRepository() {
    * @return \Drupal\Core\Entity\Sql\DefaultTableMapping
    *   A table mapping object.
    */
-  protected function getTableMapping(EntityTypeInterface $entity_type, array $storage_definitions = NULL) {
+  protected function getTableMapping(EntityTypeInterface $entity_type, ?array $storage_definitions = NULL) {
     // Allow passing a single field storage definition when updating a field.
     if ($storage_definitions && count($storage_definitions) === 1) {
       $storage_definition = reset($storage_definitions);
@@ -442,14 +442,14 @@ public function onFieldableEntityTypeCreate(EntityTypeInterface $entity_type, ar
   /**
    * {@inheritdoc}
    */
-  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
     $this->traitOnFieldableEntityTypeUpdate($entity_type, $original, $field_storage_definitions, $original_field_storage_definitions, $sandbox);
   }
 
   /**
    * {@inheritdoc}
    */
-  protected function preUpdateEntityTypeSchema(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  protected function preUpdateEntityTypeSchema(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
     $temporary_prefix = static::getTemporaryTableMappingPrefix($entity_type, $field_storage_definitions);
     $sandbox['temporary_table_mapping'] = $this->storage->getCustomTableMapping($entity_type, $field_storage_definitions, $temporary_prefix);
     $sandbox['new_table_mapping'] = $this->storage->getCustomTableMapping($entity_type, $field_storage_definitions);
@@ -513,7 +513,7 @@ protected function preUpdateEntityTypeSchema(EntityTypeInterface $entity_type, E
   /**
    * {@inheritdoc}
    */
-  protected function postUpdateEntityTypeSchema(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  protected function postUpdateEntityTypeSchema(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
     /** @var \Drupal\Core\Entity\Sql\TableMappingInterface $original_table_mapping */
     $original_table_mapping = $sandbox['original_table_mapping'];
     /** @var \Drupal\Core\Entity\Sql\TableMappingInterface $new_table_mapping */
@@ -1523,7 +1523,7 @@ protected function processFieldStorageSchema(array &$field_storage_schema) {
    *   (optional) The original field storage definition. This is relevant (and
    *   required) only for updates. Defaults to NULL.
    */
-  protected function performFieldSchemaOperation($operation, FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original = NULL) {
+  protected function performFieldSchemaOperation($operation, FieldStorageDefinitionInterface $storage_definition, ?FieldStorageDefinitionInterface $original = NULL) {
     $table_mapping = $this->getTableMapping($this->entityType, [$storage_definition]);
     if ($table_mapping->requiresDedicatedTableStorage($storage_definition)) {
       $this->{$operation . 'DedicatedTableSchema'}($storage_definition, $original);
@@ -1915,7 +1915,7 @@ protected function updateSharedTableSchema(FieldStorageDefinitionInterface $stor
    *   keys involving its columns will be processed. Otherwise all defined
    *   entity indexes and keys will be processed.
    */
-  protected function createEntitySchemaIndexes(array $entity_schema, FieldStorageDefinitionInterface $storage_definition = NULL) {
+  protected function createEntitySchemaIndexes(array $entity_schema, ?FieldStorageDefinitionInterface $storage_definition = NULL) {
     $schema_handler = $this->database->schema();
 
     if ($storage_definition) {
@@ -1974,7 +1974,7 @@ protected function createEntitySchemaIndexes(array $entity_schema, FieldStorageD
    *   keys involving its columns will be processed. Otherwise all defined
    *   entity indexes and keys will be processed.
    */
-  protected function deleteEntitySchemaIndexes(array $entity_schema_data, FieldStorageDefinitionInterface $storage_definition = NULL) {
+  protected function deleteEntitySchemaIndexes(array $entity_schema_data, ?FieldStorageDefinitionInterface $storage_definition = NULL) {
     $schema_handler = $this->database->schema();
 
     if ($storage_definition) {
@@ -2234,7 +2234,7 @@ protected function addSharedTableFieldForeignKey(FieldStorageDefinitionInterface
    *
    * @see hook_schema()
    */
-  protected function getDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition, ContentEntityTypeInterface $entity_type = NULL) {
+  protected function getDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition, ?ContentEntityTypeInterface $entity_type = NULL) {
     $entity_type = $entity_type ?: $this->entityType;
     $description_current = "Data storage for {$storage_definition->getTargetEntityTypeId()} field {$storage_definition->getName()}.";
     $description_revision = "Revision archive storage for {$storage_definition->getTargetEntityTypeId()} field {$storage_definition->getName()}.";
diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlEntityStorageInterface.php b/core/lib/Drupal/Core/Entity/Sql/SqlEntityStorageInterface.php
index 65381a95015a..c9f1a13bcf4d 100644
--- a/core/lib/Drupal/Core/Entity/Sql/SqlEntityStorageInterface.php
+++ b/core/lib/Drupal/Core/Entity/Sql/SqlEntityStorageInterface.php
@@ -20,6 +20,6 @@ interface SqlEntityStorageInterface extends EntityStorageInterface {
    * @return \Drupal\Core\Entity\Sql\TableMappingInterface
    *   A table mapping object for the entity's tables.
    */
-  public function getTableMapping(array $storage_definitions = NULL);
+  public function getTableMapping(?array $storage_definitions = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlFieldableEntityTypeListenerTrait.php b/core/lib/Drupal/Core/Entity/Sql/SqlFieldableEntityTypeListenerTrait.php
index af967cda6eb7..827c7fa763c3 100644
--- a/core/lib/Drupal/Core/Entity/Sql/SqlFieldableEntityTypeListenerTrait.php
+++ b/core/lib/Drupal/Core/Entity/Sql/SqlFieldableEntityTypeListenerTrait.php
@@ -21,7 +21,7 @@ trait SqlFieldableEntityTypeListenerTrait {
   /**
    * {@inheritdoc}
    */
-  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
     /** @var \Drupal\Core\Entity\EntityStorageInterface $original_storage */
     $original_storage = $this->entityTypeManager->createHandlerInstance($original->getStorageClass(), $original);
     $has_data = $original_storage->hasData();
@@ -98,7 +98,7 @@ public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, En
    *   or a Batch API callback. If the entity schema update requires a data
    *   migration, this parameter is mandatory. Defaults to NULL.
    */
-  protected function preUpdateEntityTypeSchema(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  protected function preUpdateEntityTypeSchema(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
   }
 
   /**
@@ -117,7 +117,7 @@ protected function preUpdateEntityTypeSchema(EntityTypeInterface $entity_type, E
    *   or a Batch API callback. If the entity schema update requires a data
    *   migration, this parameter is mandatory. Defaults to NULL.
    */
-  protected function postUpdateEntityTypeSchema(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  protected function postUpdateEntityTypeSchema(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php b/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php
index e3910fd6f01e..dc537b6b4534 100644
--- a/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php
+++ b/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php
@@ -138,7 +138,7 @@ public function getBundles() {
   /**
    * {@inheritdoc}
    */
-  public function setBundles(array $bundles = NULL) {
+  public function setBundles(?array $bundles = NULL) {
     if (isset($bundles)) {
       $this->addConstraint('Bundle', $bundles);
     }
diff --git a/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinitionInterface.php b/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinitionInterface.php
index 1fff95d122be..dcff02886fe8 100644
--- a/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinitionInterface.php
+++ b/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinitionInterface.php
@@ -43,6 +43,6 @@ public function getBundles();
    *
    * @return $this
    */
-  public function setBundles(array $bundles = NULL);
+  public function setBundles(?array $bundles = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php
index 7a375e43c20a..4af6932e45f4 100644
--- a/core/lib/Drupal/Core/Entity/entity.api.php
+++ b/core/lib/Drupal/Core/Entity/entity.api.php
@@ -2159,7 +2159,7 @@ function hook_entity_operation_alter(array &$operations, \Drupal\Core\Entity\Ent
  *
  * @see \Drupal\Core\Entity\EntityAccessControlHandlerInterface::fieldAccess()
  */
-function hook_entity_field_access($operation, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, \Drupal\Core\Session\AccountInterface $account, \Drupal\Core\Field\FieldItemListInterface $items = NULL) {
+function hook_entity_field_access($operation, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, \Drupal\Core\Session\AccountInterface $account, ?\Drupal\Core\Field\FieldItemListInterface $items = NULL) {
   if ($field_definition->getName() == 'field_of_interest' && $operation == 'edit') {
     return AccessResult::allowedIfHasPermission($account, 'update field of interest');
   }
diff --git a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
index 307afa9aac12..0641bc85ea62 100644
--- a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
+++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
@@ -103,7 +103,7 @@ class ExtensionDiscovery {
    * @param string $site_path
    *   The path to the site.
    */
-  public function __construct(string $root, $use_file_cache = TRUE, array $profile_directories = NULL, string $site_path = NULL) {
+  public function __construct(string $root, $use_file_cache = TRUE, ?array $profile_directories = NULL, ?string $site_path = NULL) {
     $this->root = $root;
     $this->fileCache = $use_file_cache ? FileCacheFactory::get('extension_discovery') : NULL;
     $this->profileDirectories = $profile_directories;
@@ -271,7 +271,7 @@ public function getProfileDirectories() {
    *
    * @return $this
    */
-  public function setProfileDirectories(array $paths = NULL) {
+  public function setProfileDirectories(?array $paths = NULL) {
     $this->profileDirectories = $paths;
     return $this;
   }
diff --git a/core/lib/Drupal/Core/Field/ChangedFieldItemList.php b/core/lib/Drupal/Core/Field/ChangedFieldItemList.php
index db8566fef3e4..13efce6d650f 100644
--- a/core/lib/Drupal/Core/Field/ChangedFieldItemList.php
+++ b/core/lib/Drupal/Core/Field/ChangedFieldItemList.php
@@ -13,7 +13,7 @@ class ChangedFieldItemList extends FieldItemList {
   /**
    * {@inheritdoc}
    */
-  public function defaultAccess($operation = 'view', AccountInterface $account = NULL) {
+  public function defaultAccess($operation = 'view', ?AccountInterface $account = NULL) {
     // It is not possible to edit the changed field.
     return AccessResult::allowedIf($operation !== 'edit');
   }
diff --git a/core/lib/Drupal/Core/Field/FieldItemBase.php b/core/lib/Drupal/Core/Field/FieldItemBase.php
index 564359d3bef7..2c8178ac134e 100644
--- a/core/lib/Drupal/Core/Field/FieldItemBase.php
+++ b/core/lib/Drupal/Core/Field/FieldItemBase.php
@@ -57,7 +57,7 @@ public static function mainPropertyName() {
   /**
    * {@inheritdoc}
    */
-  public function __construct(ComplexDataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL) {
+  public function __construct(ComplexDataDefinitionInterface $definition, $name = NULL, ?TypedDataInterface $parent = NULL) {
     parent::__construct($definition, $name, $parent);
     // Initialize computed properties by default, such that they get cloned
     // with the whole item.
diff --git a/core/lib/Drupal/Core/Field/FieldItemList.php b/core/lib/Drupal/Core/Field/FieldItemList.php
index dab8b035f8ce..8a1aecd73227 100644
--- a/core/lib/Drupal/Core/Field/FieldItemList.php
+++ b/core/lib/Drupal/Core/Field/FieldItemList.php
@@ -149,7 +149,7 @@ public function __unset($property_name) {
   /**
    * {@inheritdoc}
    */
-  public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation = 'view', ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $access_control_handler = \Drupal::entityTypeManager()->getAccessControlHandler($this->getEntity()->getEntityTypeId());
     return $access_control_handler->fieldAccess($operation, $this->getFieldDefinition(), $account, $this, $return_as_object);
   }
@@ -157,7 +157,7 @@ public function access($operation = 'view', AccountInterface $account = NULL, $r
   /**
    * {@inheritdoc}
    */
-  public function defaultAccess($operation = 'view', AccountInterface $account = NULL) {
+  public function defaultAccess($operation = 'view', ?AccountInterface $account = NULL) {
     // Grant access per default.
     return AccessResult::allowed();
   }
diff --git a/core/lib/Drupal/Core/Field/FieldItemListInterface.php b/core/lib/Drupal/Core/Field/FieldItemListInterface.php
index d52834aace19..2c2683cfdb78 100644
--- a/core/lib/Drupal/Core/Field/FieldItemListInterface.php
+++ b/core/lib/Drupal/Core/Field/FieldItemListInterface.php
@@ -90,7 +90,7 @@ public function getSetting($setting_name);
    * @return \Drupal\Core\Access\AccessResultInterface
    *   The access result.
    */
-  public function defaultAccess($operation = 'view', AccountInterface $account = NULL);
+  public function defaultAccess($operation = 'view', ?AccountInterface $account = NULL);
 
   /**
    * Filters out empty field items and re-numbers the item deltas.
diff --git a/core/lib/Drupal/Core/Field/FieldStorageDefinitionEvent.php b/core/lib/Drupal/Core/Field/FieldStorageDefinitionEvent.php
index 9a6f3d3e3432..ce3f17897209 100644
--- a/core/lib/Drupal/Core/Field/FieldStorageDefinitionEvent.php
+++ b/core/lib/Drupal/Core/Field/FieldStorageDefinitionEvent.php
@@ -32,7 +32,7 @@ class FieldStorageDefinitionEvent extends Event {
    *   (optional) The original field storage definition. This should be passed
    *   only when updating the storage definition.
    */
-  public function __construct(FieldStorageDefinitionInterface $field_storage_definition, FieldStorageDefinitionInterface $original = NULL) {
+  public function __construct(FieldStorageDefinitionInterface $field_storage_definition, ?FieldStorageDefinitionInterface $original = NULL) {
     $this->fieldStorageDefinition = $field_storage_definition;
     $this->original = $original;
   }
diff --git a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php
index 5dcb8f1ed91f..5927e6a1ea3b 100644
--- a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php
+++ b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php
@@ -173,7 +173,7 @@ public function getFieldSettingsSummary(FieldDefinitionInterface $field_definiti
    *   Keys are category names, and values are arrays of which the keys are
    *   plugin IDs and the values are plugin definitions.
    */
-  public function getGroupedDefinitions(array $definitions = NULL, $label_key = 'label', $category_label_key = 'label') {
+  public function getGroupedDefinitions(?array $definitions = NULL, $label_key = 'label', $category_label_key = 'label') {
     $grouped_categories = $this->getGroupedDefinitionsTrait($definitions, $label_key);
     $category_info = $this->fieldTypeCategoryManager->getDefinitions();
 
diff --git a/core/lib/Drupal/Core/Field/FieldUpdateActionBase.php b/core/lib/Drupal/Core/Field/FieldUpdateActionBase.php
index b00872f9bec2..ed184e9eb3f3 100644
--- a/core/lib/Drupal/Core/Field/FieldUpdateActionBase.php
+++ b/core/lib/Drupal/Core/Field/FieldUpdateActionBase.php
@@ -48,7 +48,7 @@ public function execute($entity = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     /** @var \Drupal\Core\Access\AccessResultInterface $result */
     $result = $object->access('update', $account, TRUE);
 
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
index e52da2578574..67c7571b1fc0 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
@@ -84,14 +84,14 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
   /**
    * {@inheritdoc}
    */
-  public function getPossibleValues(AccountInterface $account = NULL) {
+  public function getPossibleValues(?AccountInterface $account = NULL) {
     return [0, 1];
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getPossibleOptions(AccountInterface $account = NULL) {
+  public function getPossibleOptions(?AccountInterface $account = NULL) {
     return [
       0 => $this->getSetting('off_label'),
       1 => $this->getSetting('on_label'),
@@ -101,14 +101,14 @@ public function getPossibleOptions(AccountInterface $account = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function getSettableValues(AccountInterface $account = NULL) {
+  public function getSettableValues(?AccountInterface $account = NULL) {
     return [0, 1];
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getSettableOptions(AccountInterface $account = NULL) {
+  public function getSettableOptions(?AccountInterface $account = NULL) {
     return $this->getPossibleOptions($account);
   }
 
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
index b2e621fd12d0..ef3d79d36ee5 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
@@ -646,21 +646,21 @@ public static function onDependencyRemoval(FieldDefinitionInterface $field_defin
   /**
    * {@inheritdoc}
    */
-  public function getPossibleValues(AccountInterface $account = NULL) {
+  public function getPossibleValues(?AccountInterface $account = NULL) {
     return $this->getSettableValues($account);
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getPossibleOptions(AccountInterface $account = NULL) {
+  public function getPossibleOptions(?AccountInterface $account = NULL) {
     return $this->getSettableOptions($account);
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getSettableValues(AccountInterface $account = NULL) {
+  public function getSettableValues(?AccountInterface $account = NULL) {
     // Flatten options first, because "settable options" may contain group
     // arrays.
     $flatten_options = OptGroup::flattenOptions($this->getSettableOptions($account));
@@ -670,7 +670,7 @@ public function getSettableValues(AccountInterface $account = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function getSettableOptions(AccountInterface $account = NULL) {
+  public function getSettableOptions(?AccountInterface $account = NULL) {
     $field_definition = $this->getFieldDefinition();
     if (!$options = \Drupal::service('plugin.manager.entity_reference_selection')->getSelectionHandler($field_definition, $this->getEntity())->getReferenceableEntities()) {
       return [];
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php
index aec1052d5174..99357d4574d1 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php
@@ -126,14 +126,14 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
   /**
    * {@inheritdoc}
    */
-  public function getPossibleValues(AccountInterface $account = NULL) {
+  public function getPossibleValues(?AccountInterface $account = NULL) {
     return array_keys(\Drupal::languageManager()->getLanguages(LanguageInterface::STATE_ALL));
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getPossibleOptions(AccountInterface $account = NULL) {
+  public function getPossibleOptions(?AccountInterface $account = NULL) {
     $languages = \Drupal::languageManager()->getLanguages(LanguageInterface::STATE_ALL);
     return array_map(function (LanguageInterface $language) {
       return $language->getName();
@@ -143,14 +143,14 @@ public function getPossibleOptions(AccountInterface $account = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function getSettableValues(AccountInterface $account = NULL) {
+  public function getSettableValues(?AccountInterface $account = NULL) {
     return $this->getPossibleValues($account);
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getSettableOptions(AccountInterface $account = NULL) {
+  public function getSettableOptions(?AccountInterface $account = NULL) {
     return $this->getPossibleValues($account);
   }
 
diff --git a/core/lib/Drupal/Core/File/FileSystem.php b/core/lib/Drupal/Core/File/FileSystem.php
index 2961a32430cb..be1d70ad6e2b 100644
--- a/core/lib/Drupal/Core/File/FileSystem.php
+++ b/core/lib/Drupal/Core/File/FileSystem.php
@@ -339,7 +339,7 @@ public function delete($path) {
   /**
    * {@inheritdoc}
    */
-  public function deleteRecursive($path, callable $callback = NULL) {
+  public function deleteRecursive($path, ?callable $callback = NULL) {
     if ($callback) {
       call_user_func($callback, $path);
     }
diff --git a/core/lib/Drupal/Core/File/FileSystemInterface.php b/core/lib/Drupal/Core/File/FileSystemInterface.php
index fee49efed852..014cf299f7d5 100644
--- a/core/lib/Drupal/Core/File/FileSystemInterface.php
+++ b/core/lib/Drupal/Core/File/FileSystemInterface.php
@@ -330,7 +330,7 @@ public function delete($path);
    * @throws \Drupal\Core\File\Exception\FileException
    *   Implementation may throw FileException or its subtype on failure.
    */
-  public function deleteRecursive($path, callable $callback = NULL);
+  public function deleteRecursive($path, ?callable $callback = NULL);
 
   /**
    * Moves a file to a new location without database changes or hook invocation.
diff --git a/core/lib/Drupal/Core/File/MimeType/ExtensionMimeTypeGuesser.php b/core/lib/Drupal/Core/File/MimeType/ExtensionMimeTypeGuesser.php
index 1fb5c4c6d529..eab63b75565e 100644
--- a/core/lib/Drupal/Core/File/MimeType/ExtensionMimeTypeGuesser.php
+++ b/core/lib/Drupal/Core/File/MimeType/ExtensionMimeTypeGuesser.php
@@ -935,7 +935,7 @@ public function guessMimeType($path): ?string {
    * @param array|null $mapping
    *   Passing a NULL mapping will cause guess() to use self::$defaultMapping.
    */
-  public function setMapping(array $mapping = NULL) {
+  public function setMapping(?array $mapping = NULL) {
     $this->mapping = $mapping;
   }
 
diff --git a/core/lib/Drupal/Core/Form/EnforcedResponseException.php b/core/lib/Drupal/Core/Form/EnforcedResponseException.php
index ca3b8b8688e1..2df78ee5ba61 100644
--- a/core/lib/Drupal/Core/Form/EnforcedResponseException.php
+++ b/core/lib/Drupal/Core/Form/EnforcedResponseException.php
@@ -28,7 +28,7 @@ class EnforcedResponseException extends \Exception {
    * @param \Exception $previous
    *   (optional) The previous exception for nested exceptions
    */
-  public function __construct(Response $response, $message = "", $code = 0, \Exception $previous = NULL) {
+  public function __construct(Response $response, $message = "", $code = 0, ?\Exception $previous = NULL) {
     parent::__construct($message, $code, $previous);
 
     $this->response = $response;
diff --git a/core/lib/Drupal/Core/Form/Exception/BrokenPostRequestException.php b/core/lib/Drupal/Core/Form/Exception/BrokenPostRequestException.php
index 312bc4f4c93a..39e53d038d3f 100644
--- a/core/lib/Drupal/Core/Form/Exception/BrokenPostRequestException.php
+++ b/core/lib/Drupal/Core/Form/Exception/BrokenPostRequestException.php
@@ -30,7 +30,7 @@ class BrokenPostRequestException extends BadRequestHttpException {
    * @param int $code
    *   The internal exception code.
    */
-  public function __construct(int $max_upload_size, string $message = '', \Exception $previous = NULL, int $code = 0) {
+  public function __construct(int $max_upload_size, string $message = '', ?\Exception $previous = NULL, int $code = 0) {
     parent::__construct($message, $previous, $code);
 
     $this->size = $max_upload_size;
diff --git a/core/lib/Drupal/Core/Form/FormAjaxException.php b/core/lib/Drupal/Core/Form/FormAjaxException.php
index a966736d0d53..5393c92f2f5c 100644
--- a/core/lib/Drupal/Core/Form/FormAjaxException.php
+++ b/core/lib/Drupal/Core/Form/FormAjaxException.php
@@ -35,7 +35,7 @@ class FormAjaxException extends \Exception {
    * @param \Exception $previous
    *   (optional) The previous exception for nested exceptions.
    */
-  public function __construct(array $form, FormStateInterface $form_state, $message = "", $code = 0, \Exception $previous = NULL) {
+  public function __construct(array $form, FormStateInterface $form_state, $message = "", $code = 0, ?\Exception $previous = NULL) {
     parent::__construct($message, $code, $previous);
     $this->form = $form;
     $this->formState = $form_state;
diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index fd2cfd04e375..938ab5244985 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -172,7 +172,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
    * @param \Drupal\Core\Access\CsrfTokenGenerator $csrf_token
    *   The CSRF token generator.
    */
-  public function __construct(FormValidatorInterface $form_validator, FormSubmitterInterface $form_submitter, FormCacheInterface $form_cache, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, RequestStack $request_stack, ClassResolverInterface $class_resolver, ElementInfoManagerInterface $element_info, ThemeManagerInterface $theme_manager, CsrfTokenGenerator $csrf_token = NULL) {
+  public function __construct(FormValidatorInterface $form_validator, FormSubmitterInterface $form_submitter, FormCacheInterface $form_cache, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, RequestStack $request_stack, ClassResolverInterface $class_resolver, ElementInfoManagerInterface $element_info, ThemeManagerInterface $theme_manager, ?CsrfTokenGenerator $csrf_token = NULL) {
     $this->formValidator = $form_validator;
     $this->formSubmitter = $form_submitter;
     $this->formCache = $form_cache;
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableAccessDeniedHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableAccessDeniedHttpException.php
index ac6aefdcc725..85d4b1842728 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableAccessDeniedHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableAccessDeniedHttpException.php
@@ -16,7 +16,7 @@ class CacheableAccessDeniedHttpException extends AccessDeniedHttpException imple
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableBadRequestHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableBadRequestHttpException.php
index 5b0a35b58516..92ebd361c6ba 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableBadRequestHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableBadRequestHttpException.php
@@ -16,7 +16,7 @@ class CacheableBadRequestHttpException extends BadRequestHttpException implement
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableConflictHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableConflictHttpException.php
index 4d2027ec1af3..7580ed7e1ede 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableConflictHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableConflictHttpException.php
@@ -16,7 +16,7 @@ class CacheableConflictHttpException extends ConflictHttpException implements Ca
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableGoneHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableGoneHttpException.php
index 8bbb11c7e9eb..dc8d29a66561 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableGoneHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableGoneHttpException.php
@@ -16,7 +16,7 @@ class CacheableGoneHttpException extends GoneHttpException implements CacheableD
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php
index ffc3ba66a6e6..2710c9f6b8f6 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php
@@ -16,7 +16,7 @@ class CacheableHttpException extends HttpException implements CacheableDependenc
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $statusCode = 0, $message = '', \Exception $previous = NULL, array $headers = [], $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $statusCode = 0, $message = '', ?\Exception $previous = NULL, array $headers = [], $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($statusCode, $message, $previous, $headers, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableLengthRequiredHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableLengthRequiredHttpException.php
index c08635365ba1..b0004d943b22 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableLengthRequiredHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableLengthRequiredHttpException.php
@@ -16,7 +16,7 @@ class CacheableLengthRequiredHttpException extends LengthRequiredHttpException i
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableMethodNotAllowedHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableMethodNotAllowedHttpException.php
index 2ea3346aba5a..26f967ce3141 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableMethodNotAllowedHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableMethodNotAllowedHttpException.php
@@ -16,7 +16,7 @@ class CacheableMethodNotAllowedHttpException extends MethodNotAllowedHttpExcepti
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, array $allow, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, array $allow, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($allow, $message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableNotAcceptableHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableNotAcceptableHttpException.php
index 4756380d6c29..430db51fe55d 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableNotAcceptableHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableNotAcceptableHttpException.php
@@ -16,7 +16,7 @@ class CacheableNotAcceptableHttpException extends NotAcceptableHttpException imp
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableNotFoundHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableNotFoundHttpException.php
index 6191a9b30b98..9149df14957b 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableNotFoundHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableNotFoundHttpException.php
@@ -16,7 +16,7 @@ class CacheableNotFoundHttpException extends NotFoundHttpException implements Ca
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheablePreconditionFailedHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheablePreconditionFailedHttpException.php
index d102ccd433c6..69d07debe6e9 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheablePreconditionFailedHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheablePreconditionFailedHttpException.php
@@ -16,7 +16,7 @@ class CacheablePreconditionFailedHttpException extends PreconditionFailedHttpExc
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheablePreconditionRequiredHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheablePreconditionRequiredHttpException.php
index 97aa3f096583..d86273fa8c0c 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheablePreconditionRequiredHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheablePreconditionRequiredHttpException.php
@@ -16,7 +16,7 @@ class CacheablePreconditionRequiredHttpException extends PreconditionRequiredHtt
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableServiceUnavailableHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableServiceUnavailableHttpException.php
index af3cfa4ddc52..8a7eeea2e26b 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableServiceUnavailableHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableServiceUnavailableHttpException.php
@@ -16,7 +16,7 @@ class CacheableServiceUnavailableHttpException extends ServiceUnavailableHttpExc
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $retryAfter = NULL, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $retryAfter = NULL, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($retryAfter, $message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableTooManyRequestsHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableTooManyRequestsHttpException.php
index 3c908a78a1f1..89f16fd8f164 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableTooManyRequestsHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableTooManyRequestsHttpException.php
@@ -16,7 +16,7 @@ class CacheableTooManyRequestsHttpException extends TooManyRequestsHttpException
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $retryAfter = NULL, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $retryAfter = NULL, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($retryAfter, $message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableUnauthorizedHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableUnauthorizedHttpException.php
index 6ebcb6d4aa73..43f7ef587f2f 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableUnauthorizedHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableUnauthorizedHttpException.php
@@ -16,7 +16,7 @@ class CacheableUnauthorizedHttpException extends UnauthorizedHttpException imple
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $challenge, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $challenge, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($challenge, $message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableUnprocessableEntityHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableUnprocessableEntityHttpException.php
index e3e610b40764..53208360d3da 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableUnprocessableEntityHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableUnprocessableEntityHttpException.php
@@ -16,7 +16,7 @@ class CacheableUnprocessableEntityHttpException extends UnprocessableEntityHttpE
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableUnsupportedMediaTypeHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableUnsupportedMediaTypeHttpException.php
index 53aef3fc6915..a1a2ac5a466d 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableUnsupportedMediaTypeHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableUnsupportedMediaTypeHttpException.php
@@ -16,7 +16,7 @@ class CacheableUnsupportedMediaTypeHttpException extends UnsupportedMediaTypeHtt
   /**
    * {@inheritdoc}
    */
-  public function __construct(CacheableDependencyInterface $cacheability, $message = '', \Exception $previous = NULL, $code = 0) {
+  public function __construct(CacheableDependencyInterface $cacheability, $message = '', ?\Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
     parent::__construct($message, $previous, $code);
   }
diff --git a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationManager.php b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationManager.php
index 4c1536eac7ff..8fc2b8987db4 100644
--- a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationManager.php
+++ b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationManager.php
@@ -114,7 +114,7 @@ function ($definition) use ($toolkit_id, $operation) {
   /**
    * {@inheritdoc}
    */
-  public function createInstance($plugin_id, array $configuration = [], ImageToolkitInterface $toolkit = NULL) {
+  public function createInstance($plugin_id, array $configuration = [], ?ImageToolkitInterface $toolkit = NULL) {
     $plugin_definition = $this->getDefinition($plugin_id);
     $plugin_class = DefaultFactory::getPluginClass($plugin_id, $plugin_definition);
     return new $plugin_class($configuration, $plugin_id, $plugin_definition, $toolkit, $this->logger);
diff --git a/core/lib/Drupal/Core/Installer/Exception/InstallerException.php b/core/lib/Drupal/Core/Installer/Exception/InstallerException.php
index 29136e071045..d0e0b6be7ff9 100644
--- a/core/lib/Drupal/Core/Installer/Exception/InstallerException.php
+++ b/core/lib/Drupal/Core/Installer/Exception/InstallerException.php
@@ -29,7 +29,7 @@ class InstallerException extends \RuntimeException {
    * @param \Exception $previous
    *   (optional) A previous exception.
    */
-  public function __construct($message, $title = 'Error', $code = 0, \Exception $previous = NULL) {
+  public function __construct($message, $title = 'Error', $code = 0, ?\Exception $previous = NULL) {
     parent::__construct($message, $code, $previous);
     $this->title = $title;
   }
diff --git a/core/lib/Drupal/Core/Installer/InstallerRedirectTrait.php b/core/lib/Drupal/Core/Installer/InstallerRedirectTrait.php
index 45ee1cdd5070..6945e88ffe63 100644
--- a/core/lib/Drupal/Core/Installer/InstallerRedirectTrait.php
+++ b/core/lib/Drupal/Core/Installer/InstallerRedirectTrait.php
@@ -38,7 +38,7 @@ protected function isCli() {
    *   TRUE if the exception handler should redirect to the installer because
    *   Drupal is not installed yet, or FALSE otherwise.
    */
-  protected function shouldRedirectToInstaller(\Throwable $exception, Connection $connection = NULL) {
+  protected function shouldRedirectToInstaller(\Throwable $exception, ?Connection $connection = NULL) {
     // Never redirect on the command line.
     if ($this->isCli()) {
       return FALSE;
diff --git a/core/lib/Drupal/Core/Language/LanguageManager.php b/core/lib/Drupal/Core/Language/LanguageManager.php
index a2d094c8cf26..a774bd5d7d00 100644
--- a/core/lib/Drupal/Core/Language/LanguageManager.php
+++ b/core/lib/Drupal/Core/Language/LanguageManager.php
@@ -384,7 +384,7 @@ public static function getUnitedNationsLanguageList() {
    *
    * @see \Drupal\language\ConfigurableLanguageManager::setConfigOverrideLanguage()
    */
-  public function setConfigOverrideLanguage(LanguageInterface $language = NULL) {
+  public function setConfigOverrideLanguage(?LanguageInterface $language = NULL) {
     return $this;
   }
 
diff --git a/core/lib/Drupal/Core/Language/LanguageManagerInterface.php b/core/lib/Drupal/Core/Language/LanguageManagerInterface.php
index 7f7306d42102..a52aa3c9ff56 100644
--- a/core/lib/Drupal/Core/Language/LanguageManagerInterface.php
+++ b/core/lib/Drupal/Core/Language/LanguageManagerInterface.php
@@ -187,7 +187,7 @@ public function getLanguageSwitchLinks($type, Url $url);
    *
    * @return $this
    */
-  public function setConfigOverrideLanguage(LanguageInterface $language = NULL);
+  public function setConfigOverrideLanguage(?LanguageInterface $language = NULL);
 
   /**
    * Gets the current configuration override language.
diff --git a/core/lib/Drupal/Core/Layout/LayoutPluginManager.php b/core/lib/Drupal/Core/Layout/LayoutPluginManager.php
index 5e8f2f3b2ae6..bc97ec66e05d 100644
--- a/core/lib/Drupal/Core/Layout/LayoutPluginManager.php
+++ b/core/lib/Drupal/Core/Layout/LayoutPluginManager.php
@@ -196,7 +196,7 @@ public function getCategories() {
    *
    * @return \Drupal\Core\Layout\LayoutDefinition[]
    */
-  public function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') {
+  public function getSortedDefinitions(?array $definitions = NULL, $label_key = 'label') {
     // Sort the plugins first by category, then by label.
     $definitions = $definitions ?? $this->getDefinitions();
     uasort($definitions, function (LayoutDefinition $a, LayoutDefinition $b) {
@@ -213,7 +213,7 @@ public function getSortedDefinitions(array $definitions = NULL, $label_key = 'la
    *
    * @return \Drupal\Core\Layout\LayoutDefinition[][]
    */
-  public function getGroupedDefinitions(array $definitions = NULL, $label_key = 'label') {
+  public function getGroupedDefinitions(?array $definitions = NULL, $label_key = 'label') {
     $definitions = $this->getSortedDefinitions($definitions ?? $this->getDefinitions(), $label_key);
     $grouped_definitions = [];
     foreach ($definitions as $id => $definition) {
diff --git a/core/lib/Drupal/Core/Layout/LayoutPluginManagerInterface.php b/core/lib/Drupal/Core/Layout/LayoutPluginManagerInterface.php
index 340a80d39ba0..366b1d41f65c 100644
--- a/core/lib/Drupal/Core/Layout/LayoutPluginManagerInterface.php
+++ b/core/lib/Drupal/Core/Layout/LayoutPluginManagerInterface.php
@@ -46,14 +46,14 @@ public function getDefinitions();
    *
    * @return \Drupal\Core\Layout\LayoutDefinition[]
    */
-  public function getSortedDefinitions(array $definitions = NULL);
+  public function getSortedDefinitions(?array $definitions = NULL);
 
   /**
    * {@inheritdoc}
    *
    * @return \Drupal\Core\Layout\LayoutDefinition[][]
    */
-  public function getGroupedDefinitions(array $definitions = NULL);
+  public function getGroupedDefinitions(?array $definitions = NULL);
 
   /**
    * Returns an array of layout labels grouped by category.
diff --git a/core/lib/Drupal/Core/Logger/LoggerChannel.php b/core/lib/Drupal/Core/Logger/LoggerChannel.php
index ec5702f91c3a..9063e4e1ebee 100644
--- a/core/lib/Drupal/Core/Logger/LoggerChannel.php
+++ b/core/lib/Drupal/Core/Logger/LoggerChannel.php
@@ -133,14 +133,14 @@ public function log($level, string|\Stringable $message, array $context = []): v
   /**
    * {@inheritdoc}
    */
-  public function setRequestStack(RequestStack $requestStack = NULL) {
+  public function setRequestStack(?RequestStack $requestStack = NULL) {
     $this->requestStack = $requestStack;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function setCurrentUser(AccountInterface $current_user = NULL) {
+  public function setCurrentUser(?AccountInterface $current_user = NULL) {
     $this->currentUser = $current_user;
   }
 
diff --git a/core/lib/Drupal/Core/Logger/LoggerChannelInterface.php b/core/lib/Drupal/Core/Logger/LoggerChannelInterface.php
index c5c2bec0321b..4e5a3b785e0f 100644
--- a/core/lib/Drupal/Core/Logger/LoggerChannelInterface.php
+++ b/core/lib/Drupal/Core/Logger/LoggerChannelInterface.php
@@ -40,7 +40,7 @@ interface LoggerChannelInterface extends LoggerInterface {
    * @param \Symfony\Component\HttpFoundation\RequestStack|null $requestStack
    *   The current request object.
    */
-  public function setRequestStack(RequestStack $requestStack = NULL);
+  public function setRequestStack(?RequestStack $requestStack = NULL);
 
   /**
    * Sets the current user.
@@ -48,7 +48,7 @@ public function setRequestStack(RequestStack $requestStack = NULL);
    * @param \Drupal\Core\Session\AccountInterface|null $current_user
    *   The current user object.
    */
-  public function setCurrentUser(AccountInterface $current_user = NULL);
+  public function setCurrentUser(?AccountInterface $current_user = NULL);
 
   /**
    * Sets the loggers for this channel.
diff --git a/core/lib/Drupal/Core/Menu/ContextualLinkDefault.php b/core/lib/Drupal/Core/Menu/ContextualLinkDefault.php
index 7b50cdaf52ea..5904dfd172b8 100644
--- a/core/lib/Drupal/Core/Menu/ContextualLinkDefault.php
+++ b/core/lib/Drupal/Core/Menu/ContextualLinkDefault.php
@@ -13,7 +13,7 @@ class ContextualLinkDefault extends PluginBase implements ContextualLinkInterfac
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     // The title from YAML file discovery may be a TranslatableMarkup object.
     return (string) $this->pluginDefinition['title'];
   }
diff --git a/core/lib/Drupal/Core/Menu/LocalActionDefault.php b/core/lib/Drupal/Core/Menu/LocalActionDefault.php
index f3c0962306ae..5d3274210885 100644
--- a/core/lib/Drupal/Core/Menu/LocalActionDefault.php
+++ b/core/lib/Drupal/Core/Menu/LocalActionDefault.php
@@ -66,7 +66,7 @@ public function getRouteName() {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     // Subclasses may pull in the request or specific attributes as parameters.
     // The title from YAML file discovery may be a TranslatableMarkup object.
     return (string) $this->pluginDefinition['title'];
diff --git a/core/lib/Drupal/Core/Menu/LocalTaskDefault.php b/core/lib/Drupal/Core/Menu/LocalTaskDefault.php
index edc09131db2e..8a5d2268029b 100644
--- a/core/lib/Drupal/Core/Menu/LocalTaskDefault.php
+++ b/core/lib/Drupal/Core/Menu/LocalTaskDefault.php
@@ -76,7 +76,7 @@ public function getRouteParameters(RouteMatchInterface $route_match) {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     // The title from YAML file discovery may be a TranslatableMarkup object.
     return (string) $this->pluginDefinition['title'];
   }
diff --git a/core/lib/Drupal/Core/Menu/MenuParentFormSelector.php b/core/lib/Drupal/Core/Menu/MenuParentFormSelector.php
index bf8ca0f1400d..8f7b9cefc326 100644
--- a/core/lib/Drupal/Core/Menu/MenuParentFormSelector.php
+++ b/core/lib/Drupal/Core/Menu/MenuParentFormSelector.php
@@ -49,7 +49,7 @@ public function __construct(MenuLinkTreeInterface $menu_link_tree, EntityTypeMan
   /**
    * {@inheritdoc}
    */
-  public function getParentSelectOptions($id = '', array $menus = NULL, CacheableMetadata &$cacheability = NULL) {
+  public function getParentSelectOptions($id = '', ?array $menus = NULL, ?CacheableMetadata &$cacheability = NULL) {
     if (!isset($menus)) {
       $menus = $this->getMenuOptions();
     }
@@ -76,7 +76,7 @@ public function getParentSelectOptions($id = '', array $menus = NULL, CacheableM
   /**
    * {@inheritdoc}
    */
-  public function parentSelectElement($menu_parent, $id = '', array $menus = NULL) {
+  public function parentSelectElement($menu_parent, $id = '', ?array $menus = NULL) {
     $options_cacheability = new CacheableMetadata();
     $options = $this->getParentSelectOptions($id, $menus, $options_cacheability);
     // If no options were found, there is nothing to select.
@@ -138,7 +138,7 @@ protected function getParentDepthLimit($id) {
    * @param \Drupal\Core\Cache\CacheableMetadata|null &$cacheability
    *   The object to add cacheability metadata to, if not NULL.
    */
-  protected function parentSelectOptionsTreeWalk(array $tree, $menu_name, $indent, array &$options, $exclude, $depth_limit, CacheableMetadata &$cacheability = NULL) {
+  protected function parentSelectOptionsTreeWalk(array $tree, $menu_name, $indent, array &$options, $exclude, $depth_limit, ?CacheableMetadata &$cacheability = NULL) {
     foreach ($tree as $element) {
       if ($element->depth > $depth_limit) {
         // Don't iterate through any links on this level.
@@ -181,7 +181,7 @@ protected function parentSelectOptionsTreeWalk(array $tree, $menu_name, $indent,
    * @return array
    *   Keys are menu names (ids) values are the menu labels.
    */
-  protected function getMenuOptions(array $menu_names = NULL) {
+  protected function getMenuOptions(?array $menu_names = NULL) {
     $menus = $this->entityTypeManager->getStorage('menu')->loadMultiple($menu_names);
     $options = [];
     /** @var \Drupal\system\MenuInterface[] $menus */
diff --git a/core/lib/Drupal/Core/Menu/MenuParentFormSelectorInterface.php b/core/lib/Drupal/Core/Menu/MenuParentFormSelectorInterface.php
index 1e1ec5bb5283..74a61dd79856 100644
--- a/core/lib/Drupal/Core/Menu/MenuParentFormSelectorInterface.php
+++ b/core/lib/Drupal/Core/Menu/MenuParentFormSelectorInterface.php
@@ -26,7 +26,7 @@ interface MenuParentFormSelectorInterface {
    *   Keyed array where the keys are contain a menu name and parent ID and
    *   the values are a menu name or link title indented by depth.
    */
-  public function getParentSelectOptions($id = '', array $menus = NULL, CacheableMetadata &$cacheability = NULL);
+  public function getParentSelectOptions($id = '', ?array $menus = NULL, ?CacheableMetadata &$cacheability = NULL);
 
   /**
    * Gets a form element to choose a menu and parent.
@@ -51,6 +51,6 @@ public function getParentSelectOptions($id = '', array $menus = NULL, CacheableM
    *   a single string containing the chosen menu name and parent ID separated
    *   by a ':' character.
    */
-  public function parentSelectElement($menu_parent, $id = '', array $menus = NULL);
+  public function parentSelectElement($menu_parent, $id = '', ?array $menus = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/ParamConverter/ParamNotConvertedException.php b/core/lib/Drupal/Core/ParamConverter/ParamNotConvertedException.php
index 7ff9dc991bb2..ded46faeb76d 100644
--- a/core/lib/Drupal/Core/ParamConverter/ParamNotConvertedException.php
+++ b/core/lib/Drupal/Core/ParamConverter/ParamNotConvertedException.php
@@ -35,7 +35,7 @@ class ParamNotConvertedException extends \Exception {
    * @param array $raw_parameters
    *   The raw parameters that were not converted.
    */
-  public function __construct($message = "", $code = 0, \Exception $previous = NULL, $route_name = "", array $raw_parameters = []) {
+  public function __construct($message = "", $code = 0, ?\Exception $previous = NULL, $route_name = "", array $raw_parameters = []) {
     parent::__construct($message, $code, $previous);
     $this->routeName = $route_name;
     $this->rawParameters = $raw_parameters;
diff --git a/core/lib/Drupal/Core/Path/CurrentPathStack.php b/core/lib/Drupal/Core/Path/CurrentPathStack.php
index 51b97cd71e1b..1ca32da6ca63 100644
--- a/core/lib/Drupal/Core/Path/CurrentPathStack.php
+++ b/core/lib/Drupal/Core/Path/CurrentPathStack.php
@@ -48,7 +48,7 @@ public function __construct(RequestStack $request_stack) {
    * @return string
    *   Returns the path, without leading slashes.
    */
-  public function getPath(Request $request = NULL) {
+  public function getPath(?Request $request = NULL) {
     if (!isset($request)) {
       $request = $this->requestStack->getCurrentRequest();
     }
@@ -69,7 +69,7 @@ public function getPath(Request $request = NULL) {
    *
    * @return $this
    */
-  public function setPath($path, Request $request = NULL) {
+  public function setPath($path, ?Request $request = NULL) {
     if (!isset($request)) {
       $request = $this->requestStack->getCurrentRequest();
     }
diff --git a/core/lib/Drupal/Core/PathProcessor/NullPathProcessorManager.php b/core/lib/Drupal/Core/PathProcessor/NullPathProcessorManager.php
index 9e6d3dae6198..9c723ee76fa2 100644
--- a/core/lib/Drupal/Core/PathProcessor/NullPathProcessorManager.php
+++ b/core/lib/Drupal/Core/PathProcessor/NullPathProcessorManager.php
@@ -22,7 +22,7 @@ public function processInbound($path, Request $request) {
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     return $path;
   }
 
diff --git a/core/lib/Drupal/Core/PathProcessor/OutboundPathProcessorInterface.php b/core/lib/Drupal/Core/PathProcessor/OutboundPathProcessorInterface.php
index a5e6570ebe4d..c1c701acb045 100644
--- a/core/lib/Drupal/Core/PathProcessor/OutboundPathProcessorInterface.php
+++ b/core/lib/Drupal/Core/PathProcessor/OutboundPathProcessorInterface.php
@@ -45,6 +45,6 @@ interface OutboundPathProcessorInterface {
    * @return string
    *   The processed path.
    */
-  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL);
+  public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/PathProcessor/PathProcessorManager.php b/core/lib/Drupal/Core/PathProcessor/PathProcessorManager.php
index 2b4ca1d389c1..de55b6678b39 100644
--- a/core/lib/Drupal/Core/PathProcessor/PathProcessorManager.php
+++ b/core/lib/Drupal/Core/PathProcessor/PathProcessorManager.php
@@ -102,7 +102,7 @@ public function addOutbound(OutboundPathProcessorInterface $processor, $priority
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     $processors = $this->getOutbound();
     foreach ($processors as $processor) {
       $path = $processor->processOutbound($path, $options, $request, $bubbleable_metadata);
diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php
index 763006bef54e..2a32b504f324 100644
--- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php
+++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php
@@ -108,7 +108,7 @@ public function getCategories() {
   /**
    * {@inheritdoc}
    */
-  public function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') {
+  public function getSortedDefinitions(?array $definitions = NULL, $label_key = 'label') {
     // Sort the plugins first by category, then by label.
     $definitions = $definitions ?? $this->getDefinitions();
     uasort($definitions, function ($a, $b) use ($label_key) {
@@ -123,7 +123,7 @@ public function getSortedDefinitions(array $definitions = NULL, $label_key = 'la
   /**
    * {@inheritdoc}
    */
-  public function getGroupedDefinitions(array $definitions = NULL, $label_key = 'label') {
+  public function getGroupedDefinitions(?array $definitions = NULL, $label_key = 'label') {
     /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */
     $definitions = $this->getSortedDefinitions($definitions ?? $this->getDefinitions(), $label_key);
     $grouped_definitions = [];
diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
index 1f62d84e4a61..a6ef61656f5b 100644
--- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
+++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
@@ -151,7 +151,7 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt
    * 'Drupal\Component\Plugin\Attribute\Plugin' once annotations are no longer
    * supported.
    */
-  public function __construct($subdir, \Traversable $namespaces, ModuleHandlerInterface $module_handler, $plugin_interface = NULL, ?string $plugin_definition_attribute_name = NULL, string|array $plugin_definition_annotation_name = NULL, array $additional_annotation_namespaces = []) {
+  public function __construct($subdir, \Traversable $namespaces, ModuleHandlerInterface $module_handler, $plugin_interface = NULL, ?string $plugin_definition_attribute_name = NULL, string|array|null $plugin_definition_annotation_name = NULL, array $additional_annotation_namespaces = []) {
     $this->subdir = $subdir;
     $this->namespaces = $namespaces;
     $this->moduleHandler = $module_handler;
diff --git a/core/lib/Drupal/Core/Plugin/Plugin/Validation/Constraint/PluginExistsConstraint.php b/core/lib/Drupal/Core/Plugin/Plugin/Validation/Constraint/PluginExistsConstraint.php
index b0bc6bba5054..83d38ee2bbae 100644
--- a/core/lib/Drupal/Core/Plugin/Plugin/Validation/Constraint/PluginExistsConstraint.php
+++ b/core/lib/Drupal/Core/Plugin/Plugin/Validation/Constraint/PluginExistsConstraint.php
@@ -69,7 +69,7 @@ class PluginExistsConstraint extends SymfonyConstraint implements ContainerFacto
    * @param mixed|null $payload
    *   Domain-specific data attached to a constraint.
    */
-  public function __construct(public readonly PluginManagerInterface $pluginManager, mixed $options = NULL, array $groups = NULL, mixed $payload = NULL) {
+  public function __construct(public readonly PluginManagerInterface $pluginManager, mixed $options = NULL, ?array $groups = NULL, mixed $payload = NULL) {
     parent::__construct($options, $groups, $payload);
   }
 
diff --git a/core/lib/Drupal/Core/Queue/DelayedRequeueException.php b/core/lib/Drupal/Core/Queue/DelayedRequeueException.php
index 404ab0dc3002..f3438e1fb924 100644
--- a/core/lib/Drupal/Core/Queue/DelayedRequeueException.php
+++ b/core/lib/Drupal/Core/Queue/DelayedRequeueException.php
@@ -37,7 +37,7 @@ class DelayedRequeueException extends \RuntimeException {
    * @param \Throwable|null $previous
    *   The previous throwable used for the exception chaining.
    */
-  public function __construct(int $delay = 0, string $message = '', int $code = 0, \Throwable $previous = NULL) {
+  public function __construct(int $delay = 0, string $message = '', int $code = 0, ?\Throwable $previous = NULL) {
     parent::__construct($message, $code, $previous);
     if ($delay > 0) {
       $this->delay = $delay;
diff --git a/core/lib/Drupal/Core/Queue/SuspendQueueException.php b/core/lib/Drupal/Core/Queue/SuspendQueueException.php
index 3322c2af4e49..37ed2874c67e 100644
--- a/core/lib/Drupal/Core/Queue/SuspendQueueException.php
+++ b/core/lib/Drupal/Core/Queue/SuspendQueueException.php
@@ -35,7 +35,7 @@ class SuspendQueueException extends \RuntimeException {
    *   known, pass an interval in seconds. Otherwise NULL if the time to resume
    *   processing the queue is not known.
    */
-  public function __construct(string $message = '', int $code = 0, \Throwable $previous = NULL, ?float $delay = NULL) {
+  public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = NULL, ?float $delay = NULL) {
     parent::__construct($message, $code, $previous);
     $this->delay = $delay;
   }
diff --git a/core/lib/Drupal/Core/Recipe/RecipeFileException.php b/core/lib/Drupal/Core/Recipe/RecipeFileException.php
index d45cc7ba494e..3f040d35f8b2 100644
--- a/core/lib/Drupal/Core/Recipe/RecipeFileException.php
+++ b/core/lib/Drupal/Core/Recipe/RecipeFileException.php
@@ -32,7 +32,7 @@ public function __construct(
     string $message = '',
     public readonly ?ConstraintViolationList $violations = NULL,
     int $code = 0,
-    \Throwable $previous = NULL,
+    ?\Throwable $previous = NULL,
   ) {
     parent::__construct($message, $code, $previous);
   }
diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php
index 3774cb227243..7c54caf331f2 100644
--- a/core/lib/Drupal/Core/Render/Renderer.php
+++ b/core/lib/Drupal/Core/Render/Renderer.php
@@ -619,7 +619,7 @@ protected function getCurrentRenderContext() {
    *
    * @return $this
    */
-  protected function setCurrentRenderContext(RenderContext $context = NULL) {
+  protected function setCurrentRenderContext(?RenderContext $context = NULL) {
     $request = $this->requestStack->getCurrentRequest();
     static::$contextCollection[$request] = $context;
     return $this;
diff --git a/core/lib/Drupal/Core/RouteProcessor/OutboundRouteProcessorInterface.php b/core/lib/Drupal/Core/RouteProcessor/OutboundRouteProcessorInterface.php
index e6454d4aa87e..8aa3484638e6 100644
--- a/core/lib/Drupal/Core/RouteProcessor/OutboundRouteProcessorInterface.php
+++ b/core/lib/Drupal/Core/RouteProcessor/OutboundRouteProcessorInterface.php
@@ -23,6 +23,6 @@ interface OutboundRouteProcessorInterface {
    * @param \Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata
    *   (optional) Object to collect route processors' bubbleable metadata.
    */
-  public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL);
+  public function processOutbound($route_name, Route $route, array &$parameters, ?BubbleableMetadata $bubbleable_metadata = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/RouteProcessor/RouteProcessorCurrent.php b/core/lib/Drupal/Core/RouteProcessor/RouteProcessorCurrent.php
index e1555fb1de9c..41000fcd3727 100644
--- a/core/lib/Drupal/Core/RouteProcessor/RouteProcessorCurrent.php
+++ b/core/lib/Drupal/Core/RouteProcessor/RouteProcessorCurrent.php
@@ -31,7 +31,7 @@ public function __construct(RouteMatchInterface $route_match) {
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($route_name, Route $route, array &$parameters, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     if ($route_name === '<current>') {
       if ($current_route = $this->routeMatch->getRouteObject()) {
         $requirements = $current_route->getRequirements();
diff --git a/core/lib/Drupal/Core/RouteProcessor/RouteProcessorManager.php b/core/lib/Drupal/Core/RouteProcessor/RouteProcessorManager.php
index 7b64c90c6c6f..5fc21c22cd21 100644
--- a/core/lib/Drupal/Core/RouteProcessor/RouteProcessorManager.php
+++ b/core/lib/Drupal/Core/RouteProcessor/RouteProcessorManager.php
@@ -46,7 +46,7 @@ public function addOutbound(OutboundRouteProcessorInterface $processor, $priorit
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($route_name, Route $route, array &$parameters, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     $processors = $this->getOutbound();
     foreach ($processors as $processor) {
       $processor->processOutbound($route_name, $route, $parameters, $bubbleable_metadata);
diff --git a/core/lib/Drupal/Core/Routing/AdminContext.php b/core/lib/Drupal/Core/Routing/AdminContext.php
index 0ef77f2a08e0..587c6a2b259e 100644
--- a/core/lib/Drupal/Core/Routing/AdminContext.php
+++ b/core/lib/Drupal/Core/Routing/AdminContext.php
@@ -36,7 +36,7 @@ public function __construct(RouteMatchInterface $route_match) {
    * @return bool
    *   Returns TRUE if the route is an admin one, otherwise FALSE.
    */
-  public function isAdminRoute(Route $route = NULL) {
+  public function isAdminRoute(?Route $route = NULL) {
     if (!$route) {
       $route = $this->routeMatch->getRouteObject();
       if (!$route) {
diff --git a/core/lib/Drupal/Core/Routing/NullGenerator.php b/core/lib/Drupal/Core/Routing/NullGenerator.php
index ae0638d00fe5..4f43b62e1a1d 100644
--- a/core/lib/Drupal/Core/Routing/NullGenerator.php
+++ b/core/lib/Drupal/Core/Routing/NullGenerator.php
@@ -45,7 +45,7 @@ protected function getRoute($name) {
   /**
    * {@inheritdoc}
    */
-  protected function processRoute($name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
+  protected function processRoute($name, Route $route, array &$parameters, ?BubbleableMetadata $bubbleable_metadata = NULL) {
   }
 
   /**
@@ -58,7 +58,7 @@ protected function getInternalPathFromRoute($name, Route $route, $parameters = [
   /**
    * {@inheritdoc}
    */
-  protected function processPath($path, &$options = [], BubbleableMetadata $bubbleable_metadata = NULL) {
+  protected function processPath($path, &$options = [], ?BubbleableMetadata $bubbleable_metadata = NULL) {
     return $path;
   }
 
diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php
index 15c0452b3972..a0b4384ad7f4 100644
--- a/core/lib/Drupal/Core/Routing/RouteProvider.php
+++ b/core/lib/Drupal/Core/Routing/RouteProvider.php
@@ -125,7 +125,7 @@ class RouteProvider implements CacheableRouteProviderInterface, PreloadableRoute
    * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
    *   (Optional) The language manager.
    */
-  public function __construct(Connection $connection, StateInterface $state, CurrentPathStack $current_path, CacheBackendInterface $cache_backend, InboundPathProcessorInterface $path_processor, CacheTagsInvalidatorInterface $cache_tag_invalidator, $table = 'router', LanguageManagerInterface $language_manager = NULL) {
+  public function __construct(Connection $connection, StateInterface $state, CurrentPathStack $current_path, CacheBackendInterface $cache_backend, InboundPathProcessorInterface $path_processor, CacheTagsInvalidatorInterface $cache_tag_invalidator, $table = 'router', ?LanguageManagerInterface $language_manager = NULL) {
     $this->connection = $connection;
     $this->state = $state;
     $this->currentPath = $current_path;
diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php
index 455a5dfbdb88..61ffe8048657 100644
--- a/core/lib/Drupal/Core/Routing/UrlGenerator.php
+++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php
@@ -387,7 +387,7 @@ public function generateFromRoute(string $name, array $parameters = [], array $o
   /**
    * Passes the path to a processor manager to allow alterations.
    */
-  protected function processPath(string $path, array &$options = [], BubbleableMetadata $bubbleable_metadata = NULL) {
+  protected function processPath(string $path, array &$options = [], ?BubbleableMetadata $bubbleable_metadata = NULL) {
     $actual_path = $path === '/' ? $path : rtrim($path, '/');
     return $this->pathProcessor->processOutbound($actual_path, $options, $this->requestStack->getCurrentRequest(), $bubbleable_metadata);
   }
@@ -404,7 +404,7 @@ protected function processPath(string $path, array &$options = [], BubbleableMet
    * @param \Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata
    *   (optional) Object to collect route processors' bubbleable metadata.
    */
-  protected function processRoute(string $name, SymfonyRoute $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
+  protected function processRoute(string $name, SymfonyRoute $route, array &$parameters, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     $this->routeProcessor->processOutbound($name, $route, $parameters, $bubbleable_metadata);
   }
 
diff --git a/core/lib/Drupal/Core/StringTranslation/ByteSizeMarkup.php b/core/lib/Drupal/Core/StringTranslation/ByteSizeMarkup.php
index 766904e4daf1..5e7d0440a02b 100644
--- a/core/lib/Drupal/Core/StringTranslation/ByteSizeMarkup.php
+++ b/core/lib/Drupal/Core/StringTranslation/ByteSizeMarkup.php
@@ -25,7 +25,7 @@ private function __construct() {}
    * @throws \LogicException
    *   Thrown when an invalid unit size is used.
    */
-  public static function create(float|int $size, string $langcode = NULL, TranslationInterface $stringTranslation = NULL): TranslatableMarkup {
+  public static function create(float|int $size, ?string $langcode = NULL, ?TranslationInterface $stringTranslation = NULL): TranslatableMarkup {
     $options = ['langcode' => $langcode];
     $absolute_size = abs($size);
     if ($absolute_size < Bytes::KILOBYTE) {
diff --git a/core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php b/core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php
index b1583e12d0ab..4255e893368a 100644
--- a/core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php
+++ b/core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php
@@ -53,7 +53,7 @@ class PluralTranslatableMarkup extends TranslatableMarkup {
    *
    * @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat()
    */
-  public function __construct($count, $singular, $plural, array $args = [], array $options = [], TranslationInterface $string_translation = NULL) {
+  public function __construct($count, $singular, $plural, array $args = [], array $options = [], ?TranslationInterface $string_translation = NULL) {
     $this->count = $count;
     $translatable_string = implode(PoItem::DELIMITER, [$singular, $plural]);
     parent::__construct($translatable_string, $args, $options, $string_translation);
diff --git a/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php b/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php
index dce967cfcf0c..06a1d1f7712c 100644
--- a/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php
+++ b/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php
@@ -126,7 +126,7 @@ class TranslatableMarkup extends FormattableMarkup {
    *
    * @ingroup sanitization
    */
-  public function __construct($string, array $arguments = [], array $options = [], TranslationInterface $string_translation = NULL) {
+  public function __construct($string, array $arguments = [], array $options = [], ?TranslationInterface $string_translation = NULL) {
     if (!is_string($string)) {
       $message = $string instanceof TranslatableMarkup ? '$string ("' . $string->getUntranslatedString() . '") must be a string.' : '$string ("' . (string) $string . '") must be a string.';
       throw new \InvalidArgumentException($message);
diff --git a/core/lib/Drupal/Core/Template/TwigEnvironment.php b/core/lib/Drupal/Core/Template/TwigEnvironment.php
index 2eda886d62dd..abcd144f6d7d 100644
--- a/core/lib/Drupal/Core/Template/TwigEnvironment.php
+++ b/core/lib/Drupal/Core/Template/TwigEnvironment.php
@@ -194,7 +194,7 @@ public function getTemplateMetadata(string $name): array {
    * @return string
    *   The template class name.
    */
-  public function getTemplateClass(string $name, int $index = NULL): string {
+  public function getTemplateClass(string $name, ?int $index = NULL): string {
     // We override this method to add caching because it gets called multiple
     // times when the same template is used more than once. For example, a page
     // rendering 50 nodes without any node template overrides will use the same
diff --git a/core/lib/Drupal/Core/Test/EnvironmentCleaner.php b/core/lib/Drupal/Core/Test/EnvironmentCleaner.php
index fa9d7c627b19..19af760a2cbf 100644
--- a/core/lib/Drupal/Core/Test/EnvironmentCleaner.php
+++ b/core/lib/Drupal/Core/Test/EnvironmentCleaner.php
@@ -131,7 +131,7 @@ protected function doCleanTemporaryDirectories(): int {
   /**
    * {@inheritdoc}
    */
-  public function cleanResults(TestRun $test_run = NULL): int {
+  public function cleanResults(?TestRun $test_run = NULL): int {
     return $test_run ? $test_run->removeResults() : $this->testRunResultsStorage->cleanUp();
   }
 
diff --git a/core/lib/Drupal/Core/Test/EnvironmentCleanerInterface.php b/core/lib/Drupal/Core/Test/EnvironmentCleanerInterface.php
index 801df897eee2..959b2b018644 100644
--- a/core/lib/Drupal/Core/Test/EnvironmentCleanerInterface.php
+++ b/core/lib/Drupal/Core/Test/EnvironmentCleanerInterface.php
@@ -51,6 +51,6 @@ public function cleanTemporaryDirectories(): void;
    * @return int
    *   The number of results that were removed.
    */
-  public function cleanResults(TestRun $test_run = NULL): int;
+  public function cleanResults(?TestRun $test_run = NULL): int;
 
 }
diff --git a/core/lib/Drupal/Core/Test/JUnitConverter.php b/core/lib/Drupal/Core/Test/JUnitConverter.php
index 6d62d661e6b5..029ff5d04146 100644
--- a/core/lib/Drupal/Core/Test/JUnitConverter.php
+++ b/core/lib/Drupal/Core/Test/JUnitConverter.php
@@ -69,7 +69,7 @@ public static function xmlElementToRows($test_id, \SimpleXMLElement $element) {
    *
    * @internal
    */
-  public static function findTestCases(\SimpleXMLElement $element, \SimpleXMLElement $parent = NULL) {
+  public static function findTestCases(\SimpleXMLElement $element, ?\SimpleXMLElement $parent = NULL) {
     if (!isset($parent)) {
       $parent = $element;
     }
diff --git a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
index 4aff3a7df3de..c9341f886b2e 100644
--- a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
+++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
@@ -109,7 +109,7 @@ public function phpUnitCommand(): string {
    *
    * @internal
    */
-  protected function runCommand(string $test_class_name, string $log_junit_file_path, int &$status = NULL, array &$output = NULL): void {
+  protected function runCommand(string $test_class_name, string $log_junit_file_path, ?int &$status = NULL, ?array &$output = NULL): void {
     global $base_url;
     // Setup an environment variable containing the database connection so that
     // functional tests can connect to the database.
@@ -169,7 +169,7 @@ protected function runCommand(string $test_class_name, string $log_junit_file_pa
    *
    * @internal
    */
-  public function execute(TestRun $test_run, string $test_class_name, int &$status = NULL): array {
+  public function execute(TestRun $test_run, string $test_class_name, ?int &$status = NULL): array {
     $log_junit_file_path = $this->xmlLogFilePath($test_run->id());
     // Store output from our test run.
     $output = [];
diff --git a/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php b/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php
index 41cd4b35bfb2..530e7fc5a6df 100644
--- a/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php
+++ b/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php
@@ -25,7 +25,7 @@ class ComponentValidator {
   /**
    * Sets the validator service if available.
    */
-  public function setValidator(Validator $validator = NULL): void {
+  public function setValidator(?Validator $validator = NULL): void {
     if ($validator) {
       $this->validator = $validator;
       return;
diff --git a/core/lib/Drupal/Core/Theme/ThemeManager.php b/core/lib/Drupal/Core/Theme/ThemeManager.php
index 00127c839d63..db36db950dda 100644
--- a/core/lib/Drupal/Core/Theme/ThemeManager.php
+++ b/core/lib/Drupal/Core/Theme/ThemeManager.php
@@ -90,7 +90,7 @@ public function setThemeRegistry(Registry $theme_registry) {
   /**
    * {@inheritdoc}
    */
-  public function getActiveTheme(RouteMatchInterface $route_match = NULL) {
+  public function getActiveTheme(?RouteMatchInterface $route_match = NULL) {
     if (!isset($this->activeTheme)) {
       $this->initTheme($route_match);
     }
@@ -402,7 +402,7 @@ protected function buildThemeHookSuggestions(string $hook, string $info_base_hoo
    * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
    *   The current route match.
    */
-  protected function initTheme(RouteMatchInterface $route_match = NULL) {
+  protected function initTheme(?RouteMatchInterface $route_match = NULL) {
     // Determine the active theme for the theme negotiator service. This includes
     // the default theme as well as really specific ones like the ajax base theme.
     if (!$route_match) {
diff --git a/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php b/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php
index 7b240cebb968..90074aa1b946 100644
--- a/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php
+++ b/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php
@@ -37,7 +37,7 @@ public function render($hook, array $variables);
    *
    * @return \Drupal\Core\Theme\ActiveTheme
    */
-  public function getActiveTheme(RouteMatchInterface $route_match = NULL);
+  public function getActiveTheme(?RouteMatchInterface $route_match = NULL);
 
   /**
    * Determines whether there is an active theme.
diff --git a/core/lib/Drupal/Core/TypedData/ListDataDefinition.php b/core/lib/Drupal/Core/TypedData/ListDataDefinition.php
index 6b8654a2e240..17f21a1cab0d 100644
--- a/core/lib/Drupal/Core/TypedData/ListDataDefinition.php
+++ b/core/lib/Drupal/Core/TypedData/ListDataDefinition.php
@@ -47,7 +47,7 @@ public static function createFromItemType($item_type) {
   /**
    * {@inheritdoc}
    */
-  public function __construct(array $values = [], DataDefinitionInterface $item_definition = NULL) {
+  public function __construct(array $values = [], ?DataDefinitionInterface $item_definition = NULL) {
     $this->definition = $values;
     $this->itemDefinition = $item_definition;
   }
diff --git a/core/lib/Drupal/Core/TypedData/MapDataDefinition.php b/core/lib/Drupal/Core/TypedData/MapDataDefinition.php
index 203e4a367edd..11b03d3632b8 100644
--- a/core/lib/Drupal/Core/TypedData/MapDataDefinition.php
+++ b/core/lib/Drupal/Core/TypedData/MapDataDefinition.php
@@ -54,7 +54,7 @@ public function getPropertyDefinitions() {
    *
    * @return $this
    */
-  public function setPropertyDefinition($name, DataDefinitionInterface $definition = NULL) {
+  public function setPropertyDefinition($name, ?DataDefinitionInterface $definition = NULL) {
     if (isset($definition)) {
       $this->propertyDefinitions[$name] = $definition;
     }
diff --git a/core/lib/Drupal/Core/TypedData/OptionsProviderInterface.php b/core/lib/Drupal/Core/TypedData/OptionsProviderInterface.php
index 36fde8b23657..34ecb27fef69 100644
--- a/core/lib/Drupal/Core/TypedData/OptionsProviderInterface.php
+++ b/core/lib/Drupal/Core/TypedData/OptionsProviderInterface.php
@@ -41,7 +41,7 @@ interface OptionsProviderInterface {
    * @return array
    *   An array of possible values.
    */
-  public function getPossibleValues(AccountInterface $account = NULL);
+  public function getPossibleValues(?AccountInterface $account = NULL);
 
   /**
    * Returns an array of possible values with labels for display.
@@ -60,7 +60,7 @@ public function getPossibleValues(AccountInterface $account = NULL);
    *   two-dimensional array of option groups (array of flat option arrays,
    *   keyed by option group label). Note that labels should NOT be sanitized.
    */
-  public function getPossibleOptions(AccountInterface $account = NULL);
+  public function getPossibleOptions(?AccountInterface $account = NULL);
 
   /**
    * Returns an array of settable values.
@@ -75,7 +75,7 @@ public function getPossibleOptions(AccountInterface $account = NULL);
    * @return array
    *   An array of settable values.
    */
-  public function getSettableValues(AccountInterface $account = NULL);
+  public function getSettableValues(?AccountInterface $account = NULL);
 
   /**
    * Returns an array of settable values with labels for display.
@@ -94,6 +94,6 @@ public function getSettableValues(AccountInterface $account = NULL);
    *   of option groups (array of flat option arrays, keyed by option group
    *   label). Note that labels should NOT be sanitized.
    */
-  public function getSettableOptions(AccountInterface $account = NULL);
+  public function getSettableOptions(?AccountInterface $account = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/TypedData/TypedData.php b/core/lib/Drupal/Core/TypedData/TypedData.php
index 27dd1d57344d..11dc646cc193 100644
--- a/core/lib/Drupal/Core/TypedData/TypedData.php
+++ b/core/lib/Drupal/Core/TypedData/TypedData.php
@@ -43,7 +43,7 @@ abstract class TypedData implements TypedDataInterface, PluginInspectionInterfac
   /**
    * {@inheritdoc}
    */
-  public static function createInstance($definition, $name = NULL, TraversableTypedDataInterface $parent = NULL) {
+  public static function createInstance($definition, $name = NULL, ?TraversableTypedDataInterface $parent = NULL) {
     return new static($definition, $name, $parent);
   }
 
@@ -61,7 +61,7 @@ public static function createInstance($definition, $name = NULL, TraversableType
    *
    * @see \Drupal\Core\TypedData\TypedDataManager::create()
    */
-  public function __construct(DataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL) {
+  public function __construct(DataDefinitionInterface $definition, $name = NULL, ?TypedDataInterface $parent = NULL) {
     $this->definition = $definition;
     $this->parent = $parent;
     $this->name = $name;
@@ -144,7 +144,7 @@ public function applyDefaultValue($notify = TRUE) {
   /**
    * {@inheritdoc}
    */
-  public function setContext($name = NULL, TraversableTypedDataInterface $parent = NULL) {
+  public function setContext($name = NULL, ?TraversableTypedDataInterface $parent = NULL) {
     $this->parent = $parent;
     $this->name = $name;
   }
diff --git a/core/lib/Drupal/Core/TypedData/TypedDataInterface.php b/core/lib/Drupal/Core/TypedData/TypedDataInterface.php
index 0d1099acade3..10055651e1f9 100644
--- a/core/lib/Drupal/Core/TypedData/TypedDataInterface.php
+++ b/core/lib/Drupal/Core/TypedData/TypedDataInterface.php
@@ -29,7 +29,7 @@ interface TypedDataInterface {
    *
    * @see \Drupal\Core\TypedData\TypedDataManager::create()
    */
-  public static function createInstance($definition, $name = NULL, TraversableTypedDataInterface $parent = NULL);
+  public static function createInstance($definition, $name = NULL, ?TraversableTypedDataInterface $parent = NULL);
 
   /**
    * Gets the data definition.
@@ -158,6 +158,6 @@ public function getPropertyPath();
    *   (optional) The parent object of the data property, or NULL if it is the
    *   root of a typed data tree. Defaults to NULL.
    */
-  public function setContext($name = NULL, TraversableTypedDataInterface $parent = NULL);
+  public function setContext($name = NULL, ?TraversableTypedDataInterface $parent = NULL);
 
 }
diff --git a/core/lib/Drupal/Core/Update/UpdateRegistry.php b/core/lib/Drupal/Core/Update/UpdateRegistry.php
index dca560f36515..bad929cc7af5 100644
--- a/core/lib/Drupal/Core/Update/UpdateRegistry.php
+++ b/core/lib/Drupal/Core/Update/UpdateRegistry.php
@@ -249,7 +249,7 @@ public function getUpdateFunctions($extension_name) {
    *   (optional) Limits the extension update files loaded to the provided
    *   extension.
    */
-  protected function scanExtensionsAndLoadUpdateFiles(string $extension = NULL) {
+  protected function scanExtensionsAndLoadUpdateFiles(?string $extension = NULL) {
     if ($extension !== NULL && isset(self::$loadedFiles[$this->root][$this->sitePath][$extension][$this->updateType])) {
       // We've already checked for this file and, if it exists, loaded it.
       return;
diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php
index eb7dab9be1e8..d79322f19af3 100644
--- a/core/lib/Drupal/Core/Url.php
+++ b/core/lib/Drupal/Core/Url.php
@@ -804,7 +804,7 @@ public function getInternalPath() {
    *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
    *   access is either explicitly forbidden or "no opinion".
    */
-  public function access(AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access(?AccountInterface $account = NULL, $return_as_object = FALSE) {
     if ($this->isRouted()) {
       return $this->accessManager()->checkNamedRoute($this->getRouteName(), $this->getRouteParameters(), $account, $return_as_object);
     }
@@ -855,7 +855,7 @@ protected function unroutedUrlAssembler() {
    *
    * @return $this
    */
-  public function setUrlGenerator(UrlGeneratorInterface $url_generator = NULL) {
+  public function setUrlGenerator(?UrlGeneratorInterface $url_generator = NULL) {
     $this->urlGenerator = $url_generator;
     $this->internalPath = NULL;
     return $this;
diff --git a/core/lib/Drupal/Core/Utility/Token.php b/core/lib/Drupal/Core/Utility/Token.php
index dfa0caa0dd48..d50afd4f2c62 100644
--- a/core/lib/Drupal/Core/Utility/Token.php
+++ b/core/lib/Drupal/Core/Utility/Token.php
@@ -187,7 +187,7 @@ public function __construct(ModuleHandlerInterface $module_handler, CacheBackend
    *
    * @see static::replacePlain()
    */
-  public function replace($markup, array $data = [], array $options = [], BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function replace($markup, array $data = [], array $options = [], ?BubbleableMetadata $bubbleable_metadata = NULL) {
     return $this->doReplace(TRUE, (string) $markup, $data, $options, $bubbleable_metadata);
   }
 
@@ -206,7 +206,7 @@ public function replace($markup, array $data = [], array $options = [], Bubbleab
    * @return string
    *   The entered plain text with tokens replaced.
    */
-  public function replacePlain(string $plain, array $data = [], array $options = [], BubbleableMetadata $bubbleable_metadata = NULL): string {
+  public function replacePlain(string $plain, array $data = [], array $options = [], ?BubbleableMetadata $bubbleable_metadata = NULL): string {
     return $this->doReplace(FALSE, $plain, $data, $options, $bubbleable_metadata);
   }
 
@@ -227,7 +227,7 @@ public function replacePlain(string $plain, array $data = [], array $options = [
    * @return string
    *   The token result is the entered string with tokens replaced.
    */
-  protected function doReplace(bool $markup, string $text, array $data, array $options, BubbleableMetadata $bubbleable_metadata = NULL): string {
+  protected function doReplace(bool $markup, string $text, array $data, array $options, ?BubbleableMetadata $bubbleable_metadata = NULL): string {
     $text_tokens = $this->scan($text);
     if (empty($text_tokens)) {
       return $text;
diff --git a/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php b/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php
index 70f9f2cc7da7..8aff37da3e1b 100644
--- a/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php
+++ b/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php
@@ -45,7 +45,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php b/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php
index 8d41095b6f97..49dd67c04569 100644
--- a/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php
+++ b/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php
@@ -35,7 +35,7 @@ class BigPipePlaceholderTestCases {
    *
    * @return \Drupal\big_pipe_test\BigPipePlaceholderTestCase[]
    */
-  public static function cases(ContainerInterface $container = NULL, AccountInterface $user = NULL) {
+  public static function cases(?ContainerInterface $container = NULL, ?AccountInterface $user = NULL) {
     // Define the two types of cacheability that we expect to see. These will be
     // used in the expectations.
     $cacheability_depends_on_session_only = [
diff --git a/core/modules/block/src/BlockListBuilder.php b/core/modules/block/src/BlockListBuilder.php
index cf2dfaf45c47..24e90205c88e 100644
--- a/core/modules/block/src/BlockListBuilder.php
+++ b/core/modules/block/src/BlockListBuilder.php
@@ -107,7 +107,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
    * @return array
    *   The block list as a renderable array.
    */
-  public function render($theme = NULL, Request $request = NULL) {
+  public function render($theme = NULL, ?Request $request = NULL) {
     $this->request = $request;
     $this->theme = $theme;
 
diff --git a/core/modules/block/src/BlockRepository.php b/core/modules/block/src/BlockRepository.php
index 3a5a00d84694..e76743663430 100644
--- a/core/modules/block/src/BlockRepository.php
+++ b/core/modules/block/src/BlockRepository.php
@@ -86,7 +86,7 @@ public function getVisibleBlocksPerRegion(array &$cacheable_metadata = []) {
   /**
    * {@inheritdoc}
    */
-  public function getUniqueMachineName(string $suggestion, string $theme = NULL): string {
+  public function getUniqueMachineName(string $suggestion, ?string $theme = NULL): string {
     if ($theme) {
       $suggestion = $theme . '_' . $suggestion;
     }
diff --git a/core/modules/block/src/Controller/BlockListController.php b/core/modules/block/src/Controller/BlockListController.php
index ee1688f93e5a..b23358c50a89 100644
--- a/core/modules/block/src/Controller/BlockListController.php
+++ b/core/modules/block/src/Controller/BlockListController.php
@@ -41,7 +41,7 @@ public function __construct(ThemeHandlerInterface $theme_handler) {
    *   A render array as expected by
    *   \Drupal\Core\Render\RendererInterface::render().
    */
-  public function listing($theme = NULL, Request $request = NULL) {
+  public function listing($theme = NULL, ?Request $request = NULL) {
     $theme = $theme ?: $this->config('system.theme')->get('default');
     if (!$this->themeHandler->hasUi($theme)) {
       throw new NotFoundHttpException();
diff --git a/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php b/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php
index 33bcfef2fccf..eb36cded0bc7 100644
--- a/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php
+++ b/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php
@@ -53,7 +53,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     $entity_type_manager = $container->get('entity_type.manager');
     return new static(
       $configuration,
diff --git a/core/modules/block/src/Plugin/migrate/process/BlockVisibility.php b/core/modules/block/src/Plugin/migrate/process/BlockVisibility.php
index 9b6f18c8d95b..91ee670ca8b5 100644
--- a/core/modules/block/src/Plugin/migrate/process/BlockVisibility.php
+++ b/core/modules/block/src/Plugin/migrate/process/BlockVisibility.php
@@ -66,7 +66,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/block/src/Plugin/migrate/process/RolesLookup.php b/core/modules/block/src/Plugin/migrate/process/RolesLookup.php
index 1b115a02d69c..3f004aa16a8e 100644
--- a/core/modules/block/src/Plugin/migrate/process/RolesLookup.php
+++ b/core/modules/block/src/Plugin/migrate/process/RolesLookup.php
@@ -73,7 +73,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php
index c8385021ed21..c0edc533de2e 100644
--- a/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php
+++ b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php
@@ -77,7 +77,7 @@ protected function setUp(): void {
    *
    * @internal
    */
-  public function assertEntity(string $id, array $visibility, string $region, string $theme, int $weight, array $settings = NULL, bool $status = TRUE): void {
+  public function assertEntity(string $id, array $visibility, string $region, string $theme, int $weight, ?array $settings = NULL, bool $status = TRUE): void {
     $block = Block::load($id);
     $this->assertInstanceOf(Block::class, $block);
     $this->assertSame($visibility, $block->getVisibility());
diff --git a/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php b/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php
index ccd22a0c3529..bde7c734d4e1 100644
--- a/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php
+++ b/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php
@@ -26,7 +26,7 @@ class BlockRegionTest extends UnitTestCase {
    * @return array|string
    *   The transformed value.
    */
-  protected function transform(array $value, Row $row = NULL) {
+  protected function transform(array $value, ?Row $row = NULL) {
     $executable = $this->prophesize(MigrateExecutableInterface::class)->reveal();
     if (empty($row)) {
       $row = $this->prophesize(Row::class)->reveal();
diff --git a/core/modules/block_content/src/Access/AccessGroupAnd.php b/core/modules/block_content/src/Access/AccessGroupAnd.php
index a2f3d1e6211c..be86d9e97000 100644
--- a/core/modules/block_content/src/Access/AccessGroupAnd.php
+++ b/core/modules/block_content/src/Access/AccessGroupAnd.php
@@ -31,7 +31,7 @@ public function addDependency(AccessibleInterface $dependency) {
   /**
    * {@inheritdoc}
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $access_result = AccessResult::neutral();
     foreach (array_slice($this->dependencies, 1) as $dependency) {
       $access_result = $access_result->andIf($dependency->access($operation, $account, TRUE));
diff --git a/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php b/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
index c386d3d71688..22459b1e939e 100644
--- a/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
+++ b/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
@@ -351,7 +351,7 @@ public function getCKEditor5PluginConfig(EditorInterface $editor): array {
   /**
    * {@inheritdoc}
    */
-  public function getProvidedElements(array $plugin_ids = [], EditorInterface $editor = NULL, bool $resolve_wildcards = TRUE, bool $creatable_elements_only = FALSE): array {
+  public function getProvidedElements(array $plugin_ids = [], ?EditorInterface $editor = NULL, bool $resolve_wildcards = TRUE, bool $creatable_elements_only = FALSE): array {
     $plugins = $this->getDefinitions();
     if (!empty($plugin_ids)) {
       $plugins = array_intersect_key($plugins, array_flip($plugin_ids));
diff --git a/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManagerInterface.php b/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManagerInterface.php
index 08cc21a2ecfa..de91116fc289 100644
--- a/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManagerInterface.php
+++ b/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManagerInterface.php
@@ -126,6 +126,6 @@ public function getCKEditor5PluginConfig(EditorInterface $editor): array;
    *
    * @see \Drupal\filter\Plugin\FilterInterface::getHTMLRestrictions()
    */
-  public function getProvidedElements(array $plugin_ids = [], EditorInterface $editor = NULL, bool $resolve_wildcards = TRUE, bool $creatable_elements_only = FALSE): array;
+  public function getProvidedElements(array $plugin_ids = [], ?EditorInterface $editor = NULL, bool $resolve_wildcards = TRUE, bool $creatable_elements_only = FALSE): array;
 
 }
diff --git a/core/modules/ckeditor5/src/Plugin/Validation/Constraint/FundamentalCompatibilityConstraintValidator.php b/core/modules/ckeditor5/src/Plugin/Validation/Constraint/FundamentalCompatibilityConstraintValidator.php
index 3c4c8a674b52..668125d4b395 100644
--- a/core/modules/ckeditor5/src/Plugin/Validation/Constraint/FundamentalCompatibilityConstraintValidator.php
+++ b/core/modules/ckeditor5/src/Plugin/Validation/Constraint/FundamentalCompatibilityConstraintValidator.php
@@ -259,7 +259,7 @@ private function checkAllHtmlTagsAreCreatable(EditorInterface $text_editor, Fund
    * @return iterable|\Drupal\filter\Plugin\FilterInterface[]
    *   An iterable of matched filter plugins.
    */
-  private static function getFiltersInFormatOfType(FilterFormatInterface $text_format, int $filter_type, callable $extra_requirements = NULL): iterable {
+  private static function getFiltersInFormatOfType(FilterFormatInterface $text_format, int $filter_type, ?callable $extra_requirements = NULL): iterable {
     assert(in_array($filter_type, [
       FilterInterface::TYPE_MARKUP_LANGUAGE,
       FilterInterface::TYPE_HTML_RESTRICTOR,
diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php
index 7879bf002b00..51a9fa6ba3e3 100644
--- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php
+++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php
@@ -126,7 +126,7 @@ protected function triggerKeyUp(string $selector, string $key) {
    *
    * @see \Behat\Mink\WebAssert::fieldValueEquals()
    */
-  protected function assertHtmlEsqueFieldValueEquals($field, $value, TraversableElement $container = NULL) {
+  protected function assertHtmlEsqueFieldValueEquals($field, $value, ?TraversableElement $container = NULL) {
     $assert_session = $this->assertSession();
 
     $node = $assert_session->fieldExists($field, $container);
diff --git a/core/modules/comment/src/CommentAccessControlHandler.php b/core/modules/comment/src/CommentAccessControlHandler.php
index ce12f12d5a48..87805f39357a 100644
--- a/core/modules/comment/src/CommentAccessControlHandler.php
+++ b/core/modules/comment/src/CommentAccessControlHandler.php
@@ -69,7 +69,7 @@ protected function checkCreateAccess(AccountInterface $account, array $context,
   /**
    * {@inheritdoc}
    */
-  protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+  protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
     if ($operation == 'edit') {
       // Only users with the "administer comments" permission can edit
       // administrative fields.
diff --git a/core/modules/comment/src/CommentFieldItemList.php b/core/modules/comment/src/CommentFieldItemList.php
index 53420df3e78b..ab257a008aff 100644
--- a/core/modules/comment/src/CommentFieldItemList.php
+++ b/core/modules/comment/src/CommentFieldItemList.php
@@ -42,7 +42,7 @@ public function offsetExists($offset): bool {
   /**
    * {@inheritdoc}
    */
-  public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation = 'view', ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     if ($operation === 'edit') {
       // Only users with administer comments permission can edit the comment
       // status field.
diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php
index cf94909240df..c9daaa1859e0 100644
--- a/core/modules/comment/src/CommentForm.php
+++ b/core/modules/comment/src/CommentForm.php
@@ -84,7 +84,7 @@ public function __construct(
     RendererInterface $renderer,
     EntityTypeBundleInfoInterface $entity_type_bundle_info,
     TimeInterface $time,
-    EntityFieldManagerInterface $entity_field_manager = NULL,
+    ?EntityFieldManagerInterface $entity_field_manager = NULL,
   ) {
     parent::__construct($entity_repository, $entity_type_bundle_info, $time);
     $this->currentUser = $current_user;
diff --git a/core/modules/comment/src/CommentStatistics.php b/core/modules/comment/src/CommentStatistics.php
index 999011b536f0..785f2b4c807e 100644
--- a/core/modules/comment/src/CommentStatistics.php
+++ b/core/modules/comment/src/CommentStatistics.php
@@ -71,7 +71,7 @@ public function __construct(
     EntityTypeManagerInterface $entity_type_manager,
     StateInterface $state,
     protected TimeInterface $time,
-    Connection $database_replica = NULL,
+    ?Connection $database_replica = NULL,
   ) {
     $this->database = $database;
     $this->currentUser = $current_user;
diff --git a/core/modules/comment/src/Plugin/Menu/LocalTask/UnapprovedComments.php b/core/modules/comment/src/Plugin/Menu/LocalTask/UnapprovedComments.php
index f5c6ce7b3f01..7c587c86807f 100644
--- a/core/modules/comment/src/Plugin/Menu/LocalTask/UnapprovedComments.php
+++ b/core/modules/comment/src/Plugin/Menu/LocalTask/UnapprovedComments.php
@@ -54,7 +54,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     return $this->t('Unapproved comments (@count)', ['@count' => $this->commentStorage->getUnapprovedCount()]);
   }
 
diff --git a/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php
index 3b04631fd89f..23d025f8f575 100644
--- a/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php
+++ b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php
@@ -57,7 +57,7 @@ class EntityComment extends EntityContentBase {
    * @param \Drupal\Core\Session\AccountSwitcherInterface|null $account_switcher
    *   The account switcher service.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityFieldManagerInterface $entity_field_manager, FieldTypePluginManagerInterface $field_type_manager, StateInterface $state, AccountSwitcherInterface $account_switcher = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityFieldManagerInterface $entity_field_manager, FieldTypePluginManagerInterface $field_type_manager, StateInterface $state, ?AccountSwitcherInterface $account_switcher = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $entity_field_manager, $field_type_manager, $account_switcher);
     $this->state = $state;
   }
@@ -65,7 +65,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     $entity_type = static::getEntityTypeId($plugin_id);
     return new static(
       $configuration,
diff --git a/core/modules/comment/src/Plugin/views/field/LastTimestamp.php b/core/modules/comment/src/Plugin/views/field/LastTimestamp.php
index 8110b79d3737..c0bd35f30cae 100644
--- a/core/modules/comment/src/Plugin/views/field/LastTimestamp.php
+++ b/core/modules/comment/src/Plugin/views/field/LastTimestamp.php
@@ -19,7 +19,7 @@ class LastTimestamp extends Date {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->additional_fields['comment_count'] = 'comment_count';
diff --git a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
index 1ddcb16f4f77..aeabfe3bca2f 100644
--- a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
+++ b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
@@ -91,7 +91,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->additional_fields['entity_id'] = 'nid';
diff --git a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
index 4b74458f8ee0..9693ac528f7f 100644
--- a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
@@ -195,7 +195,7 @@ public function postComment(?EntityInterface $entity, $comment, $subject = '', $
    * @return bool
    *   Boolean indicating whether the comment was found.
    */
-  public function commentExists(CommentInterface $comment = NULL, $reply = FALSE) {
+  public function commentExists(?CommentInterface $comment = NULL, $reply = FALSE) {
     if ($comment) {
       $regex = '/' . ($reply ? '<div class="indented">(.*?)' : '');
       $regex .= '<article(.*?)id="comment-' . $comment->id() . '"(.*?)';
diff --git a/core/modules/comment/tests/src/Functional/CommentTestBase.php b/core/modules/comment/tests/src/Functional/CommentTestBase.php
index 8f47b6418e39..d1fc1b8eb9a4 100644
--- a/core/modules/comment/tests/src/Functional/CommentTestBase.php
+++ b/core/modules/comment/tests/src/Functional/CommentTestBase.php
@@ -201,7 +201,7 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
    * @return bool
    *   Boolean indicating whether the comment was found.
    */
-  public function commentExists(CommentInterface $comment = NULL, $reply = FALSE) {
+  public function commentExists(?CommentInterface $comment = NULL, $reply = FALSE) {
     if ($comment) {
       $comment_element = $this->cssSelect(($reply ? '.indented ' : '') . 'article#comment-' . $comment->id());
       if (empty($comment_element)) {
diff --git a/core/modules/config_translation/src/ConfigEntityMapper.php b/core/modules/config_translation/src/ConfigEntityMapper.php
index e61ac7775a08..39355303c070 100644
--- a/core/modules/config_translation/src/ConfigEntityMapper.php
+++ b/core/modules/config_translation/src/ConfigEntityMapper.php
@@ -77,7 +77,7 @@ class ConfigEntityMapper extends ConfigNamesMapper implements ConfigEntityMapper
    * @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher
    *   The event dispatcher.
    */
-  public function __construct($plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $translation_manager, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, EventDispatcherInterface $event_dispatcher = NULL) {
+  public function __construct($plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $translation_manager, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, ?EventDispatcherInterface $event_dispatcher = NULL) {
     parent::__construct($plugin_id, $plugin_definition, $config_factory, $typed_config, $locale_config_manager, $config_mapper_manager, $route_provider, $translation_manager, $language_manager, $event_dispatcher);
     $this->setType($plugin_definition['entity_type']);
 
diff --git a/core/modules/config_translation/src/ConfigMapperManager.php b/core/modules/config_translation/src/ConfigMapperManager.php
index 13f57db0c244..6ce0054a3d8e 100644
--- a/core/modules/config_translation/src/ConfigMapperManager.php
+++ b/core/modules/config_translation/src/ConfigMapperManager.php
@@ -118,7 +118,7 @@ protected function getDiscovery() {
   /**
    * {@inheritdoc}
    */
-  public function getMappers(RouteCollection $collection = NULL) {
+  public function getMappers(?RouteCollection $collection = NULL) {
     $mappers = [];
     foreach ($this->getDefinitions() as $id => $definition) {
       $mappers[$id] = $this->createInstance($id);
diff --git a/core/modules/config_translation/src/ConfigMapperManagerInterface.php b/core/modules/config_translation/src/ConfigMapperManagerInterface.php
index 491cb42c65f5..a01add6213ae 100644
--- a/core/modules/config_translation/src/ConfigMapperManagerInterface.php
+++ b/core/modules/config_translation/src/ConfigMapperManagerInterface.php
@@ -19,7 +19,7 @@ interface ConfigMapperManagerInterface extends PluginManagerInterface {
    * @return \Drupal\config_translation\ConfigMapperInterface[]
    *   An array of all mappers.
    */
-  public function getMappers(RouteCollection $collection = NULL);
+  public function getMappers(?RouteCollection $collection = NULL);
 
   /**
    * Returns TRUE if the configuration data has translatable items.
diff --git a/core/modules/config_translation/src/ConfigNamesMapper.php b/core/modules/config_translation/src/ConfigNamesMapper.php
index a0068ceec83c..7e62d29a9116 100644
--- a/core/modules/config_translation/src/ConfigNamesMapper.php
+++ b/core/modules/config_translation/src/ConfigNamesMapper.php
@@ -132,7 +132,7 @@ class ConfigNamesMapper extends PluginBase implements ConfigMapperInterface, Con
    *   Throws an exception if the route specified by the 'base_route_name' in
    *   the plugin definition could not be found by the route provider.
    */
-  public function __construct($plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $string_translation, LanguageManagerInterface $language_manager, EventDispatcherInterface $event_dispatcher = NULL) {
+  public function __construct($plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $string_translation, LanguageManagerInterface $language_manager, ?EventDispatcherInterface $event_dispatcher = NULL) {
     $this->pluginId = $plugin_id;
     $this->pluginDefinition = $plugin_definition;
     $this->routeProvider = $route_provider;
diff --git a/core/modules/config_translation/src/Form/ConfigTranslationAddForm.php b/core/modules/config_translation/src/Form/ConfigTranslationAddForm.php
index fed6c39d9d5c..1dd44a132adf 100644
--- a/core/modules/config_translation/src/Form/ConfigTranslationAddForm.php
+++ b/core/modules/config_translation/src/Form/ConfigTranslationAddForm.php
@@ -22,7 +22,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, RouteMatchInterface $route_match = NULL, $plugin_id = NULL, $langcode = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?RouteMatchInterface $route_match = NULL, $plugin_id = NULL, $langcode = NULL) {
     $form = parent::buildForm($form, $form_state, $route_match, $plugin_id, $langcode);
     $form['#title'] = $this->t('Add @language translation for %label', [
       '%label' => $this->mapper->getTitle(),
diff --git a/core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php b/core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php
index d420ee63dc5c..fd34c50c4cb0 100644
--- a/core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php
+++ b/core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php
@@ -113,7 +113,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, RouteMatchInterface $route_match = NULL, $plugin_id = NULL, $langcode = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?RouteMatchInterface $route_match = NULL, $plugin_id = NULL, $langcode = NULL) {
     /** @var \Drupal\config_translation\ConfigMapperInterface $mapper */
     $mapper = $this->configMapperManager->createInstance($plugin_id);
     $mapper->populateFromRouteMatch($route_match);
diff --git a/core/modules/config_translation/src/Form/ConfigTranslationEditForm.php b/core/modules/config_translation/src/Form/ConfigTranslationEditForm.php
index 8754d916509b..42955ef61659 100644
--- a/core/modules/config_translation/src/Form/ConfigTranslationEditForm.php
+++ b/core/modules/config_translation/src/Form/ConfigTranslationEditForm.php
@@ -22,7 +22,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, RouteMatchInterface $route_match = NULL, $plugin_id = NULL, $langcode = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?RouteMatchInterface $route_match = NULL, $plugin_id = NULL, $langcode = NULL) {
     $form = parent::buildForm($form, $form_state, $route_match, $plugin_id, $langcode);
     $form['#title'] = $this->t('Edit @language translation for %label', [
       '%label' => $this->mapper->getTitle(),
diff --git a/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php b/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php
index 279465773a1b..fc95f45fc835 100644
--- a/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php
+++ b/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php
@@ -127,7 +127,7 @@ public function getBaseFormId() {
    *   Throws an exception if the language code provided as a query parameter in
    *   the request does not match an active language.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, RouteMatchInterface $route_match = NULL, $plugin_id = NULL, $langcode = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?RouteMatchInterface $route_match = NULL, $plugin_id = NULL, $langcode = NULL) {
     /** @var \Drupal\config_translation\ConfigMapperInterface $mapper */
     $mapper = $this->configMapperManager->createInstance($plugin_id);
     $mapper->populateFromRouteMatch($route_match);
diff --git a/core/modules/config_translation/src/Plugin/Menu/ContextualLink/ConfigTranslationContextualLink.php b/core/modules/config_translation/src/Plugin/Menu/ContextualLink/ConfigTranslationContextualLink.php
index c808ebf56a75..aa2f2326d767 100644
--- a/core/modules/config_translation/src/Plugin/Menu/ContextualLink/ConfigTranslationContextualLink.php
+++ b/core/modules/config_translation/src/Plugin/Menu/ContextualLink/ConfigTranslationContextualLink.php
@@ -22,7 +22,7 @@ class ConfigTranslationContextualLink extends ContextualLinkDefault {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     // Use the custom 'config_translation_plugin_id' plugin definition key to
     // retrieve the title. We need to retrieve a runtime title (as opposed to
     // storing the title on the plugin definition for the link) because it
diff --git a/core/modules/config_translation/src/Plugin/Menu/LocalTask/ConfigTranslationLocalTask.php b/core/modules/config_translation/src/Plugin/Menu/LocalTask/ConfigTranslationLocalTask.php
index e781c9bd9a22..f549f6035b23 100644
--- a/core/modules/config_translation/src/Plugin/Menu/LocalTask/ConfigTranslationLocalTask.php
+++ b/core/modules/config_translation/src/Plugin/Menu/LocalTask/ConfigTranslationLocalTask.php
@@ -22,7 +22,7 @@ class ConfigTranslationLocalTask extends LocalTaskDefault {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     // Take custom 'config_translation_plugin_id' plugin definition key to
     // retrieve title. We need to retrieve a runtime title (as opposed to
     // storing the title on the plugin definition for the link) because
diff --git a/core/modules/contact/src/Controller/ContactController.php b/core/modules/contact/src/Controller/ContactController.php
index 67b1b98c89b8..709ae33245d4 100644
--- a/core/modules/contact/src/Controller/ContactController.php
+++ b/core/modules/contact/src/Controller/ContactController.php
@@ -45,7 +45,7 @@ public function __construct(RendererInterface $renderer) {
    *   Exception is thrown when user tries to access non existing default
    *   contact form.
    */
-  public function contactSitePage(ContactFormInterface $contact_form = NULL) {
+  public function contactSitePage(?ContactFormInterface $contact_form = NULL) {
     $config = $this->config('contact.settings');
 
     // Use the default form if no form has been passed.
diff --git a/core/modules/contact/src/MessageForm.php b/core/modules/contact/src/MessageForm.php
index 91facbd57508..da33c95fe236 100644
--- a/core/modules/contact/src/MessageForm.php
+++ b/core/modules/contact/src/MessageForm.php
@@ -72,7 +72,7 @@ class MessageForm extends ContentEntityForm {
    * @param \Drupal\Component\Datetime\TimeInterface $time
    *   The time service.
    */
-  public function __construct(EntityRepositoryInterface $entity_repository, FloodInterface $flood, LanguageManagerInterface $language_manager, MailHandlerInterface $mail_handler, DateFormatterInterface $date_formatter, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) {
+  public function __construct(EntityRepositoryInterface $entity_repository, FloodInterface $flood, LanguageManagerInterface $language_manager, MailHandlerInterface $mail_handler, DateFormatterInterface $date_formatter, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, ?TimeInterface $time = NULL) {
     parent::__construct($entity_repository, $entity_type_bundle_info, $time);
     $this->flood = $flood;
     $this->languageManager = $language_manager;
diff --git a/core/modules/content_moderation/content_moderation.module b/core/modules/content_moderation/content_moderation.module
index 536626490723..df332c35c478 100644
--- a/core/modules/content_moderation/content_moderation.module
+++ b/core/modules/content_moderation/content_moderation.module
@@ -254,7 +254,7 @@ function content_moderation_entity_access(EntityInterface $entity, $operation, A
 /**
  * Implements hook_entity_field_access().
  */
-function content_moderation_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function content_moderation_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   if ($items && $operation === 'edit') {
     /** @var \Drupal\content_moderation\ModerationInformationInterface $moderation_info */
     $moderation_info = Drupal::service('content_moderation.moderation_information');
diff --git a/core/modules/content_moderation/src/Form/ContentModerationStateForm.php b/core/modules/content_moderation/src/Form/ContentModerationStateForm.php
index 3ba5f659359a..7fa2bb84c7f4 100644
--- a/core/modules/content_moderation/src/Form/ContentModerationStateForm.php
+++ b/core/modules/content_moderation/src/Form/ContentModerationStateForm.php
@@ -16,7 +16,7 @@ class ContentModerationStateForm extends WorkflowTypeStateFormBase {
   /**
    * {@inheritdoc}
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state, StateInterface $state = NULL) {
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state, ?StateInterface $state = NULL) {
     /** @var \Drupal\content_moderation\ContentModerationState $state */
     $state = $form_state->get('state');
     $is_required_state = isset($state) ? in_array($state->id(), $this->workflowType->getRequiredStates(), TRUE) : FALSE;
diff --git a/core/modules/content_moderation/src/Form/EntityModerationForm.php b/core/modules/content_moderation/src/Form/EntityModerationForm.php
index 919f4e5b5270..751c6b3596e9 100644
--- a/core/modules/content_moderation/src/Form/EntityModerationForm.php
+++ b/core/modules/content_moderation/src/Form/EntityModerationForm.php
@@ -77,7 +77,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, ContentEntityInterface $entity = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?ContentEntityInterface $entity = NULL) {
     $current_state = $entity->moderation_state->value;
     $workflow = $this->moderationInfo->getWorkflowForEntity($entity);
 
diff --git a/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutPublish.php b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutPublish.php
index 1311bdb2f3fd..0b63f78f2abb 100644
--- a/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutPublish.php
+++ b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutPublish.php
@@ -81,7 +81,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function access($entity, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($entity, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
     if ($entity && $this->moderationInfo->isModeratedEntity($entity)) {
       $bundle_info = $this->bundleInfo->getBundleInfo($entity->getEntityTypeId());
diff --git a/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutUnpublish.php b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutUnpublish.php
index 091a2ea3da50..541429fecc01 100644
--- a/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutUnpublish.php
+++ b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutUnpublish.php
@@ -80,7 +80,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function access($entity, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($entity, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
     if ($entity && $this->moderationInfo->isModeratedEntity($entity)) {
       $bundle_info = $this->bundleInfo->getBundleInfo($entity->getEntityTypeId());
diff --git a/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php b/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php
index bbbea44a1674..20a5cf4128b9 100644
--- a/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php
+++ b/core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php
@@ -23,7 +23,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, LanguageInterface $language = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?LanguageInterface $language = NULL) {
     if ($language) {
       $form_state->set('langcode', $language->getId());
     }
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php
index f46e5ef3a0ba..0dbb05b54a6c 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php
@@ -157,7 +157,7 @@ protected function getEditorPermissions() {
    * @param \Drupal\User\UserInterface|null $user
    *   (optional) The entity owner.
    */
-  protected function setupEntity(UserInterface $user = NULL) {
+  protected function setupEntity(?UserInterface $user = NULL) {
     $default_langcode = $this->langcodes[0];
 
     // Create a test entity.
diff --git a/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php
index aed41a4d9be6..ae2f5a8e494a 100644
--- a/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php
+++ b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php
@@ -77,7 +77,7 @@ protected function setUp(): void {
    *
    * @internal
    */
-  protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, string $expected_description = '', string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL): void {
+  protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], ?int $expected_field_integer_value = NULL, ?int $expected_term_reference_tid = NULL): void {
     /** @var \Drupal\taxonomy\TermInterface $entity */
     $entity = Term::load($id);
     $this->assertInstanceOf(TermInterface::class, $entity);
diff --git a/core/modules/datetime/src/DateTimeComputed.php b/core/modules/datetime/src/DateTimeComputed.php
index f97e5a0c7b99..b54ca96aa61c 100644
--- a/core/modules/datetime/src/DateTimeComputed.php
+++ b/core/modules/datetime/src/DateTimeComputed.php
@@ -27,7 +27,7 @@ class DateTimeComputed extends TypedData {
   /**
    * {@inheritdoc}
    */
-  public function __construct(DataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL) {
+  public function __construct(DataDefinitionInterface $definition, $name = NULL, ?TypedDataInterface $parent = NULL) {
     parent::__construct($definition, $name, $parent);
     if (!$definition->getSetting('date source')) {
       throw new \InvalidArgumentException("The definition's 'date source' key has to specify the name of the date property to be computed.");
diff --git a/core/modules/dblog/src/Plugin/views/field/DblogMessage.php b/core/modules/dblog/src/Plugin/views/field/DblogMessage.php
index 5e80ea68f551..2725098332ab 100644
--- a/core/modules/dblog/src/Plugin/views/field/DblogMessage.php
+++ b/core/modules/dblog/src/Plugin/views/field/DblogMessage.php
@@ -21,7 +21,7 @@ class DblogMessage extends FieldPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if ($this->options['replace_variables']) {
diff --git a/core/modules/editor/editor.api.php b/core/modules/editor/editor.api.php
index 8a55c3149ac4..577449759c22 100644
--- a/core/modules/editor/editor.api.php
+++ b/core/modules/editor/editor.api.php
@@ -58,7 +58,7 @@ function hook_editor_js_settings_alter(array &$settings) {
  *
  * @see \Drupal\editor\EditorXssFilterInterface
  */
-function hook_editor_xss_filter_alter(&$editor_xss_filter_class, FilterFormatInterface $format, FilterFormatInterface $original_format = NULL) {
+function hook_editor_xss_filter_alter(&$editor_xss_filter_class, FilterFormatInterface $format, ?FilterFormatInterface $original_format = NULL) {
   $filters = $format->filters()->getAll();
   if (isset($filters['filter_wysiwyg']) && $filters['filter_wysiwyg']->status) {
     $editor_xss_filter_class = '\Drupal\filter_wysiwyg\EditorXssFilter\WysiwygFilter';
diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module
index 7e0d17c668f6..b4a72ce05d1e 100644
--- a/core/modules/editor/editor.module
+++ b/core/modules/editor/editor.module
@@ -305,7 +305,7 @@ function editor_load($format_id) {
  *
  * @see https://www.drupal.org/node/2099741
  */
-function editor_filter_xss($html, FilterFormatInterface $format = NULL, FilterFormatInterface $original_format = NULL) {
+function editor_filter_xss($html, ?FilterFormatInterface $format = NULL, ?FilterFormatInterface $original_format = NULL) {
   $editor = $format ? editor_load($format->id()) : NULL;
 
   // If no text editor is associated with this text format or the previously
diff --git a/core/modules/editor/src/EditorXssFilter/Standard.php b/core/modules/editor/src/EditorXssFilter/Standard.php
index e08f1ba18eda..c448765cdbf3 100644
--- a/core/modules/editor/src/EditorXssFilter/Standard.php
+++ b/core/modules/editor/src/EditorXssFilter/Standard.php
@@ -15,7 +15,7 @@ class Standard extends Xss implements EditorXssFilterInterface {
   /**
    * {@inheritdoc}
    */
-  public static function filterXss($html, FilterFormatInterface $format, FilterFormatInterface $original_format = NULL) {
+  public static function filterXss($html, FilterFormatInterface $format, ?FilterFormatInterface $original_format = NULL) {
     // Apply XSS filtering, but blacklist the <script>, <style>, <link>, <embed>
     // and <object> tags.
     // The <script> and <style> tags are blacklisted because their contents
diff --git a/core/modules/editor/src/EditorXssFilterInterface.php b/core/modules/editor/src/EditorXssFilterInterface.php
index 45e03ab6c54b..d710774d5a3d 100644
--- a/core/modules/editor/src/EditorXssFilterInterface.php
+++ b/core/modules/editor/src/EditorXssFilterInterface.php
@@ -37,6 +37,6 @@ interface EditorXssFilterInterface {
    * @return string
    *   The filtered HTML that cannot cause any XSS anymore.
    */
-  public static function filterXss($html, FilterFormatInterface $format, FilterFormatInterface $original_format = NULL);
+  public static function filterXss($html, FilterFormatInterface $format, ?FilterFormatInterface $original_format = NULL);
 
 }
diff --git a/core/modules/editor/tests/modules/editor_test/editor_test.module b/core/modules/editor/tests/modules/editor_test/editor_test.module
index bdb7292d62a8..63608e1e703a 100644
--- a/core/modules/editor/tests/modules/editor_test/editor_test.module
+++ b/core/modules/editor/tests/modules/editor_test/editor_test.module
@@ -61,7 +61,7 @@ function editor_test_editor_js_settings_alter(&$settings) {
 /**
  * Implements hook_editor_xss_filter_alter().
  */
-function editor_test_editor_xss_filter_alter(&$editor_xss_filter_class, FilterFormatInterface $format, FilterFormatInterface $original_format = NULL) {
+function editor_test_editor_xss_filter_alter(&$editor_xss_filter_class, FilterFormatInterface $format, ?FilterFormatInterface $original_format = NULL) {
   // Allow tests to enable or disable this alter hook.
   if (!\Drupal::state()->get('editor_test_editor_xss_filter_alter_enabled', FALSE)) {
     return;
diff --git a/core/modules/editor/tests/modules/editor_test/src/EditorXssFilter/Insecure.php b/core/modules/editor/tests/modules/editor_test/src/EditorXssFilter/Insecure.php
index 41ba6a4f9a9f..af7cf6f46020 100644
--- a/core/modules/editor/tests/modules/editor_test/src/EditorXssFilter/Insecure.php
+++ b/core/modules/editor/tests/modules/editor_test/src/EditorXssFilter/Insecure.php
@@ -13,7 +13,7 @@ class Insecure implements EditorXssFilterInterface {
   /**
    * {@inheritdoc}
    */
-  public static function filterXss($html, FilterFormatInterface $format, FilterFormatInterface $original_format = NULL) {
+  public static function filterXss($html, FilterFormatInterface $format, ?FilterFormatInterface $original_format = NULL) {
     // Don't apply any XSS filtering, just return the string we received.
     return $html;
   }
diff --git a/core/modules/field/src/Plugin/migrate/process/FieldType.php b/core/modules/field/src/Plugin/migrate/process/FieldType.php
index 979b0ea49cae..a4410b211983 100644
--- a/core/modules/field/src/Plugin/migrate/process/FieldType.php
+++ b/core/modules/field/src/Plugin/migrate/process/FieldType.php
@@ -43,7 +43,7 @@ class FieldType extends StaticMap implements ContainerFactoryPluginInterface {
    * @param \Drupal\migrate\Plugin\MigrationInterface $migration
    *   The migration being run.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateFieldPluginManagerInterface $field_plugin_manager, MigrationInterface $migration = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateFieldPluginManagerInterface $field_plugin_manager, ?MigrationInterface $migration = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->fieldPluginManager = $field_plugin_manager;
     $this->migration = $migration;
@@ -52,7 +52,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/field/src/Plugin/migrate/process/ProcessField.php b/core/modules/field/src/Plugin/migrate/process/ProcessField.php
index ac86816161fa..80bf82543657 100644
--- a/core/modules/field/src/Plugin/migrate/process/ProcessField.php
+++ b/core/modules/field/src/Plugin/migrate/process/ProcessField.php
@@ -69,7 +69,7 @@ class ProcessField extends ProcessPluginBase implements ContainerFactoryPluginIn
    * @param \Drupal\migrate\Plugin\MigrationInterface $migration
    *   The migration being run.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateFieldPluginManagerInterface $field_plugin_manager, MigrationInterface $migration = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateFieldPluginManagerInterface $field_plugin_manager, ?MigrationInterface $migration = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->fieldPluginManager = $field_plugin_manager;
     $this->migration = $migration;
@@ -78,7 +78,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/field/src/Plugin/migrate/process/d7/FieldBundle.php b/core/modules/field/src/Plugin/migrate/process/d7/FieldBundle.php
index d5b2e30075b6..2bee0b4e5d95 100644
--- a/core/modules/field/src/Plugin/migrate/process/d7/FieldBundle.php
+++ b/core/modules/field/src/Plugin/migrate/process/d7/FieldBundle.php
@@ -82,7 +82,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/field/tests/modules/field_test/field_test.field.inc b/core/modules/field/tests/modules/field_test/field_test.field.inc
index df5fc26ac2a3..37f002d4b441 100644
--- a/core/modules/field/tests/modules/field_test/field_test.field.inc
+++ b/core/modules/field/tests/modules/field_test/field_test.field.inc
@@ -47,7 +47,7 @@ function field_test_default_value(FieldableEntityInterface $entity, FieldDefinit
 /**
  * Implements hook_entity_field_access().
  */
-function field_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function field_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   if ($field_definition->getName() == "field_no_{$operation}_access") {
     return AccessResult::forbidden();
   }
diff --git a/core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php b/core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php
index 765c39559829..90d07c4be646 100644
--- a/core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php
+++ b/core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php
@@ -25,7 +25,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity_1 = NULL, EntityInterface $entity_2 = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?EntityInterface $entity_1 = NULL, ?EntityInterface $entity_2 = NULL) {
     // First entity.
     $form_state->set('entity_1', $entity_1);
     $form_display_1 = EntityFormDisplay::collectRenderDisplay($entity_1, 'default');
diff --git a/core/modules/field/tests/modules/field_test_boolean_access_denied/field_test_boolean_access_denied.module b/core/modules/field/tests/modules/field_test_boolean_access_denied/field_test_boolean_access_denied.module
index e1ae2f737997..fe205734d18d 100644
--- a/core/modules/field/tests/modules/field_test_boolean_access_denied/field_test_boolean_access_denied.module
+++ b/core/modules/field/tests/modules/field_test_boolean_access_denied/field_test_boolean_access_denied.module
@@ -13,6 +13,6 @@
 /**
  * Implements hook_entity_field_access().
  */
-function field_test_boolean_access_denied_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function field_test_boolean_access_denied_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   return AccessResult::forbiddenIf($field_definition->getName() === \Drupal::state()->get('field.test_boolean_field_access_field'));
 }
diff --git a/core/modules/field_layout/src/Form/FieldLayoutEntityFormDisplayEditForm.php b/core/modules/field_layout/src/Form/FieldLayoutEntityFormDisplayEditForm.php
index bb8bc221ea41..eed508539e81 100644
--- a/core/modules/field_layout/src/Form/FieldLayoutEntityFormDisplayEditForm.php
+++ b/core/modules/field_layout/src/Form/FieldLayoutEntityFormDisplayEditForm.php
@@ -33,7 +33,7 @@ class FieldLayoutEntityFormDisplayEditForm extends EntityFormDisplayEditForm {
    * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
    *   The entity field manager.
    */
-  public function __construct(FieldTypePluginManagerInterface $field_type_manager, PluginManagerBase $plugin_manager, LayoutPluginManagerInterface $layout_plugin_manager, EntityDisplayRepositoryInterface $entity_display_repository = NULL, EntityFieldManagerInterface $entity_field_manager = NULL) {
+  public function __construct(FieldTypePluginManagerInterface $field_type_manager, PluginManagerBase $plugin_manager, LayoutPluginManagerInterface $layout_plugin_manager, ?EntityDisplayRepositoryInterface $entity_display_repository = NULL, ?EntityFieldManagerInterface $entity_field_manager = NULL) {
     parent::__construct($field_type_manager, $plugin_manager, $entity_display_repository, $entity_field_manager);
     $this->layoutPluginManager = $layout_plugin_manager;
   }
diff --git a/core/modules/field_layout/src/Form/FieldLayoutEntityViewDisplayEditForm.php b/core/modules/field_layout/src/Form/FieldLayoutEntityViewDisplayEditForm.php
index 628b1ae91715..77a7ecd9e20a 100644
--- a/core/modules/field_layout/src/Form/FieldLayoutEntityViewDisplayEditForm.php
+++ b/core/modules/field_layout/src/Form/FieldLayoutEntityViewDisplayEditForm.php
@@ -33,7 +33,7 @@ class FieldLayoutEntityViewDisplayEditForm extends EntityViewDisplayEditForm {
    * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
    *   The entity field manager.
    */
-  public function __construct(FieldTypePluginManagerInterface $field_type_manager, PluginManagerBase $plugin_manager, LayoutPluginManagerInterface $layout_plugin_manager, EntityDisplayRepositoryInterface $entity_display_repository = NULL, EntityFieldManagerInterface $entity_field_manager = NULL) {
+  public function __construct(FieldTypePluginManagerInterface $field_type_manager, PluginManagerBase $plugin_manager, LayoutPluginManagerInterface $layout_plugin_manager, ?EntityDisplayRepositoryInterface $entity_display_repository = NULL, ?EntityFieldManagerInterface $entity_field_manager = NULL) {
     parent::__construct($field_type_manager, $plugin_manager, $entity_display_repository, $entity_field_manager);
     $this->layoutPluginManager = $layout_plugin_manager;
   }
diff --git a/core/modules/field_ui/src/Access/FieldReuseAccessCheck.php b/core/modules/field_ui/src/Access/FieldReuseAccessCheck.php
index 4c923a62ec7e..db69c94a6903 100644
--- a/core/modules/field_ui/src/Access/FieldReuseAccessCheck.php
+++ b/core/modules/field_ui/src/Access/FieldReuseAccessCheck.php
@@ -54,7 +54,7 @@ public function __construct(
    * @return \Drupal\Core\Access\AccessResultInterface
    *   The access result.
    */
-  public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account, string $bundle = NULL): AccessResultInterface {
+  public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account, ?string $bundle = NULL): AccessResultInterface {
     $access = AccessResult::neutral();
     if ($entity_type_id = $route->getDefault('entity_type_id')) {
       if (empty($bundle)) {
diff --git a/core/modules/field_ui/src/Controller/FieldConfigListController.php b/core/modules/field_ui/src/Controller/FieldConfigListController.php
index ecfb44964ba1..0fa44813c568 100644
--- a/core/modules/field_ui/src/Controller/FieldConfigListController.php
+++ b/core/modules/field_ui/src/Controller/FieldConfigListController.php
@@ -24,7 +24,7 @@ class FieldConfigListController extends EntityListController {
    *   A render array as expected by
    *   \Drupal\Core\Render\RendererInterface::render().
    */
-  public function listing($entity_type_id = NULL, $bundle = NULL, RouteMatchInterface $route_match = NULL) {
+  public function listing($entity_type_id = NULL, $bundle = NULL, ?RouteMatchInterface $route_match = NULL) {
     return $this->entityTypeManager()->getListBuilder('field_config')->render($entity_type_id, $bundle);
   }
 
diff --git a/core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php b/core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php
index 19ad69d038ba..eab628e0a101 100644
--- a/core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php
+++ b/core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php
@@ -69,7 +69,7 @@ public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entit
    * @param \Drupal\field\FieldConfigInterface|string $field_config
    *   The ID of the field config whose field storage config is being edited.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, FieldConfigInterface|string $field_config = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, FieldConfigInterface|string|null $field_config = NULL) {
     if ($field_config) {
       $field = $field_config;
       if (is_string($field)) {
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 44bc5135ec2b..d59cc8dc2e05 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -983,7 +983,7 @@ function template_preprocess_file_upload_help(&$variables) {
  *
  * @ingroup file
  */
-function file_get_file_references(FileInterface $file, FieldDefinitionInterface $field = NULL, $age = EntityStorageInterface::FIELD_LOAD_REVISION, $field_type = 'file') {
+function file_get_file_references(FileInterface $file, ?FieldDefinitionInterface $field = NULL, $age = EntityStorageInterface::FIELD_LOAD_REVISION, $field_type = 'file') {
   $references = &drupal_static(__FUNCTION__, []);
   $field_columns = &drupal_static(__FUNCTION__ . ':field_columns', []);
 
diff --git a/core/modules/file/src/FileAccessControlHandler.php b/core/modules/file/src/FileAccessControlHandler.php
index c8870ba26da9..7d64ec75464b 100644
--- a/core/modules/file/src/FileAccessControlHandler.php
+++ b/core/modules/file/src/FileAccessControlHandler.php
@@ -100,7 +100,7 @@ protected function getFileReferences(FileInterface $file) {
   /**
    * {@inheritdoc}
    */
-  protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+  protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
     // Deny access to fields that should only be set on file creation, and
     // "status" which should only be changed based on a file's usage.
     $create_only_fields = [
diff --git a/core/modules/file/src/Plugin/migrate/process/d6/FieldFile.php b/core/modules/file/src/Plugin/migrate/process/d6/FieldFile.php
index b91dc08e90f2..ab2baa5d6d0e 100644
--- a/core/modules/file/src/Plugin/migrate/process/d6/FieldFile.php
+++ b/core/modules/file/src/Plugin/migrate/process/d6/FieldFile.php
@@ -50,7 +50,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/file/src/Plugin/views/field/File.php b/core/modules/file/src/Plugin/views/field/File.php
index 1002880d5fd9..12e01ce1d04d 100644
--- a/core/modules/file/src/Plugin/views/field/File.php
+++ b/core/modules/file/src/Plugin/views/field/File.php
@@ -53,7 +53,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if (!empty($options['link_to_file'])) {
diff --git a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
index 09b1c7a9c7c4..133d5c208a24 100644
--- a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
@@ -56,7 +56,7 @@ protected function setUp(): void {
    * @return \Drupal\file\FileInterface
    *   A file object, or FALSE on error.
    */
-  protected function createTemporaryFile($data, UserInterface $user = NULL) {
+  protected function createTemporaryFile($data, ?UserInterface $user = NULL) {
     /** @var \Drupal\file\FileRepositoryInterface $file_repository */
     $file_repository = \Drupal::service('file.repository');
     $file = $file_repository->writeData($data, "public://");
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index 2ba66da8085e..987d52db52e7 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -95,7 +95,7 @@ function filter_theme() {
  *
  * @see filter_formats_reset()
  */
-function filter_formats(AccountInterface $account = NULL) {
+function filter_formats(?AccountInterface $account = NULL) {
   $formats = &drupal_static(__FUNCTION__, []);
 
   // All available formats are cached for performance.
@@ -209,7 +209,7 @@ function filter_get_formats_by_role($rid) {
  *
  * @see filter_fallback_format()
  */
-function filter_default_format(AccountInterface $account = NULL) {
+function filter_default_format(?AccountInterface $account = NULL) {
   if (!isset($account)) {
     $account = \Drupal::currentUser();
   }
diff --git a/core/modules/filter/src/Controller/FilterController.php b/core/modules/filter/src/Controller/FilterController.php
index 8052e4c8b756..4a9dcbd4dfac 100644
--- a/core/modules/filter/src/Controller/FilterController.php
+++ b/core/modules/filter/src/Controller/FilterController.php
@@ -21,7 +21,7 @@ class FilterController {
    *
    * @see template_preprocess_filter_tips()
    */
-  public function filterTips(FilterFormatInterface $filter_format = NULL) {
+  public function filterTips(?FilterFormatInterface $filter_format = NULL) {
     $tips = $filter_format ? $filter_format->id() : -1;
 
     $build = [
diff --git a/core/modules/filter/src/Plugin/DataType/FilterFormat.php b/core/modules/filter/src/Plugin/DataType/FilterFormat.php
index 451a9613ed03..cfc77ac97a72 100644
--- a/core/modules/filter/src/Plugin/DataType/FilterFormat.php
+++ b/core/modules/filter/src/Plugin/DataType/FilterFormat.php
@@ -20,14 +20,14 @@ class FilterFormat extends StringData implements OptionsProviderInterface {
   /**
    * {@inheritdoc}
    */
-  public function getPossibleValues(AccountInterface $account = NULL) {
+  public function getPossibleValues(?AccountInterface $account = NULL) {
     return array_keys($this->getPossibleOptions($account));
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getPossibleOptions(AccountInterface $account = NULL) {
+  public function getPossibleOptions(?AccountInterface $account = NULL) {
     return array_map(function ($format) {
       return $format->label();
     }, filter_formats());
@@ -36,14 +36,14 @@ public function getPossibleOptions(AccountInterface $account = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function getSettableValues(AccountInterface $account = NULL) {
+  public function getSettableValues(?AccountInterface $account = NULL) {
     return array_keys($this->getSettableOptions($account));
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getSettableOptions(AccountInterface $account = NULL) {
+  public function getSettableOptions(?AccountInterface $account = NULL) {
     // @todo: Avoid calling functions but move to injected dependencies.
     return array_map(function ($format) {
       return $format->label();
diff --git a/core/modules/filter/src/Plugin/Filter/FilterCaption.php b/core/modules/filter/src/Plugin/Filter/FilterCaption.php
index 692ff827b963..1886fb7739ed 100644
--- a/core/modules/filter/src/Plugin/Filter/FilterCaption.php
+++ b/core/modules/filter/src/Plugin/Filter/FilterCaption.php
@@ -45,7 +45,7 @@ class FilterCaption extends FilterBase implements ContainerFactoryPluginInterfac
    * @param \Drupal\filter\FilterPluginManager $filter_manager
    *   Filter plugin manager.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, FilterPluginManager $filter_manager = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, ?FilterPluginManager $filter_manager = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->filterManager = $filter_manager ?: \Drupal::service('plugin.manager.filter');
   }
diff --git a/core/modules/filter/src/Plugin/migrate/process/FilterID.php b/core/modules/filter/src/Plugin/migrate/process/FilterID.php
index 98d71db39c1a..f88c1fa830b1 100644
--- a/core/modules/filter/src/Plugin/migrate/process/FilterID.php
+++ b/core/modules/filter/src/Plugin/migrate/process/FilterID.php
@@ -46,7 +46,7 @@ class FilterID extends StaticMap implements ContainerFactoryPluginInterface {
    * @param \Drupal\Core\StringTranslation\TranslationInterface $translator
    *   (optional) The string translation service.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, PluginManagerInterface $filter_manager, TranslationInterface $translator = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, PluginManagerInterface $filter_manager, ?TranslationInterface $translator = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->filterManager = $filter_manager;
     $this->stringTranslation = $translator;
diff --git a/core/modules/filter/src/Plugin/migrate/process/d6/FilterFormatPermission.php b/core/modules/filter/src/Plugin/migrate/process/d6/FilterFormatPermission.php
index f907c2e3f400..6b6dd84b730c 100644
--- a/core/modules/filter/src/Plugin/migrate/process/d6/FilterFormatPermission.php
+++ b/core/modules/filter/src/Plugin/migrate/process/d6/FilterFormatPermission.php
@@ -76,7 +76,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/help/src/Plugin/Search/HelpSearch.php b/core/modules/help/src/Plugin/Search/HelpSearch.php
index 3d04ee86357e..89bd8bf95598 100644
--- a/core/modules/help/src/Plugin/Search/HelpSearch.php
+++ b/core/modules/help/src/Plugin/Search/HelpSearch.php
@@ -158,7 +158,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation = 'view', ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $result = AccessResult::allowedIfHasPermission($account, 'access help pages');
     return $return_as_object ? $result : $result->isAllowed();
   }
diff --git a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php
index 5af925479d2a..a8bc97091934 100644
--- a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php
+++ b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php
@@ -30,7 +30,7 @@ public function usesGroupBy() {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if (\Drupal::currentUser()->isAuthenticated()) {
diff --git a/core/modules/image/src/Form/ImageEffectAddForm.php b/core/modules/image/src/Form/ImageEffectAddForm.php
index 42411ef4cbe5..3bc244daf1cf 100644
--- a/core/modules/image/src/Form/ImageEffectAddForm.php
+++ b/core/modules/image/src/Form/ImageEffectAddForm.php
@@ -43,7 +43,7 @@ public static function create(ContainerInterface $container) {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
     $form = parent::buildForm($form, $form_state, $image_style, $image_effect);
 
     $form['#title'] = $this->t('Add %label effect to style %style', [
diff --git a/core/modules/image/src/Form/ImageEffectDeleteForm.php b/core/modules/image/src/Form/ImageEffectDeleteForm.php
index cc8dbb6c9b3a..048feb2a2380 100644
--- a/core/modules/image/src/Form/ImageEffectDeleteForm.php
+++ b/core/modules/image/src/Form/ImageEffectDeleteForm.php
@@ -58,7 +58,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
     $this->imageStyle = $image_style;
     $this->imageEffect = $this->imageStyle->getEffect($image_effect);
 
diff --git a/core/modules/image/src/Form/ImageEffectEditForm.php b/core/modules/image/src/Form/ImageEffectEditForm.php
index 158e9a109b33..abbd823ab8c8 100644
--- a/core/modules/image/src/Form/ImageEffectEditForm.php
+++ b/core/modules/image/src/Form/ImageEffectEditForm.php
@@ -15,7 +15,7 @@ class ImageEffectEditForm extends ImageEffectFormBase {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
     $form = parent::buildForm($form, $form_state, $image_style, $image_effect);
 
     $form['#title'] = $this->t('Edit %label effect on style %style', [
diff --git a/core/modules/image/src/Form/ImageEffectFormBase.php b/core/modules/image/src/Form/ImageEffectFormBase.php
index 69ce18ad78fc..1e9cd77c898d 100644
--- a/core/modules/image/src/Form/ImageEffectFormBase.php
+++ b/core/modules/image/src/Form/ImageEffectFormBase.php
@@ -53,7 +53,7 @@ public function getFormId() {
    *
    * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
    */
-  public function buildForm(array $form, FormStateInterface $form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
     $this->imageStyle = $image_style;
     try {
       $this->imageEffect = $this->prepareImageEffect($image_effect);
diff --git a/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php b/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
index 568044e21c1e..bae25d84ff24 100644
--- a/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
+++ b/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
@@ -48,7 +48,7 @@ class ImageWidget extends FileWidget {
    * @param \Drupal\Core\Image\ImageFactory $image_factory
    *   The image factory service.
    */
-  public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, ElementInfoManagerInterface $element_info, ImageFactory $image_factory = NULL) {
+  public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, ElementInfoManagerInterface $element_info, ?ImageFactory $image_factory = NULL) {
     parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings, $element_info);
     $this->imageFactory = $image_factory ?: \Drupal::service('image.factory');
   }
diff --git a/core/modules/image/tests/modules/image_access_test_hidden/image_access_test_hidden.module b/core/modules/image/tests/modules/image_access_test_hidden/image_access_test_hidden.module
index 1050d6ad0bec..177714c125a1 100644
--- a/core/modules/image/tests/modules/image_access_test_hidden/image_access_test_hidden.module
+++ b/core/modules/image/tests/modules/image_access_test_hidden/image_access_test_hidden.module
@@ -13,7 +13,7 @@
 /**
  * Implements hook_entity_field_access().
  */
-function image_access_test_hidden_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function image_access_test_hidden_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   if ($field_definition->getName() == 'field_image' && $operation == 'edit') {
     return AccessResult::forbidden();
   }
diff --git a/core/modules/jsonapi/src/Access/EntityAccessChecker.php b/core/modules/jsonapi/src/Access/EntityAccessChecker.php
index a76447f38292..9dd77cb01375 100644
--- a/core/modules/jsonapi/src/Access/EntityAccessChecker.php
+++ b/core/modules/jsonapi/src/Access/EntityAccessChecker.php
@@ -119,7 +119,7 @@ public function setLatestRevisionCheck(LatestRevisionCheck $latest_revision_chec
    *   EntityAccessDeniedHttpException object if neither is accessible. All
    *   three possible return values carry the access result cacheability.
    */
-  public function getAccessCheckedResourceObject(EntityInterface $entity, AccountInterface $account = NULL) {
+  public function getAccessCheckedResourceObject(EntityInterface $entity, ?AccountInterface $account = NULL) {
     $account = $account ?: $this->currentUser;
     $resource_type = $this->resourceTypeRepository->get($entity->getEntityTypeId(), $entity->bundle());
     $entity = $this->entityRepository->getTranslationFromContext($entity, NULL, ['operation' => 'entity_upcast']);
diff --git a/core/modules/jsonapi/src/Access/RelationshipRouteAccessCheck.php b/core/modules/jsonapi/src/Access/RelationshipRouteAccessCheck.php
index 6ecaa1aca88e..efc7a366e4ed 100644
--- a/core/modules/jsonapi/src/Access/RelationshipRouteAccessCheck.php
+++ b/core/modules/jsonapi/src/Access/RelationshipRouteAccessCheck.php
@@ -60,7 +60,7 @@ public function __construct(EntityAccessChecker $entity_access_checker) {
    * @return \Drupal\Core\Access\AccessResultInterface
    *   The access result.
    */
-  public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account = NULL) {
+  public function access(Route $route, RouteMatchInterface $route_match, ?AccountInterface $account = NULL) {
     [$relationship_field_name, $field_operation] = explode('.', $route->getRequirement(static::ROUTE_REQUIREMENT_KEY));
     assert(in_array($field_operation, ['view', 'edit'], TRUE));
     $entity_operation = $field_operation === 'view' ? 'view' : 'update';
diff --git a/core/modules/jsonapi/src/Access/TemporaryQueryGuard.php b/core/modules/jsonapi/src/Access/TemporaryQueryGuard.php
index 4ca5b544369a..b77fe9e0b95b 100644
--- a/core/modules/jsonapi/src/Access/TemporaryQueryGuard.php
+++ b/core/modules/jsonapi/src/Access/TemporaryQueryGuard.php
@@ -119,7 +119,7 @@ public static function applyAccessControls(Filter $filter, QueryInterface $query
    * @see \Drupal\Core\Database\Query\AlterableInterface::addMetaData()
    * @see \Drupal\Core\Database\Query\ConditionInterface
    */
-  protected static function secureQuery(QueryInterface $query, $entity_type_id, array $tree, CacheableMetadata $cacheability, $field_prefix = NULL, FieldStorageDefinitionInterface $field_storage_definition = NULL) {
+  protected static function secureQuery(QueryInterface $query, $entity_type_id, array $tree, CacheableMetadata $cacheability, $field_prefix = NULL, ?FieldStorageDefinitionInterface $field_storage_definition = NULL) {
     $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
     // Config entity types are not fieldable, therefore they do not have field
     // access restrictions, nor entity references to other entity types.
diff --git a/core/modules/jsonapi/src/Controller/EntityResource.php b/core/modules/jsonapi/src/Controller/EntityResource.php
index f63ccf09df9e..e19ef84866f2 100644
--- a/core/modules/jsonapi/src/Controller/EntityResource.php
+++ b/core/modules/jsonapi/src/Controller/EntityResource.php
@@ -1011,7 +1011,7 @@ protected static function relationshipResponseRequiresBody(array $received_resou
    * @return \Drupal\jsonapi\ResourceResponse
    *   The response.
    */
-  protected function buildWrappedResponse(TopLevelDataInterface $data, Request $request, IncludedData $includes, $response_code = 200, array $headers = [], LinkCollection $links = NULL, array $meta = []) {
+  protected function buildWrappedResponse(TopLevelDataInterface $data, Request $request, IncludedData $includes, $response_code = 200, array $headers = [], ?LinkCollection $links = NULL, array $meta = []) {
     $links = ($links ?: new LinkCollection([]));
     if (!$links->hasLinkWithKey('self')) {
       $self_link = new Link(new CacheableMetadata(), self::getRequestLink($request), 'self');
diff --git a/core/modules/jsonapi/src/Controller/FileUpload.php b/core/modules/jsonapi/src/Controller/FileUpload.php
index 78767040652c..7e869a0d5197 100644
--- a/core/modules/jsonapi/src/Controller/FileUpload.php
+++ b/core/modules/jsonapi/src/Controller/FileUpload.php
@@ -234,7 +234,7 @@ protected function handleFileUploadForResource(Request $request, ResourceType $r
    * @return \Drupal\Core\Access\AccessResultInterface
    *   The file upload access result.
    */
-  public static function checkFileUploadAccess(AccountInterface $account, FieldDefinitionInterface $field_definition, EntityInterface $entity = NULL) {
+  public static function checkFileUploadAccess(AccountInterface $account, FieldDefinitionInterface $field_definition, ?EntityInterface $entity = NULL) {
     assert(is_null($entity) ||
       $field_definition->getTargetEntityTypeId() === $entity->getEntityTypeId() &&
       // Base fields do not have target bundles.
@@ -260,7 +260,7 @@ public static function checkFileUploadAccess(AccountInterface $account, FieldDef
    * @param \Drupal\Core\Entity\FieldableEntityInterface|null $entity
    *   The entity, if one exists, for which the file is to be uploaded.
    */
-  protected static function ensureFileUploadAccess(AccountInterface $account, FieldDefinitionInterface $field_definition, FieldableEntityInterface $entity = NULL) {
+  protected static function ensureFileUploadAccess(AccountInterface $account, FieldDefinitionInterface $field_definition, ?FieldableEntityInterface $entity = NULL) {
     $access_result = $entity
       ? static::checkFileUploadAccess($account, $field_definition, $entity)
       : static::checkFileUploadAccess($account, $field_definition);
diff --git a/core/modules/jsonapi/src/Entity/EntityValidationTrait.php b/core/modules/jsonapi/src/Entity/EntityValidationTrait.php
index 99291254cad2..96d8bc918512 100644
--- a/core/modules/jsonapi/src/Entity/EntityValidationTrait.php
+++ b/core/modules/jsonapi/src/Entity/EntityValidationTrait.php
@@ -32,7 +32,7 @@ trait EntityValidationTrait {
    *
    * @see \Drupal\rest\Plugin\rest\resource\EntityResourceValidationTrait::validate()
    */
-  protected static function validate(EntityInterface $entity, array $field_names = NULL) {
+  protected static function validate(EntityInterface $entity, ?array $field_names = NULL) {
     if (!$entity instanceof FieldableEntityInterface) {
       return;
     }
diff --git a/core/modules/jsonapi/src/EventSubscriber/ResourceResponseValidator.php b/core/modules/jsonapi/src/EventSubscriber/ResourceResponseValidator.php
index 0d1d0cef219c..1e3ad6a20e30 100644
--- a/core/modules/jsonapi/src/EventSubscriber/ResourceResponseValidator.php
+++ b/core/modules/jsonapi/src/EventSubscriber/ResourceResponseValidator.php
@@ -84,7 +84,7 @@ public static function getSubscribedEvents(): array {
   /**
    * Sets the validator service if available.
    */
-  public function setValidator(Validator $validator = NULL) {
+  public function setValidator(?Validator $validator = NULL) {
     if ($validator) {
       $this->validator = $validator;
     }
diff --git a/core/modules/jsonapi/src/Exception/EntityAccessDeniedHttpException.php b/core/modules/jsonapi/src/Exception/EntityAccessDeniedHttpException.php
index 74ab245e5114..a2b21ca82d20 100644
--- a/core/modules/jsonapi/src/Exception/EntityAccessDeniedHttpException.php
+++ b/core/modules/jsonapi/src/Exception/EntityAccessDeniedHttpException.php
@@ -58,7 +58,7 @@ class EntityAccessDeniedHttpException extends CacheableAccessDeniedHttpException
    * @param int $code
    *   The code.
    */
-  public function __construct($entity, AccessResultInterface $entity_access, $pointer, $message = 'The current user is not allowed to GET the selected resource.', $relationship_field = NULL, \Exception $previous = NULL, $code = 0) {
+  public function __construct($entity, AccessResultInterface $entity_access, $pointer, $message = 'The current user is not allowed to GET the selected resource.', $relationship_field = NULL, ?\Exception $previous = NULL, $code = 0) {
     assert(is_null($entity) || $entity instanceof EntityInterface);
     parent::__construct(CacheableMetadata::createFromObject($entity_access), $message, $previous, $code);
     $error = [
diff --git a/core/modules/jsonapi/src/Exception/UnprocessableHttpEntityException.php b/core/modules/jsonapi/src/Exception/UnprocessableHttpEntityException.php
index b9d5a6f58389..4dce06e1e63d 100644
--- a/core/modules/jsonapi/src/Exception/UnprocessableHttpEntityException.php
+++ b/core/modules/jsonapi/src/Exception/UnprocessableHttpEntityException.php
@@ -42,7 +42,7 @@ class UnprocessableHttpEntityException extends HttpException {
    * @param int $code
    *   The HTTP status code associated with the request. Defaults to zero.
    */
-  public function __construct(\Exception $previous = NULL, array $headers = [], $code = 0) {
+  public function __construct(?\Exception $previous = NULL, array $headers = [], $code = 0) {
     parent::__construct(422, "Unprocessable Entity: validation failed.", $previous, $headers, $code);
   }
 
diff --git a/core/modules/jsonapi/src/IncludeResolver.php b/core/modules/jsonapi/src/IncludeResolver.php
index 9a77602d3659..bbc5d46e7d13 100644
--- a/core/modules/jsonapi/src/IncludeResolver.php
+++ b/core/modules/jsonapi/src/IncludeResolver.php
@@ -98,7 +98,7 @@ public function resolve($data, $include_parameter) {
    * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
    *   Thrown if a storage handler couldn't be loaded.
    */
-  protected function resolveIncludeTree(array $include_tree, Data $data, Data $includes = NULL) {
+  protected function resolveIncludeTree(array $include_tree, Data $data, ?Data $includes = NULL) {
     $includes = is_null($includes) ? new IncludedData([]) : $includes;
     foreach ($include_tree as $field_name => $children) {
       $references = [];
diff --git a/core/modules/jsonapi/src/JsonApiResource/LabelOnlyResourceObject.php b/core/modules/jsonapi/src/JsonApiResource/LabelOnlyResourceObject.php
index 1beaa23056ed..8100528edef6 100644
--- a/core/modules/jsonapi/src/JsonApiResource/LabelOnlyResourceObject.php
+++ b/core/modules/jsonapi/src/JsonApiResource/LabelOnlyResourceObject.php
@@ -27,7 +27,7 @@ final class LabelOnlyResourceObject extends ResourceObject {
   /**
    * {@inheritdoc}
    */
-  public static function createFromEntity(ResourceType $resource_type, EntityInterface $entity, LinkCollection $links = NULL) {
+  public static function createFromEntity(ResourceType $resource_type, EntityInterface $entity, ?LinkCollection $links = NULL) {
     $resource_object = new static(
       $entity,
       $resource_type,
diff --git a/core/modules/jsonapi/src/JsonApiResource/Relationship.php b/core/modules/jsonapi/src/JsonApiResource/Relationship.php
index b5a383ea89c9..f63757df9303 100644
--- a/core/modules/jsonapi/src/JsonApiResource/Relationship.php
+++ b/core/modules/jsonapi/src/JsonApiResource/Relationship.php
@@ -115,7 +115,7 @@ protected function __construct($public_field_name, RelationshipData $data, LinkC
    * @return static
    *   An instantiated relationship object.
    */
-  public static function createFromEntityReferenceField(ResourceObject $context, EntityReferenceFieldItemListInterface $field, LinkCollection $links = NULL, array $meta = []) {
+  public static function createFromEntityReferenceField(ResourceObject $context, EntityReferenceFieldItemListInterface $field, ?LinkCollection $links = NULL, array $meta = []) {
     $context_resource_type = $context->getResourceType();
     $resource_field = $context_resource_type->getFieldByInternalName($field->getName());
     return new static(
diff --git a/core/modules/jsonapi/src/JsonApiResource/ResourceObject.php b/core/modules/jsonapi/src/JsonApiResource/ResourceObject.php
index add89868f722..5ebba7c50228 100644
--- a/core/modules/jsonapi/src/JsonApiResource/ResourceObject.php
+++ b/core/modules/jsonapi/src/JsonApiResource/ResourceObject.php
@@ -88,7 +88,7 @@ class ResourceObject implements CacheableDependencyInterface, ResourceIdentifier
    * @param \Drupal\Core\Language\LanguageInterface|null $language
    *   (optional) The resource language.
    */
-  public function __construct(CacheableDependencyInterface $cacheability, ResourceType $resource_type, $id, $revision_id, array $fields, LinkCollection $links, LanguageInterface $language = NULL) {
+  public function __construct(CacheableDependencyInterface $cacheability, ResourceType $resource_type, $id, $revision_id, array $fields, LinkCollection $links, ?LanguageInterface $language = NULL) {
     assert(is_null($revision_id) || $resource_type->isVersionable());
     $this->setCacheability($cacheability);
     $this->resourceType = $resource_type;
@@ -117,7 +117,7 @@ public function __construct(CacheableDependencyInterface $cacheability, Resource
    * @return static
    *   An instantiated resource object.
    */
-  public static function createFromEntity(ResourceType $resource_type, EntityInterface $entity, LinkCollection $links = NULL) {
+  public static function createFromEntity(ResourceType $resource_type, EntityInterface $entity, ?LinkCollection $links = NULL) {
     return new static(
       $entity,
       $resource_type,
diff --git a/core/modules/jsonapi/src/Normalizer/EntityDenormalizerBase.php b/core/modules/jsonapi/src/Normalizer/EntityDenormalizerBase.php
index 8a78cc68013c..1d7c4ad84494 100644
--- a/core/modules/jsonapi/src/Normalizer/EntityDenormalizerBase.php
+++ b/core/modules/jsonapi/src/Normalizer/EntityDenormalizerBase.php
@@ -67,7 +67,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Ent
   /**
    * {@inheritdoc}
    */
-  public function supportsNormalization($data, string $format = NULL, array $context = []): bool {
+  public function supportsNormalization($data, ?string $format = NULL, array $context = []): bool {
     return FALSE;
   }
 
diff --git a/core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php b/core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php
index 4dcd68d1daf3..56ddb05d8355 100644
--- a/core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php
+++ b/core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php
@@ -42,7 +42,7 @@ public function __construct(ResourceObjectNormalizationCacher $cacher) {
   /**
    * {@inheritdoc}
    */
-  public function supportsDenormalization($data, string $type, string $format = NULL, array $context = []): bool {
+  public function supportsDenormalization($data, string $type, ?string $format = NULL, array $context = []): bool {
     return FALSE;
   }
 
diff --git a/core/modules/jsonapi/src/Revisions/VersionNotFoundException.php b/core/modules/jsonapi/src/Revisions/VersionNotFoundException.php
index 4074c5b09bab..8e3a680e4fc3 100644
--- a/core/modules/jsonapi/src/Revisions/VersionNotFoundException.php
+++ b/core/modules/jsonapi/src/Revisions/VersionNotFoundException.php
@@ -16,7 +16,7 @@ class VersionNotFoundException extends \InvalidArgumentException {
   /**
    * {@inheritdoc}
    */
-  public function __construct($message = '', $code = 0, \Exception $previous = NULL) {
+  public function __construct($message = '', $code = 0, ?\Exception $previous = NULL) {
     parent::__construct(!is_null($message) ? $message : 'The identified version could not be found.', $code, $previous);
   }
 
diff --git a/core/modules/jsonapi/src/Serializer/Serializer.php b/core/modules/jsonapi/src/Serializer/Serializer.php
index e93243ae6f58..b622f5315e88 100644
--- a/core/modules/jsonapi/src/Serializer/Serializer.php
+++ b/core/modules/jsonapi/src/Serializer/Serializer.php
@@ -80,7 +80,7 @@ public function denormalize($data, $type, $format = NULL, array $context = []):
   /**
    * {@inheritdoc}
    */
-  public function supportsNormalization($data, string $format = NULL, array $context = []): bool {
+  public function supportsNormalization($data, ?string $format = NULL, array $context = []): bool {
     return $this->selfSupportsNormalization($data, $format, $context) || $this->fallbackNormalizer->supportsNormalization($data, $format, $context);
   }
 
@@ -104,7 +104,7 @@ private function selfSupportsNormalization($data, $format = NULL, array $context
   /**
    * {@inheritdoc}
    */
-  public function supportsDenormalization($data, string $type, string $format = NULL, array $context = []): bool {
+  public function supportsDenormalization($data, string $type, ?string $format = NULL, array $context = []): bool {
     return $this->selfSupportsDenormalization($data, $type, $format, $context) || $this->fallbackNormalizer->supportsDenormalization($data, $type, $format, $context);
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/BlockContentTest.php b/core/modules/jsonapi/tests/src/Functional/BlockContentTest.php
index 4a870fdea63c..0b9347d7c899 100644
--- a/core/modules/jsonapi/tests/src/Functional/BlockContentTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/BlockContentTest.php
@@ -238,7 +238,7 @@ protected function getExpectedUnauthorizedAccessCacheability() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheTags(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheTags(?array $sparse_fieldset = NULL) {
     $tags = parent::getExpectedCacheTags($sparse_fieldset);
     if ($sparse_fieldset === NULL || in_array('body', $sparse_fieldset)) {
       $tags = Cache::mergeTags($tags, ['config:filter.format.plain_text']);
@@ -249,7 +249,7 @@ protected function getExpectedCacheTags(array $sparse_fieldset = NULL) {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheContexts(?array $sparse_fieldset = NULL) {
     $contexts = parent::getExpectedCacheContexts($sparse_fieldset);
     if ($sparse_fieldset === NULL || in_array('body', $sparse_fieldset)) {
       $contexts = Cache::mergeContexts($contexts, ['languages:language_interface', 'theme']);
diff --git a/core/modules/jsonapi/tests/src/Functional/BlockTest.php b/core/modules/jsonapi/tests/src/Functional/BlockTest.php
index e2cd21992bf4..0adc2dadcdbc 100644
--- a/core/modules/jsonapi/tests/src/Functional/BlockTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/BlockTest.php
@@ -145,7 +145,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheContexts(?array $sparse_fieldset = NULL) {
     // @see ::createEntity()
     return array_values(array_diff(parent::getExpectedCacheContexts(), ['user.permissions']));
   }
@@ -153,7 +153,7 @@ protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheTags(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheTags(?array $sparse_fieldset = NULL) {
     // Because the 'user.permissions' cache context is missing, the cache tag
     // for the anonymous user role is never added automatically.
     return array_values(array_diff(parent::getExpectedCacheTags(), ['config:user.role.anonymous']));
@@ -190,7 +190,7 @@ protected function getExpectedUnauthorizedAccessCacheability() {
   /**
    * {@inheritdoc}
    */
-  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, array $sparse_fieldset = NULL, $filtered = FALSE) {
+  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, ?array $sparse_fieldset = NULL, $filtered = FALSE) {
     return parent::getExpectedCollectionCacheability($account, $collection, $sparse_fieldset, $filtered)
       ->addCacheTags(['user:2'])
       ->addCacheContexts(['user.roles']);
diff --git a/core/modules/jsonapi/tests/src/Functional/CommentTest.php b/core/modules/jsonapi/tests/src/Functional/CommentTest.php
index e972aca15f41..a5f85fe90a00 100644
--- a/core/modules/jsonapi/tests/src/Functional/CommentTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/CommentTest.php
@@ -271,7 +271,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheTags(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheTags(?array $sparse_fieldset = NULL) {
     $tags = parent::getExpectedCacheTags($sparse_fieldset);
     if ($sparse_fieldset === NULL || in_array('comment_body', $sparse_fieldset)) {
       $tags = Cache::mergeTags($tags, ['config:filter.format.plain_text']);
@@ -282,7 +282,7 @@ protected function getExpectedCacheTags(array $sparse_fieldset = NULL) {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheContexts(?array $sparse_fieldset = NULL) {
     $contexts = parent::getExpectedCacheContexts($sparse_fieldset);
     if ($sparse_fieldset === NULL || in_array('comment_body', $sparse_fieldset)) {
       $contexts = Cache::mergeContexts($contexts, ['languages:language_interface', 'theme']);
@@ -457,7 +457,7 @@ public function testCollectionFilterAccess() {
   /**
    * {@inheritdoc}
    */
-  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, array $sparse_fieldset = NULL, $filtered = FALSE) {
+  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, ?array $sparse_fieldset = NULL, $filtered = FALSE) {
     $cacheability = parent::getExpectedCollectionCacheability($account, $collection, $sparse_fieldset, $filtered);
     if ($filtered) {
       $cacheability->addCacheTags(['state:jsonapi__entity_test_filter_access_blacklist']);
diff --git a/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php b/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
index f6ec17d1f2e2..d5a6586125a9 100644
--- a/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
@@ -113,7 +113,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheContexts(?array $sparse_fieldset = NULL) {
     return Cache::mergeContexts(parent::getExpectedCacheContexts(), ['languages:language_interface']);
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php b/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php
index f3cca979fe91..b19337290a92 100644
--- a/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php
@@ -125,7 +125,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheContexts(?array $sparse_fieldset = NULL) {
     return Cache::mergeContexts(parent::getExpectedCacheContexts(), ['languages:language_interface']);
   }
 
@@ -151,7 +151,7 @@ protected function createAnotherEntity($key) {
   /**
    * {@inheritdoc}
    */
-  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, array $sparse_fieldset = NULL, $filtered = FALSE) {
+  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, ?array $sparse_fieldset = NULL, $filtered = FALSE) {
     $cacheability = parent::getExpectedCollectionCacheability($account, $collection, $sparse_fieldset, $filtered);
     if (static::entityAccess(reset($collection), 'view', $account)->isAllowed()) {
       $cacheability->addCacheContexts(['languages:language_interface']);
diff --git a/core/modules/jsonapi/tests/src/Functional/EntityTestComputedFieldTest.php b/core/modules/jsonapi/tests/src/Functional/EntityTestComputedFieldTest.php
index f57eb69ce238..534eb3b83efe 100644
--- a/core/modules/jsonapi/tests/src/Functional/EntityTestComputedFieldTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EntityTestComputedFieldTest.php
@@ -170,7 +170,7 @@ protected function getSparseFieldSets() {
     ]));
   }
 
-  protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheContexts(?array $sparse_fieldset = NULL) {
     $cache_contexts = parent::getExpectedCacheContexts($sparse_fieldset);
     if ($sparse_fieldset === NULL || in_array('computed_test_cacheable_string_field', $sparse_fieldset)) {
       $cache_contexts = Cache::mergeContexts($cache_contexts, ['url.query_args:computed_test_cacheable_string_field']);
@@ -179,7 +179,7 @@ protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
     return $cache_contexts;
   }
 
-  protected function getExpectedCacheTags(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheTags(?array $sparse_fieldset = NULL) {
     $expected_cache_tags = parent::getExpectedCacheTags($sparse_fieldset);
     if ($sparse_fieldset === NULL || in_array('computed_test_cacheable_string_field', $sparse_fieldset)) {
       $expected_cache_tags = Cache::mergeTags($expected_cache_tags, ['field:computed_test_cacheable_string_field']);
diff --git a/core/modules/jsonapi/tests/src/Functional/EntityTestTest.php b/core/modules/jsonapi/tests/src/Functional/EntityTestTest.php
index 0d7efcfe8ba3..b8073afc16a4 100644
--- a/core/modules/jsonapi/tests/src/Functional/EntityTestTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EntityTestTest.php
@@ -194,7 +194,7 @@ protected function getSparseFieldSets() {
   /**
    * {@inheritdoc}
    */
-  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, array $sparse_fieldset = NULL, $filtered = FALSE) {
+  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, ?array $sparse_fieldset = NULL, $filtered = FALSE) {
     $cacheability = parent::getExpectedCollectionCacheability($account, $collection, $sparse_fieldset, $filtered);
     if ($filtered) {
       $cacheability->addCacheTags(['state:jsonapi__entity_test_filter_access_blacklist']);
diff --git a/core/modules/jsonapi/tests/src/Functional/MediaTest.php b/core/modules/jsonapi/tests/src/Functional/MediaTest.php
index 55c009905b20..055bc9319469 100644
--- a/core/modules/jsonapi/tests/src/Functional/MediaTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/MediaTest.php
@@ -369,7 +369,7 @@ public function testPostIndividual() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedGetRelationshipDocumentData($relationship_field_name, EntityInterface $entity = NULL) {
+  protected function getExpectedGetRelationshipDocumentData($relationship_field_name, ?EntityInterface $entity = NULL) {
     $data = parent::getExpectedGetRelationshipDocumentData($relationship_field_name, $entity);
     switch ($relationship_field_name) {
       case 'thumbnail':
diff --git a/core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php b/core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
index 361d4fe43fee..d5d8774e6f44 100644
--- a/core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
+++ b/core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
@@ -432,7 +432,7 @@ protected static function getRelatedLink(array $resource_identifier, $relationsh
    *
    * @see \GuzzleHttp\ClientInterface::request()
    */
-  protected function getRelatedResponses(array $relationship_field_names, array $request_options, EntityInterface $entity = NULL) {
+  protected function getRelatedResponses(array $relationship_field_names, array $request_options, ?EntityInterface $entity = NULL) {
     $entity = $entity ?: $this->entity;
     $links = array_map(function ($relationship_field_name) use ($entity) {
       return static::getRelatedLink(static::toResourceIdentifier($entity), $relationship_field_name);
diff --git a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
index 9586bc1accc7..80c6efbfcf02 100644
--- a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
+++ b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
@@ -514,7 +514,7 @@ protected function getExpectedUnauthorizedAccessCacheability() {
    *
    * @see ::testGetIndividual()
    */
-  protected function getExpectedCacheTags(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheTags(?array $sparse_fieldset = NULL) {
     $expected_cache_tags = [
       'http_response',
     ];
@@ -543,7 +543,7 @@ protected function getExtraRevisionCacheTags() {
    *
    * @see ::testGetIndividual()
    */
-  protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheContexts(?array $sparse_fieldset = NULL) {
     $cache_contexts = [
       // Cache contexts for JSON:API URL query parameters.
       'url.query_args:fields',
@@ -574,7 +574,7 @@ protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
    * @return \Drupal\Core\Cache\CacheableMetadata
    *   The expected cacheability for the given entity collection.
    */
-  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, array $sparse_fieldset = NULL, $filtered = FALSE) {
+  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, ?array $sparse_fieldset = NULL, $filtered = FALSE) {
     $cacheability = array_reduce($collection, function (CacheableMetadata $cacheability, EntityInterface $entity) use ($sparse_fieldset, $account) {
       $access_result = static::entityAccess($entity, 'view', $account);
       if (!$access_result->isAllowed()) {
@@ -1271,7 +1271,7 @@ public function testCollection() {
    *
    * @see \GuzzleHttp\ClientInterface::request()
    */
-  protected function getExpectedCollectionResponse(array $collection, $self_link, array $request_options, array $included_paths = NULL, $filtered = FALSE) {
+  protected function getExpectedCollectionResponse(array $collection, $self_link, array $request_options, ?array $included_paths = NULL, $filtered = FALSE) {
     $resource_identifiers = array_map([static::class, 'toResourceIdentifier'], $collection);
     $individual_responses = static::toResourceResponses($this->getResponses(static::getResourceLinks($resource_identifiers), $request_options));
     $merged_response = static::toCollectionResourceResponse($individual_responses, $self_link, TRUE);
@@ -1708,7 +1708,7 @@ protected function doTestRelationshipMutation(array $request_options) {
    * @return \Drupal\jsonapi\CacheableResourceResponse
    *   The expected ResourceResponse.
    */
-  protected function getExpectedGetRelationshipResponse($relationship_field_name, EntityInterface $entity = NULL) {
+  protected function getExpectedGetRelationshipResponse($relationship_field_name, ?EntityInterface $entity = NULL) {
     $entity = $entity ?: $this->entity;
     $access = AccessResult::neutral()->addCacheContexts($entity->getEntityType()->isRevisionable() ? ['url.query_args:resourceVersion'] : []);
     $access = $access->orIf(static::entityFieldAccess($entity, $this->resourceType->getInternalName($relationship_field_name), 'view', $this->account));
@@ -1746,7 +1746,7 @@ protected function getExpectedGetRelationshipResponse($relationship_field_name,
    * @return array
    *   The expected document array.
    */
-  protected function getExpectedGetRelationshipDocument($relationship_field_name, EntityInterface $entity = NULL) {
+  protected function getExpectedGetRelationshipDocument($relationship_field_name, ?EntityInterface $entity = NULL) {
     $entity = $entity ?: $this->entity;
     $entity_type_id = $entity->getEntityTypeId();
     $bundle = $entity->bundle();
@@ -1780,7 +1780,7 @@ protected function getExpectedGetRelationshipDocument($relationship_field_name,
    * @return mixed
    *   The expected document data.
    */
-  protected function getExpectedGetRelationshipDocumentData($relationship_field_name, EntityInterface $entity = NULL) {
+  protected function getExpectedGetRelationshipDocumentData($relationship_field_name, ?EntityInterface $entity = NULL) {
     $entity = $entity ?: $this->entity;
     $internal_field_name = $this->resourceType->getInternalName($relationship_field_name);
     /** @var \Drupal\Core\Field\FieldItemListInterface $field */
@@ -1894,7 +1894,7 @@ protected static function decorateResourceIdentifierWithDrupalInternalTargetId($
    *
    * @see \GuzzleHttp\ClientInterface::request()
    */
-  protected function getExpectedRelatedResponses(array $relationship_field_names, array $request_options, EntityInterface $entity = NULL) {
+  protected function getExpectedRelatedResponses(array $relationship_field_names, array $request_options, ?EntityInterface $entity = NULL) {
     $entity = $entity ?: $this->entity;
     return array_map(function ($relationship_field_name) use ($entity, $request_options) {
       return $this->getExpectedRelatedResponse($relationship_field_name, $request_options, $entity);
@@ -3384,7 +3384,7 @@ protected function getSparseFieldSets() {
    * @return array
    *   An array of relationship field names.
    */
-  protected function getRelationshipFieldNames(EntityInterface $entity = NULL) {
+  protected function getRelationshipFieldNames(?EntityInterface $entity = NULL) {
     $entity = $entity ?: $this->entity;
     // Only content entity types can have relationships.
     $fields = $entity instanceof ContentEntityInterface
diff --git a/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php b/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php
index 20dd4b5f4ed2..54f2ce2cef85 100644
--- a/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php
@@ -198,7 +198,7 @@ public function testCollectionFilterAccess() {
   /**
    * {@inheritdoc}
    */
-  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, array $sparse_fieldset = NULL, $filtered = FALSE) {
+  protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, ?array $sparse_fieldset = NULL, $filtered = FALSE) {
     $cacheability = parent::getExpectedCollectionCacheability($account, $collection, $sparse_fieldset, $filtered);
     if ($filtered) {
       $cacheability->addCacheContexts(['user']);
diff --git a/core/modules/jsonapi/tests/src/Functional/TermTest.php b/core/modules/jsonapi/tests/src/Functional/TermTest.php
index 05d9212fdefc..3488320df324 100644
--- a/core/modules/jsonapi/tests/src/Functional/TermTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/TermTest.php
@@ -321,7 +321,7 @@ protected function getExpectedDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedGetRelationshipDocumentData($relationship_field_name, EntityInterface $entity = NULL) {
+  protected function getExpectedGetRelationshipDocumentData($relationship_field_name, ?EntityInterface $entity = NULL) {
     $data = parent::getExpectedGetRelationshipDocumentData($relationship_field_name, $entity);
     if ($relationship_field_name === 'parent') {
       $data = [
@@ -434,7 +434,7 @@ public function testPatchPath() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheTags(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheTags(?array $sparse_fieldset = NULL) {
     $tags = parent::getExpectedCacheTags($sparse_fieldset);
     if ($sparse_fieldset === NULL || in_array('description', $sparse_fieldset)) {
       $tags = Cache::mergeTags($tags, ['config:filter.format.plain_text', 'config:filter.settings']);
@@ -445,7 +445,7 @@ protected function getExpectedCacheTags(array $sparse_fieldset = NULL) {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheContexts(?array $sparse_fieldset = NULL) {
     $contexts = parent::getExpectedCacheContexts($sparse_fieldset);
     if ($sparse_fieldset === NULL || in_array('description', $sparse_fieldset)) {
       $contexts = Cache::mergeContexts($contexts, ['languages:language_interface', 'theme']);
diff --git a/core/modules/jsonapi/tests/src/Functional/UserTest.php b/core/modules/jsonapi/tests/src/Functional/UserTest.php
index a281a743c7f2..9baba6b96c1f 100644
--- a/core/modules/jsonapi/tests/src/Functional/UserTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/UserTest.php
@@ -173,7 +173,7 @@ protected function getExpectedDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
+  protected function getExpectedCacheContexts(?array $sparse_fieldset = NULL) {
     $cache_contexts = parent::getExpectedCacheContexts($sparse_fieldset);
     if ($sparse_fieldset === NULL || in_array('mail', $sparse_fieldset)) {
       $cache_contexts = Cache::mergeContexts($cache_contexts, ['user']);
diff --git a/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php b/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php
index d3d3a0d1a42b..5f3dbb78b4b0 100644
--- a/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php
+++ b/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php
@@ -190,7 +190,7 @@ public static function linkAccessTestData() {
   /**
    * Get an instance of the normalizer to test.
    */
-  protected function getNormalizer(AccountInterface $current_user = NULL) {
+  protected function getNormalizer(?AccountInterface $current_user = NULL) {
     if (is_null($current_user)) {
       $current_user = $this->setUpCurrentUser();
     }
diff --git a/core/modules/language/language.module b/core/modules/language/language.module
index 632baf5d2448..1e2064ae8aa9 100644
--- a/core/modules/language/language.module
+++ b/core/modules/language/language.module
@@ -397,7 +397,7 @@ function language_field_info_alter(&$info) {
 /**
  * Implements hook_entity_field_access().
  */
-function language_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function language_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   // Only allow edit access on a langcode field if the entity it is attached to
   // is configured to have an alterable language. Also without items we can not
   // decide whether or not to allow access.
diff --git a/core/modules/language/src/Config/LanguageConfigFactoryOverride.php b/core/modules/language/src/Config/LanguageConfigFactoryOverride.php
index 67ae7dfa9940..563dbb95575b 100644
--- a/core/modules/language/src/Config/LanguageConfigFactoryOverride.php
+++ b/core/modules/language/src/Config/LanguageConfigFactoryOverride.php
@@ -138,7 +138,7 @@ public function getLanguage() {
   /**
    * {@inheritdoc}
    */
-  public function setLanguage(LanguageInterface $language = NULL) {
+  public function setLanguage(?LanguageInterface $language = NULL) {
     $this->language = $language;
     return $this;
   }
diff --git a/core/modules/language/src/Config/LanguageConfigFactoryOverrideInterface.php b/core/modules/language/src/Config/LanguageConfigFactoryOverrideInterface.php
index dec0546b0f75..b8fc475582a8 100644
--- a/core/modules/language/src/Config/LanguageConfigFactoryOverrideInterface.php
+++ b/core/modules/language/src/Config/LanguageConfigFactoryOverrideInterface.php
@@ -26,7 +26,7 @@ public function getLanguage();
    *
    * @return $this
    */
-  public function setLanguage(LanguageInterface $language = NULL);
+  public function setLanguage(?LanguageInterface $language = NULL);
 
   /**
    * Get language override for given language and configuration name.
diff --git a/core/modules/language/src/ConfigurableLanguageManager.php b/core/modules/language/src/ConfigurableLanguageManager.php
index b39d7f3d2549..67ff2a991cba 100644
--- a/core/modules/language/src/ConfigurableLanguageManager.php
+++ b/core/modules/language/src/ConfigurableLanguageManager.php
@@ -447,7 +447,7 @@ public function getLanguageSwitchLinks($type, Url $url) {
    *
    * @return $this
    */
-  public function setConfigOverrideLanguage(LanguageInterface $language = NULL) {
+  public function setConfigOverrideLanguage(?LanguageInterface $language = NULL) {
     $this->configFactoryOverride->setLanguage($language);
     return $this;
   }
diff --git a/core/modules/language/src/Form/NegotiationConfigureForm.php b/core/modules/language/src/Form/NegotiationConfigureForm.php
index d25305f0306c..189e74e14ae1 100644
--- a/core/modules/language/src/Form/NegotiationConfigureForm.php
+++ b/core/modules/language/src/Form/NegotiationConfigureForm.php
@@ -82,7 +82,7 @@ class NegotiationConfigureForm extends ConfigFormBase {
    * @param \Drupal\Core\Entity\EntityStorageInterface $block_storage
    *   The block storage, or NULL if not available.
    */
-  public function __construct(ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typedConfigManager, ConfigurableLanguageManagerInterface $language_manager, LanguageNegotiatorInterface $negotiator, BlockManagerInterface $block_manager, ThemeHandlerInterface $theme_handler, EntityStorageInterface $block_storage = NULL) {
+  public function __construct(ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typedConfigManager, ConfigurableLanguageManagerInterface $language_manager, LanguageNegotiatorInterface $negotiator, BlockManagerInterface $block_manager, ThemeHandlerInterface $theme_handler, ?EntityStorageInterface $block_storage = NULL) {
     parent::__construct($config_factory, $typedConfigManager);
     $this->languageTypes = $this->config('language.types');
     $this->languageManager = $language_manager;
diff --git a/core/modules/language/src/HttpKernel/PathProcessorLanguage.php b/core/modules/language/src/HttpKernel/PathProcessorLanguage.php
index 3aed7ecc2a8f..3d9b3e17d1ef 100644
--- a/core/modules/language/src/HttpKernel/PathProcessorLanguage.php
+++ b/core/modules/language/src/HttpKernel/PathProcessorLanguage.php
@@ -101,7 +101,7 @@ public function processInbound($path, Request $request) {
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     if (!isset($this->multilingual)) {
       $this->multilingual = $this->languageManager->isMultilingual();
     }
diff --git a/core/modules/language/src/LanguageNegotiationMethodInterface.php b/core/modules/language/src/LanguageNegotiationMethodInterface.php
index 2c1cf3ac8e79..4affbd148a9a 100644
--- a/core/modules/language/src/LanguageNegotiationMethodInterface.php
+++ b/core/modules/language/src/LanguageNegotiationMethodInterface.php
@@ -54,7 +54,7 @@ public function setCurrentUser(AccountInterface $current_user);
    *
    * @see https://www.drupal.org/node/3329952
    */
-  public function getLangcode(Request $request = NULL);
+  public function getLangcode(?Request $request = NULL);
 
   /**
    * Notifies the plugin that the language code it returned has been accepted.
diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php
index 2d4dda4fa8ef..a3a5df8ae63b 100644
--- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php
+++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php
@@ -46,7 +46,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function getLangcode(Request $request = NULL) {
+  public function getLangcode(?Request $request = NULL) {
     $langcode = NULL;
 
     if ($this->languageManager && $request && $request->server->get('HTTP_ACCEPT_LANGUAGE')) {
diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php
index 0ee626f2b70e..243e3354e106 100644
--- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php
+++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php
@@ -91,7 +91,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function getLangcode(Request $request = NULL) {
+  public function getLangcode(?Request $request = NULL) {
     if ($request === NULL || $this->languageManager === NULL) {
       return NULL;
     }
@@ -105,7 +105,7 @@ public function getLangcode(Request $request = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     // If appropriate, process outbound to add a query parameter to the URL and
     // remove the language option, so that URL negotiator does not rewrite the
     // URL.
diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php
index ae226cb5cc92..93f518162dda 100644
--- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php
+++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php
@@ -27,7 +27,7 @@ class LanguageNegotiationSelected extends LanguageNegotiationMethodBase {
   /**
    * {@inheritdoc}
    */
-  public function getLangcode(Request $request = NULL) {
+  public function getLangcode(?Request $request = NULL) {
     $langcode = NULL;
 
     if ($this->languageManager) {
diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php
index 365cfced6f03..e432928cc6f6 100644
--- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php
+++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php
@@ -82,7 +82,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function getLangcode(Request $request = NULL) {
+  public function getLangcode(?Request $request = NULL) {
     $config = $this->config->get('language.negotiation')->get('session');
     if (($param = $config['parameter']) && $request) {
       if ($request->query->has($param)) {
@@ -114,7 +114,7 @@ public function persist(LanguageInterface $language) {
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     if ($request) {
       // The following values are not supposed to change during a single page
       // request processing.
diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php
index 130f68fa4b4e..f00a244aa223 100644
--- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php
+++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php
@@ -28,7 +28,7 @@ class LanguageNegotiationUI extends LanguageNegotiationMethodBase {
   /**
    * {@inheritdoc}
    */
-  public function getLangcode(Request $request = NULL) {
+  public function getLangcode(?Request $request = NULL) {
     return $this->languageManager ? $this->languageManager->getCurrentLanguage()->getId() : NULL;
   }
 
diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php
index af5ecd3f8d76..ac156eeee2d5 100644
--- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php
+++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php
@@ -47,7 +47,7 @@ class LanguageNegotiationUrl extends LanguageNegotiationMethodBase implements In
   /**
    * {@inheritdoc}
    */
-  public function getLangcode(Request $request = NULL) {
+  public function getLangcode(?Request $request = NULL) {
     $langcode = NULL;
 
     if ($request && $this->languageManager) {
@@ -123,7 +123,7 @@ public function processInbound($path, Request $request) {
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     $url_scheme = 'http';
     $port = 80;
     if ($request) {
diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrlFallback.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrlFallback.php
index 77f902fe7254..a4bdd3027035 100644
--- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrlFallback.php
+++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrlFallback.php
@@ -46,7 +46,7 @@ class LanguageNegotiationUrlFallback extends LanguageNegotiationMethodBase {
   /**
    * {@inheritdoc}
    */
-  public function getLangcode(Request $request = NULL) {
+  public function getLangcode(?Request $request = NULL) {
     $langcode = NULL;
 
     if ($this->languageManager) {
diff --git a/core/modules/language/tests/language_entity_field_access_test/language_entity_field_access_test.module b/core/modules/language/tests/language_entity_field_access_test/language_entity_field_access_test.module
index 5d08a6c9914e..a9106becc204 100644
--- a/core/modules/language/tests/language_entity_field_access_test/language_entity_field_access_test.module
+++ b/core/modules/language/tests/language_entity_field_access_test/language_entity_field_access_test.module
@@ -13,6 +13,6 @@
 /**
  * Implements hook_entity_field_access().
  */
-function language_entity_field_access_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function language_entity_field_access_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   return AccessResult::forbidden();
 }
diff --git a/core/modules/language/tests/language_test/src/Plugin/LanguageNegotiation/LanguageNegotiationTest.php b/core/modules/language/tests/language_test/src/Plugin/LanguageNegotiation/LanguageNegotiationTest.php
index 36a9d24ae030..a0938470025a 100644
--- a/core/modules/language/tests/language_test/src/Plugin/LanguageNegotiation/LanguageNegotiationTest.php
+++ b/core/modules/language/tests/language_test/src/Plugin/LanguageNegotiation/LanguageNegotiationTest.php
@@ -31,7 +31,7 @@ class LanguageNegotiationTest extends LanguageNegotiationMethodBase {
   /**
    * {@inheritdoc}
    */
-  public function getLangcode(Request $request = NULL) {
+  public function getLangcode(?Request $request = NULL) {
     return 'it';
   }
 
diff --git a/core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php b/core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php
index f5e4b41d0a59..4727cb08777f 100644
--- a/core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php
+++ b/core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php
@@ -17,7 +17,7 @@ class LayoutPreviewAccessAllowed implements AccessibleInterface {
   /**
    * {@inheritdoc}
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     if ($operation === 'view') {
       return $return_as_object ? AccessResult::allowed() : TRUE;
     }
diff --git a/core/modules/layout_builder/src/Field/LayoutSectionItemList.php b/core/modules/layout_builder/src/Field/LayoutSectionItemList.php
index 111acd0f1cc4..e78de3fc6036 100644
--- a/core/modules/layout_builder/src/Field/LayoutSectionItemList.php
+++ b/core/modules/layout_builder/src/Field/LayoutSectionItemList.php
@@ -100,7 +100,7 @@ public function equals(FieldItemListInterface $list_to_compare) {
    *
    * @ingroup layout_builder_access
    */
-  public function defaultAccess($operation = 'view', AccountInterface $account = NULL) {
+  public function defaultAccess($operation = 'view', ?AccountInterface $account = NULL) {
     // @todo Allow access in https://www.drupal.org/node/2942975.
     return AccessResult::forbidden();
   }
diff --git a/core/modules/layout_builder/src/Form/AddBlockForm.php b/core/modules/layout_builder/src/Form/AddBlockForm.php
index 63c79c2c46c6..be4f796ce445 100644
--- a/core/modules/layout_builder/src/Form/AddBlockForm.php
+++ b/core/modules/layout_builder/src/Form/AddBlockForm.php
@@ -50,7 +50,7 @@ protected function submitLabel() {
    * @return array
    *   The form array.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $plugin_id = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $plugin_id = NULL) {
     // Only generate a new component once per form submission.
     if (!$component = $form_state->get('layout_builder__component')) {
       $component = new SectionComponent($this->uuidGenerator->generate(), $region, ['id' => $plugin_id]);
diff --git a/core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php b/core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php
index cc5a8f139576..6974d97a99b2 100644
--- a/core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php
+++ b/core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php
@@ -160,7 +160,7 @@ public function getBaseFormId() {
    * @return array
    *   The form array.
    */
-  public function doBuildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL, SectionComponent $component = NULL) {
+  public function doBuildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL, $delta = NULL, ?SectionComponent $component = NULL) {
     $this->sectionStorage = $section_storage;
     $this->delta = $delta;
     $this->uuid = $component->getUuid();
diff --git a/core/modules/layout_builder/src/Form/ConfigureSectionForm.php b/core/modules/layout_builder/src/Form/ConfigureSectionForm.php
index 6a6866885a33..38e57cdb10a6 100644
--- a/core/modules/layout_builder/src/Form/ConfigureSectionForm.php
+++ b/core/modules/layout_builder/src/Form/ConfigureSectionForm.php
@@ -124,7 +124,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL, $plugin_id = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL, $delta = NULL, $plugin_id = NULL) {
     $this->sectionStorage = $section_storage;
     $this->delta = $delta;
     $this->isUpdate = is_null($plugin_id);
diff --git a/core/modules/layout_builder/src/Form/DefaultsEntityForm.php b/core/modules/layout_builder/src/Form/DefaultsEntityForm.php
index 4e8cee0c0891..a23cc6097cc9 100644
--- a/core/modules/layout_builder/src/Form/DefaultsEntityForm.php
+++ b/core/modules/layout_builder/src/Form/DefaultsEntityForm.php
@@ -69,7 +69,7 @@ public static function create(ContainerInterface $container) {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL) {
     $form['#attributes']['class'][] = 'layout-builder-form';
     $form['layout_builder'] = [
       '#type' => 'layout_builder',
diff --git a/core/modules/layout_builder/src/Form/DiscardLayoutChangesForm.php b/core/modules/layout_builder/src/Form/DiscardLayoutChangesForm.php
index 72eb56ed6733..6157ac063de2 100644
--- a/core/modules/layout_builder/src/Form/DiscardLayoutChangesForm.php
+++ b/core/modules/layout_builder/src/Form/DiscardLayoutChangesForm.php
@@ -88,7 +88,7 @@ public function getCancelUrl() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL) {
     $this->sectionStorage = $section_storage;
     // Mark this as an administrative page for JavaScript ("Back to site" link).
     $form['#attached']['drupalSettings']['path']['currentPathIsAdmin'] = TRUE;
diff --git a/core/modules/layout_builder/src/Form/LayoutBuilderDisableForm.php b/core/modules/layout_builder/src/Form/LayoutBuilderDisableForm.php
index 117a4663e78f..bf0c2d74dbf8 100644
--- a/core/modules/layout_builder/src/Form/LayoutBuilderDisableForm.php
+++ b/core/modules/layout_builder/src/Form/LayoutBuilderDisableForm.php
@@ -89,7 +89,7 @@ public function getCancelUrl() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL) {
     if (!$section_storage instanceof DefaultsSectionStorageInterface) {
       throw new \InvalidArgumentException(sprintf('The section storage with type "%s" and ID "%s" does not provide defaults', $section_storage->getStorageType(), $section_storage->getStorageId()));
     }
diff --git a/core/modules/layout_builder/src/Form/LayoutBuilderEntityViewDisplayForm.php b/core/modules/layout_builder/src/Form/LayoutBuilderEntityViewDisplayForm.php
index 2fd3359aaf3e..a6cedf51c96e 100644
--- a/core/modules/layout_builder/src/Form/LayoutBuilderEntityViewDisplayForm.php
+++ b/core/modules/layout_builder/src/Form/LayoutBuilderEntityViewDisplayForm.php
@@ -35,7 +35,7 @@ class LayoutBuilderEntityViewDisplayForm extends EntityViewDisplayEditForm {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL) {
     $this->sectionStorage = $section_storage;
     return parent::buildForm($form, $form_state);
   }
diff --git a/core/modules/layout_builder/src/Form/LayoutRebuildConfirmFormBase.php b/core/modules/layout_builder/src/Form/LayoutRebuildConfirmFormBase.php
index 98875bed4088..611259727540 100644
--- a/core/modules/layout_builder/src/Form/LayoutRebuildConfirmFormBase.php
+++ b/core/modules/layout_builder/src/Form/LayoutRebuildConfirmFormBase.php
@@ -75,7 +75,7 @@ public function getCancelUrl() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL, $delta = NULL) {
     $this->sectionStorage = $section_storage;
     $this->delta = $delta;
 
diff --git a/core/modules/layout_builder/src/Form/MoveBlockForm.php b/core/modules/layout_builder/src/Form/MoveBlockForm.php
index 3c572509a77d..56c7791deaf3 100644
--- a/core/modules/layout_builder/src/Form/MoveBlockForm.php
+++ b/core/modules/layout_builder/src/Form/MoveBlockForm.php
@@ -107,7 +107,7 @@ public function getFormId() {
    * @return array
    *   The form array.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $uuid = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $uuid = NULL) {
     $parameters = array_slice(func_get_args(), 2);
     foreach ($parameters as $parameter) {
       if (is_null($parameter)) {
diff --git a/core/modules/layout_builder/src/Form/OverridesEntityForm.php b/core/modules/layout_builder/src/Form/OverridesEntityForm.php
index e4e15914446e..236441bc4eeb 100644
--- a/core/modules/layout_builder/src/Form/OverridesEntityForm.php
+++ b/core/modules/layout_builder/src/Form/OverridesEntityForm.php
@@ -90,7 +90,7 @@ protected function init(FormStateInterface $form_state) {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL) {
     $this->sectionStorage = $section_storage;
     $form = parent::buildForm($form, $form_state);
     $form['#attributes']['class'][] = 'layout-builder-form';
diff --git a/core/modules/layout_builder/src/Form/RemoveBlockForm.php b/core/modules/layout_builder/src/Form/RemoveBlockForm.php
index 128a51470317..8b4cf7e7369e 100644
--- a/core/modules/layout_builder/src/Form/RemoveBlockForm.php
+++ b/core/modules/layout_builder/src/Form/RemoveBlockForm.php
@@ -57,7 +57,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $uuid = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $uuid = NULL) {
     $this->region = $region;
     $this->uuid = $uuid;
     return parent::buildForm($form, $form_state, $section_storage, $delta);
diff --git a/core/modules/layout_builder/src/Form/RevertOverridesForm.php b/core/modules/layout_builder/src/Form/RevertOverridesForm.php
index 9c8932d63634..c488bd096552 100644
--- a/core/modules/layout_builder/src/Form/RevertOverridesForm.php
+++ b/core/modules/layout_builder/src/Form/RevertOverridesForm.php
@@ -96,7 +96,7 @@ public function getCancelUrl() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL) {
     if (!$section_storage instanceof OverridesSectionStorageInterface) {
       throw new \InvalidArgumentException(sprintf('The section storage with type "%s" and ID "%s" does not provide overrides', $section_storage->getStorageType(), $section_storage->getStorageId()));
     }
diff --git a/core/modules/layout_builder/src/Form/UpdateBlockForm.php b/core/modules/layout_builder/src/Form/UpdateBlockForm.php
index 5b6f5281048c..e56c4dfe0d68 100644
--- a/core/modules/layout_builder/src/Form/UpdateBlockForm.php
+++ b/core/modules/layout_builder/src/Form/UpdateBlockForm.php
@@ -42,7 +42,7 @@ public function getFormId() {
    * @return array
    *   The form array.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $uuid = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $uuid = NULL) {
     $component = $section_storage->getSection($delta)->getComponent($uuid);
     $form['#attributes']['data-layout-builder-target-highlight-id'] = $this->blockUpdateHighlightId($uuid);
     return $this->doBuildForm($form, $form_state, $section_storage, $delta, $component);
diff --git a/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php b/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php
index e8a4114e6e2c..2f1a25e775ab 100644
--- a/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php
+++ b/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php
@@ -389,7 +389,7 @@ public function getThirdPartyProviders() {
   /**
    * {@inheritdoc}
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $result = AccessResult::allowedIf($this->isLayoutBuilderEnabled())->addCacheableDependency($this);
     return $return_as_object ? $result : $result->isAllowed();
   }
diff --git a/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php b/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php
index 1fefa2b455ea..7fc7491fb85b 100644
--- a/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php
+++ b/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php
@@ -345,7 +345,7 @@ public function save() {
   /**
    * {@inheritdoc}
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     if ($account === NULL) {
       $account = $this->currentUser;
     }
diff --git a/core/modules/layout_builder/src/SectionStorageInterface.php b/core/modules/layout_builder/src/SectionStorageInterface.php
index 35b3a9c87b8e..ffd559f63aa3 100644
--- a/core/modules/layout_builder/src/SectionStorageInterface.php
+++ b/core/modules/layout_builder/src/SectionStorageInterface.php
@@ -148,6 +148,6 @@ public function getPluginDefinition();
    *
    * @ingroup layout_builder_access
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE);
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE);
 
 }
diff --git a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php
index f918df25ea63..549aa1c25044 100644
--- a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php
+++ b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php
@@ -189,7 +189,7 @@ public function getRedirectUrl() {
   /**
    * {@inheritdoc}
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $result = AccessResult::allowed();
     return $return_as_object ? $result : $result->isAllowed();
   }
diff --git a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
index d0b1f3472b5c..24ee135945dd 100644
--- a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
+++ b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
@@ -41,7 +41,7 @@ public function isApplicable(RefinableCacheableDependencyInterface $cacheability
   /**
    * {@inheritdoc}
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
   }
 
diff --git a/core/modules/locale/locale.translation.inc b/core/modules/locale/locale.translation.inc
index c879139653de..44bf5c666126 100644
--- a/core/modules/locale/locale.translation.inc
+++ b/core/modules/locale/locale.translation.inc
@@ -101,7 +101,7 @@ function locale_translation_clear_cache_projects() {
  *
  * @see locale_translation_source_build()
  */
-function locale_translation_load_sources(array $projects = NULL, array $langcodes = NULL) {
+function locale_translation_load_sources(?array $projects = NULL, ?array $langcodes = NULL) {
   $sources = [];
   $projects = $projects ? $projects : array_keys(locale_translation_get_projects());
   $langcodes = $langcodes ? $langcodes : array_keys(locale_translatable_language_list());
diff --git a/core/modules/media/src/OEmbed/ProviderException.php b/core/modules/media/src/OEmbed/ProviderException.php
index 259c939ed115..8fa6100c389e 100644
--- a/core/modules/media/src/OEmbed/ProviderException.php
+++ b/core/modules/media/src/OEmbed/ProviderException.php
@@ -31,7 +31,7 @@ class ProviderException extends \Exception {
    * @param \Exception $previous
    *   (optional) The previous exception, if any.
    */
-  public function __construct($message, Provider $provider = NULL, \Exception $previous = NULL) {
+  public function __construct($message, ?Provider $provider = NULL, ?\Exception $previous = NULL) {
     $this->provider = $provider;
     $message = str_replace('@name', $provider ? $provider->getName() : '<unknown>', $message);
     parent::__construct($message, 0, $previous);
diff --git a/core/modules/media/src/OEmbed/Resource.php b/core/modules/media/src/OEmbed/Resource.php
index 983f08df28d3..bd89099b0f10 100644
--- a/core/modules/media/src/OEmbed/Resource.php
+++ b/core/modules/media/src/OEmbed/Resource.php
@@ -173,7 +173,7 @@ class Resource implements CacheableDependencyInterface {
    *   (optional) The height of the thumbnail, in pixels. If this parameter is
    *   present, $thumbnail_url and $thumbnail_width must also be present.
    */
-  protected function __construct(Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
+  protected function __construct(?Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
     $this->provider = $provider;
     $this->title = $title;
     $this->authorName = $author_name;
@@ -220,7 +220,7 @@ protected function __construct(Provider $provider = NULL, $title = NULL, $author
    *
    * @return static
    */
-  public static function link($url = NULL, Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
+  public static function link($url = NULL, ?Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
     $resource = new static($provider, $title, $author_name, $author_url, $cache_age, $thumbnail_url, $thumbnail_width, $thumbnail_height);
     $resource->type = self::TYPE_LINK;
     $resource->url = $url;
@@ -260,7 +260,7 @@ public static function link($url = NULL, Provider $provider = NULL, $title = NUL
    *
    * @return static
    */
-  public static function photo($url, $width, $height = NULL, Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
+  public static function photo($url, $width, $height = NULL, ?Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
     if (empty($url)) {
       throw new \InvalidArgumentException('Photo resources must provide a URL.');
     }
@@ -304,7 +304,7 @@ public static function photo($url, $width, $height = NULL, Provider $provider =
    *
    * @return static
    */
-  public static function rich($html, $width, $height = NULL, Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
+  public static function rich($html, $width, $height = NULL, ?Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
     if (empty($html)) {
       throw new \InvalidArgumentException('The resource must provide an HTML representation.');
     }
@@ -349,7 +349,7 @@ public static function rich($html, $width, $height = NULL, Provider $provider =
    *
    * @return static
    */
-  public static function video($html, $width, $height = NULL, Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
+  public static function video($html, $width, $height = NULL, ?Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
     $resource = static::rich($html, $width, $height, $provider, $title, $author_name, $author_url, $cache_age, $thumbnail_url, $thumbnail_width, $thumbnail_height);
     $resource->type = self::TYPE_VIDEO;
 
diff --git a/core/modules/media/src/OEmbed/ResourceException.php b/core/modules/media/src/OEmbed/ResourceException.php
index 433867834e54..7ac8dcf59748 100644
--- a/core/modules/media/src/OEmbed/ResourceException.php
+++ b/core/modules/media/src/OEmbed/ResourceException.php
@@ -38,7 +38,7 @@ class ResourceException extends \Exception {
    * @param \Exception $previous
    *   (optional) The previous exception, if any.
    */
-  public function __construct($message, $url, array $data = [], \Exception $previous = NULL) {
+  public function __construct($message, $url, array $data = [], ?\Exception $previous = NULL) {
     $this->url = $url;
     $this->data = $data;
     parent::__construct($message, 0, $previous);
diff --git a/core/modules/media_library/src/Form/OEmbedForm.php b/core/modules/media_library/src/Form/OEmbedForm.php
index 8b70c896918e..b9fc104d4e7c 100644
--- a/core/modules/media_library/src/Form/OEmbedForm.php
+++ b/core/modules/media_library/src/Form/OEmbedForm.php
@@ -50,7 +50,7 @@ class OEmbedForm extends AddFormBase {
    * @param \Drupal\media_library\OpenerResolverInterface $opener_resolver
    *   The opener resolver.
    */
-  public function __construct(EntityTypeManagerInterface $entity_type_manager, MediaLibraryUiBuilder $library_ui_builder, UrlResolverInterface $url_resolver, ResourceFetcherInterface $resource_fetcher, OpenerResolverInterface $opener_resolver = NULL) {
+  public function __construct(EntityTypeManagerInterface $entity_type_manager, MediaLibraryUiBuilder $library_ui_builder, UrlResolverInterface $url_resolver, ResourceFetcherInterface $resource_fetcher, ?OpenerResolverInterface $opener_resolver = NULL) {
     parent::__construct($entity_type_manager, $library_ui_builder, $opener_resolver);
     $this->urlResolver = $url_resolver;
     $this->resourceFetcher = $resource_fetcher;
diff --git a/core/modules/media_library/src/MediaLibraryUiBuilder.php b/core/modules/media_library/src/MediaLibraryUiBuilder.php
index f7319244eda5..37847351a222 100644
--- a/core/modules/media_library/src/MediaLibraryUiBuilder.php
+++ b/core/modules/media_library/src/MediaLibraryUiBuilder.php
@@ -108,7 +108,7 @@ public static function dialogOptions() {
    * @return array
    *   The render array for the media library.
    */
-  public function buildUi(MediaLibraryState $state = NULL) {
+  public function buildUi(?MediaLibraryState $state = NULL) {
     if (!$state) {
       $state = MediaLibraryState::fromRequest($this->request);
     }
@@ -176,7 +176,7 @@ protected function buildLibraryContent(MediaLibraryState $state) {
    * @return \Drupal\Core\Access\AccessResult
    *   The access result.
    */
-  public function checkAccess(AccountInterface $account, MediaLibraryState $state = NULL) {
+  public function checkAccess(AccountInterface $account, ?MediaLibraryState $state = NULL) {
     if (!$state) {
       try {
         $state = MediaLibraryState::fromRequest($this->request);
diff --git a/core/modules/media_library/tests/modules/media_library_test/media_library_test.module b/core/modules/media_library/tests/modules/media_library_test/media_library_test.module
index bbebbb0f1e31..bc56038b1321 100644
--- a/core/modules/media_library/tests/modules/media_library_test/media_library_test.module
+++ b/core/modules/media_library/tests/modules/media_library_test/media_library_test.module
@@ -26,7 +26,7 @@ function media_library_test_media_create_access(AccountInterface $account, array
 /**
  * Implements hook_entity_field_access().
  */
-function media_library_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function media_library_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   $deny_fields = \Drupal::state()->get('media_library_test_entity_field_access_deny_fields', []);
   // Always deny the field_media_no_access field.
   $deny_fields[] = 'field_media_no_access';
diff --git a/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php b/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php
index 77b6e43ef5f8..dcfb5e60f8bb 100644
--- a/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php
+++ b/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php
@@ -414,7 +414,7 @@ public function testAddFormAccess(): void {
    * @param string[] $expected_cache_contexts
    *   (optional) The expected cache contexts attached to the access result.
    */
-  private function assertAccess(AccessResult $access_result, bool $is_allowed, string $expected_reason = NULL, array $expected_cache_tags = [], array $expected_cache_contexts = []): void {
+  private function assertAccess(AccessResult $access_result, bool $is_allowed, ?string $expected_reason = NULL, array $expected_cache_tags = [], array $expected_cache_contexts = []): void {
     $this->assertSame($is_allowed, $access_result->isAllowed());
     if ($access_result instanceof AccessResultReasonInterface && isset($expected_reason)) {
       $this->assertSame($expected_reason, $access_result->getReason());
diff --git a/core/modules/menu_ui/src/Form/MenuLinkEditForm.php b/core/modules/menu_ui/src/Form/MenuLinkEditForm.php
index fafb293dbed7..0e102950e36c 100644
--- a/core/modules/menu_ui/src/Form/MenuLinkEditForm.php
+++ b/core/modules/menu_ui/src/Form/MenuLinkEditForm.php
@@ -62,7 +62,7 @@ public function getFormId() {
    * @param \Drupal\Core\Menu\MenuLinkInterface $menu_link_plugin
    *   The plugin instance to use for this form.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, MenuLinkInterface $menu_link_plugin = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?MenuLinkInterface $menu_link_plugin = NULL) {
     $form['menu_link_id'] = [
       '#type' => 'value',
       '#value' => $menu_link_plugin->getPluginId(),
diff --git a/core/modules/menu_ui/src/Form/MenuLinkResetForm.php b/core/modules/menu_ui/src/Form/MenuLinkResetForm.php
index ae307bcd72b9..d41c6c2bbe31 100644
--- a/core/modules/menu_ui/src/Form/MenuLinkResetForm.php
+++ b/core/modules/menu_ui/src/Form/MenuLinkResetForm.php
@@ -90,7 +90,7 @@ public function getConfirmText() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, MenuLinkInterface $menu_link_plugin = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?MenuLinkInterface $menu_link_plugin = NULL) {
     $this->link = $menu_link_plugin;
 
     $form = parent::buildForm($form, $form_state);
diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
index 488a22eaee03..4e7393391192 100644
--- a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
+++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
@@ -869,7 +869,7 @@ public function checkInvalidParentMenuLinks() {
    * @param object $parent_node
    *   Parent menu link content node.
    */
-  public function verifyMenuLink(MenuLinkContent $item, $item_node, MenuLinkContent $parent = NULL, $parent_node = NULL) {
+  public function verifyMenuLink(MenuLinkContent $item, $item_node, ?MenuLinkContent $parent = NULL, $parent_node = NULL) {
     // View home page.
     $this->drupalGet('');
     $this->assertSession()->statusCodeEquals(200);
diff --git a/core/modules/migrate/src/Audit/AuditException.php b/core/modules/migrate/src/Audit/AuditException.php
index d2ef2eb5d9aa..1fbeb2ea3991 100644
--- a/core/modules/migrate/src/Audit/AuditException.php
+++ b/core/modules/migrate/src/Audit/AuditException.php
@@ -19,7 +19,7 @@ class AuditException extends \RuntimeException {
    * @param \Exception $previous
    *   (optional) The previous exception.
    */
-  public function __construct(MigrationInterface $migration, $message, \Exception $previous = NULL) {
+  public function __construct(MigrationInterface $migration, $message, ?\Exception $previous = NULL) {
     $message = sprintf('Cannot audit migration %s: %s', $migration->id(), $message);
     parent::__construct($message, 0, $previous);
   }
diff --git a/core/modules/migrate/src/Exception/RequirementsException.php b/core/modules/migrate/src/Exception/RequirementsException.php
index 7af71126cea3..9958209c3e3d 100644
--- a/core/modules/migrate/src/Exception/RequirementsException.php
+++ b/core/modules/migrate/src/Exception/RequirementsException.php
@@ -28,7 +28,7 @@ class RequirementsException extends \RuntimeException {
    * @param \Exception $previous
    *   (optional) The previous exception used for the exception chaining.
    */
-  public function __construct($message = "", array $requirements = [], $code = 0, \Exception $previous = NULL) {
+  public function __construct($message = "", array $requirements = [], $code = 0, ?\Exception $previous = NULL) {
     parent::__construct($message, $code, $previous);
 
     $this->requirements = $requirements;
diff --git a/core/modules/migrate/src/MigrateException.php b/core/modules/migrate/src/MigrateException.php
index 526fe043b6f3..f1132e5e7d02 100644
--- a/core/modules/migrate/src/MigrateException.php
+++ b/core/modules/migrate/src/MigrateException.php
@@ -47,7 +47,7 @@ class MigrateException extends \Exception {
    *   The status of the item for the map table, a MigrateMap::STATUS_*
    *   constant.
    */
-  public function __construct($message = '', $code = 0, \Exception $previous = NULL, $level = MigrationInterface::MESSAGE_ERROR, $status = MigrateIdMapInterface::STATUS_FAILED) {
+  public function __construct($message = '', $code = 0, ?\Exception $previous = NULL, $level = MigrationInterface::MESSAGE_ERROR, $status = MigrateIdMapInterface::STATUS_FAILED) {
     $this->level = $level;
     $this->status = $status;
     parent::__construct($message);
diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php
index f4e026f0bbb8..af1f6dbc9e08 100644
--- a/core/modules/migrate/src/MigrateExecutable.php
+++ b/core/modules/migrate/src/MigrateExecutable.php
@@ -101,7 +101,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
    * @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher
    *   (optional) The event dispatcher.
    */
-  public function __construct(MigrationInterface $migration, MigrateMessageInterface $message = NULL, EventDispatcherInterface $event_dispatcher = NULL) {
+  public function __construct(MigrationInterface $migration, ?MigrateMessageInterface $message = NULL, ?EventDispatcherInterface $event_dispatcher = NULL) {
     $this->migration = $migration;
     $this->message = $message ?: new MigrateMessage();
     $this->getIdMap()->setMessage($this->message);
@@ -387,7 +387,7 @@ protected function getIdMap() {
   /**
    * {@inheritdoc}
    */
-  public function processRow(Row $row, array $process = NULL, $value = NULL) {
+  public function processRow(Row $row, ?array $process = NULL, $value = NULL) {
     foreach ($this->migration->getProcessPlugins($process) as $destination => $plugins) {
       $this->processPipeline($row, $destination, $plugins, $value);
     }
diff --git a/core/modules/migrate/src/MigrateExecutableInterface.php b/core/modules/migrate/src/MigrateExecutableInterface.php
index f4cd97ea806c..d816bdd8a916 100644
--- a/core/modules/migrate/src/MigrateExecutableInterface.php
+++ b/core/modules/migrate/src/MigrateExecutableInterface.php
@@ -41,7 +41,7 @@ public function rollback();
    *
    * @throws \Drupal\migrate\MigrateException
    */
-  public function processRow(Row $row, array $process = NULL, $value = NULL);
+  public function processRow(Row $row, ?array $process = NULL, $value = NULL);
 
   /**
    * Passes messages through to the map class.
diff --git a/core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php b/core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php
index c51468911645..fec7cafce2b6 100644
--- a/core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php
+++ b/core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php
@@ -51,7 +51,7 @@ public function __construct($subdir, \Traversable $root_namespaces, $plugin_defi
   /**
    * {@inheritdoc}
    */
-  protected function prepareAnnotationDefinition(AnnotationInterface $annotation, $class, BaseStaticReflectionParser $parser = NULL) {
+  protected function prepareAnnotationDefinition(AnnotationInterface $annotation, $class, ?BaseStaticReflectionParser $parser = NULL) {
     if (!($annotation instanceof MultipleProviderAnnotationInterface)) {
       throw new \LogicException('AnnotatedClassDiscoveryAutomatedProviders annotations must implement \Drupal\migrate\Annotation\MultipleProviderAnnotationInterface');
     }
diff --git a/core/modules/migrate/src/Plugin/Exception/BadPluginDefinitionException.php b/core/modules/migrate/src/Plugin/Exception/BadPluginDefinitionException.php
index 081d4c01d536..deb92b858c18 100644
--- a/core/modules/migrate/src/Plugin/Exception/BadPluginDefinitionException.php
+++ b/core/modules/migrate/src/Plugin/Exception/BadPluginDefinitionException.php
@@ -23,7 +23,7 @@ class BadPluginDefinitionException extends InvalidPluginDefinitionException {
    *
    * @see \Exception
    */
-  public function __construct($plugin_id, $property, $code = 0, \Exception $previous = NULL) {
+  public function __construct($plugin_id, $property, $code = 0, ?\Exception $previous = NULL) {
     $message = sprintf('The %s plugin must define the %s property.', $plugin_id, $property);
     parent::__construct($plugin_id, $message, $code, $previous);
   }
diff --git a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
index 6b7514435f29..d756f690c59c 100644
--- a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
+++ b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
@@ -58,7 +58,7 @@ public function __construct($type, \Traversable $namespaces, CacheBackendInterfa
    *
    * A specific createInstance method is necessary to pass the migration on.
    */
-  public function createInstance($plugin_id, array $configuration = [], MigrationInterface $migration = NULL) {
+  public function createInstance($plugin_id, array $configuration = [], ?MigrationInterface $migration = NULL) {
     if (str_starts_with($plugin_id, 'entity:') && !$this->entityTypeManager->getDefinition(substr($plugin_id, 7), FALSE)) {
       $plugin_id = 'null';
     }
diff --git a/core/modules/migrate/src/Plugin/MigratePluginManager.php b/core/modules/migrate/src/Plugin/MigratePluginManager.php
index 9eba756ab1be..52406191e5a0 100644
--- a/core/modules/migrate/src/Plugin/MigratePluginManager.php
+++ b/core/modules/migrate/src/Plugin/MigratePluginManager.php
@@ -59,7 +59,7 @@ public function __construct($type, \Traversable $namespaces, CacheBackendInterfa
   /**
    * {@inheritdoc}
    */
-  public function createInstance($plugin_id, array $configuration = [], MigrationInterface $migration = NULL) {
+  public function createInstance($plugin_id, array $configuration = [], ?MigrationInterface $migration = NULL) {
     $plugin_definition = $this->getDefinition($plugin_id);
     $plugin_class = DefaultFactory::getPluginClass($plugin_id, $plugin_definition);
     // If the plugin provides a factory method, pass the container to it.
diff --git a/core/modules/migrate/src/Plugin/MigratePluginManagerInterface.php b/core/modules/migrate/src/Plugin/MigratePluginManagerInterface.php
index d6ed39fdc28a..32564a5c6a76 100644
--- a/core/modules/migrate/src/Plugin/MigratePluginManagerInterface.php
+++ b/core/modules/migrate/src/Plugin/MigratePluginManagerInterface.php
@@ -24,6 +24,6 @@ interface MigratePluginManagerInterface extends PluginManagerInterface {
    * @throws \Drupal\Component\Plugin\Exception\PluginException
    *   If the instance cannot be created, such as if the ID is invalid.
    */
-  public function createInstance($plugin_id, array $configuration = [], MigrationInterface $migration = NULL);
+  public function createInstance($plugin_id, array $configuration = [], ?MigrationInterface $migration = NULL);
 
 }
diff --git a/core/modules/migrate/src/Plugin/Migration.php b/core/modules/migrate/src/Plugin/Migration.php
index 482b52337925..1b9a8b160423 100644
--- a/core/modules/migrate/src/Plugin/Migration.php
+++ b/core/modules/migrate/src/Plugin/Migration.php
@@ -383,7 +383,7 @@ public function getSourcePlugin() {
   /**
    * {@inheritdoc}
    */
-  public function getProcessPlugins(array $process = NULL) {
+  public function getProcessPlugins(?array $process = NULL) {
     if (!isset($process)) {
       $process = $this->getProcess();
     }
diff --git a/core/modules/migrate/src/Plugin/MigrationInterface.php b/core/modules/migrate/src/Plugin/MigrationInterface.php
index 507d09e5838e..1b7668fc84e8 100644
--- a/core/modules/migrate/src/Plugin/MigrationInterface.php
+++ b/core/modules/migrate/src/Plugin/MigrationInterface.php
@@ -128,7 +128,7 @@ public function getSourcePlugin();
    *   An associative array. The keys are the destination property names. Values
    *   are process pipelines. Each pipeline contains an array of plugins.
    */
-  public function getProcessPlugins(array $process = NULL);
+  public function getProcessPlugins(?array $process = NULL);
 
   /**
    * Returns the initialized destination plugin.
diff --git a/core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php b/core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php
index 0cb37bb0805e..da285b9dfd67 100644
--- a/core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php
+++ b/core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php
@@ -51,7 +51,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate/src/Plugin/migrate/destination/Config.php b/core/modules/migrate/src/Plugin/migrate/destination/Config.php
index 9ea2d73dc9c8..e2648685bd65 100644
--- a/core/modules/migrate/src/Plugin/migrate/destination/Config.php
+++ b/core/modules/migrate/src/Plugin/migrate/destination/Config.php
@@ -125,7 +125,7 @@ public function __construct(
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate/src/Plugin/migrate/destination/Entity.php b/core/modules/migrate/src/Plugin/migrate/destination/Entity.php
index 49cbf873987e..e98792ca2706 100644
--- a/core/modules/migrate/src/Plugin/migrate/destination/Entity.php
+++ b/core/modules/migrate/src/Plugin/migrate/destination/Entity.php
@@ -118,7 +118,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     $entity_type_id = static::getEntityTypeId($plugin_id);
     return new static(
       $configuration,
diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php
index 545db0802705..85b274e862ba 100644
--- a/core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php
+++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php
@@ -107,7 +107,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     $entity_type_id = static::getEntityTypeId($plugin_id);
     return new static(
       $configuration,
diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php
index 7a8b96648c42..a7bfda9f89fd 100644
--- a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php
+++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php
@@ -129,7 +129,7 @@ class EntityContentBase extends Entity implements HighestIdInterface, MigrateVal
    * @param \Drupal\Core\Session\AccountSwitcherInterface $account_switcher
    *   The account switcher service.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityFieldManagerInterface $entity_field_manager, FieldTypePluginManagerInterface $field_type_manager, AccountSwitcherInterface $account_switcher = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityFieldManagerInterface $entity_field_manager, FieldTypePluginManagerInterface $field_type_manager, ?AccountSwitcherInterface $account_switcher = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles);
     $this->entityFieldManager = $entity_field_manager;
     $this->fieldTypeManager = $field_type_manager;
@@ -139,7 +139,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     $entity_type = static::getEntityTypeId($plugin_id);
     return new static(
       $configuration,
diff --git a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
index 27ad19d326fe..5a7485772dbc 100644
--- a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
+++ b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
@@ -170,7 +170,7 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
    * @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager
    *   The migration plugin manager.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EventDispatcherInterface $event_dispatcher, MigrationPluginManagerInterface $migration_plugin_manager = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EventDispatcherInterface $event_dispatcher, ?MigrationPluginManagerInterface $migration_plugin_manager = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->migration = $migration;
     $this->eventDispatcher = $event_dispatcher;
@@ -193,7 +193,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate/src/Plugin/migrate/process/EntityExists.php b/core/modules/migrate/src/Plugin/migrate/process/EntityExists.php
index 117ebf26a316..3af401e25172 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/EntityExists.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/EntityExists.php
@@ -53,7 +53,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate/src/Plugin/migrate/process/MakeUniqueEntityField.php b/core/modules/migrate/src/Plugin/migrate/process/MakeUniqueEntityField.php
index 77e0ade9102c..48fca72df2e2 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/MakeUniqueEntityField.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/MakeUniqueEntityField.php
@@ -107,7 +107,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php b/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php
index fb8b73b7fa0b..0bddcd07e730 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php
@@ -116,7 +116,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php b/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php
index d70734482698..c8357abfc899 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php
@@ -172,7 +172,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate/src/Plugin/migrate/process/Route.php b/core/modules/migrate/src/Plugin/migrate/process/Route.php
index db2efa577445..2d0408c6920c 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/Route.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/Route.php
@@ -79,7 +79,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php b/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
index 867943abc6a5..090e93837135 100644
--- a/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
+++ b/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
@@ -116,7 +116,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php b/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php
index c8c368a1bd9b..958bfc1320e9 100644
--- a/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php
+++ b/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php
@@ -222,7 +222,7 @@ class TestSqlBase extends SqlBase {
    * @param \Drupal\migrate\Plugin\MigrationInterface $migration
    *   (optional) The migration being run.
    */
-  public function __construct(array $configuration = [], MigrationInterface $migration = NULL) {
+  public function __construct(array $configuration = [], ?MigrationInterface $migration = NULL) {
     parent::__construct($configuration, 'sql_base', ['requirements_met' => TRUE], $migration, \Drupal::state());
   }
 
diff --git a/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php b/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php
index cce492cfc34c..5f320a4da01c 100644
--- a/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php
+++ b/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php
@@ -50,7 +50,7 @@ class MigrateFieldPluginManager extends MigratePluginManager implements MigrateF
    *
    * @see \Drupal\migrate_drupal\Attribute\MigrateField
    */
-  public function getPluginIdFromFieldType($field_type, array $configuration = [], MigrationInterface $migration = NULL) {
+  public function getPluginIdFromFieldType($field_type, array $configuration = [], ?MigrationInterface $migration = NULL) {
     $core = static::DEFAULT_CORE_VERSION;
     if (!empty($configuration['core'])) {
       $core = $configuration['core'];
diff --git a/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManagerInterface.php b/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManagerInterface.php
index 7219c2b301e5..ec3575910d7d 100644
--- a/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManagerInterface.php
+++ b/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManagerInterface.php
@@ -23,6 +23,6 @@ interface MigrateFieldPluginManagerInterface extends MigratePluginManagerInterfa
    * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
    *   If the plugin cannot be determined, such as if the field type is invalid.
    */
-  public function getPluginIdFromFieldType($field_type, array $configuration = [], MigrationInterface $migration = NULL);
+  public function getPluginIdFromFieldType($field_type, array $configuration = [], ?MigrationInterface $migration = NULL);
 
 }
diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php
index 5d80f6160a77..b66e89a1feef 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php
@@ -139,7 +139,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php
index 14efa3d1634f..7ee0786dfc06 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php
@@ -87,7 +87,7 @@ public function getSystemData() {
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php
index 7c6e2608ebe7..4a2113e075e5 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php
@@ -46,7 +46,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
index e0483053e79d..bdf110bbc520 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
@@ -205,7 +205,7 @@ protected function assertIdConflictForm(array $entity_types) {
    *
    * @throws \Behat\Mink\Exception\ExpectationException
    */
-  protected function assertReviewForm(array $available_paths = NULL, array $missing_paths = NULL) {
+  protected function assertReviewForm(?array $available_paths = NULL, ?array $missing_paths = NULL) {
     $session = $this->assertSession();
     $session->pageTextContains('What will be upgraded?');
 
diff --git a/core/modules/mysql/tests/src/Kernel/mysql/SchemaTest.php b/core/modules/mysql/tests/src/Kernel/mysql/SchemaTest.php
index 424b5ce33eb2..2c19b5984e34 100644
--- a/core/modules/mysql/tests/src/Kernel/mysql/SchemaTest.php
+++ b/core/modules/mysql/tests/src/Kernel/mysql/SchemaTest.php
@@ -23,7 +23,7 @@ class SchemaTest extends DriverSpecificSchemaTestBase {
   /**
    * {@inheritdoc}
    */
-  public function checkSchemaComment(string $description, string $table, string $column = NULL): void {
+  public function checkSchemaComment(string $description, string $table, ?string $column = NULL): void {
     $comment = $this->schema->getComment($table, $column);
     $max_length = $column ? 255 : 60;
     $description = Unicode::truncate($description, $max_length, TRUE, TRUE);
diff --git a/core/modules/navigation/src/Form/LayoutForm.php b/core/modules/navigation/src/Form/LayoutForm.php
index dcc29f45f5b7..71521c899764 100644
--- a/core/modules/navigation/src/Form/LayoutForm.php
+++ b/core/modules/navigation/src/Form/LayoutForm.php
@@ -63,7 +63,7 @@ public static function create(ContainerInterface $container) {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL) {
     $form['#attributes']['class'][] = 'layout-builder-form';
     $form['layout_builder'] = [
       '#type' => 'layout_builder',
diff --git a/core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php b/core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php
index 074e13606908..e3a0882a7094 100644
--- a/core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php
+++ b/core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php
@@ -186,7 +186,7 @@ public function getRedirectUrl(): Url {
   /**
    * {@inheritdoc}
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE): AccessResultInterface | bool {
+  public function access($operation, ?AccountInterface $account = NULL, $return_as_object = FALSE): AccessResultInterface | bool {
     $result = AccessResult::allowedIfHasPermission($account, 'configure navigation layout');
     return $return_as_object ? $result : $result->isAllowed();
   }
diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php
index c9f12ec4797e..b00087d35f90 100644
--- a/core/modules/node/src/Entity/Node.php
+++ b/core/modules/node/src/Entity/Node.php
@@ -192,7 +192,7 @@ public function getType() {
   /**
    * {@inheritdoc}
    */
-  public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation = 'view', ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     // This override exists to set the operation to the default value "view".
     return parent::access($operation, $account, $return_as_object);
   }
diff --git a/core/modules/node/src/Form/NodePreviewForm.php b/core/modules/node/src/Form/NodePreviewForm.php
index 9d63f3556b88..c7333fbe4034 100644
--- a/core/modules/node/src/Form/NodePreviewForm.php
+++ b/core/modules/node/src/Form/NodePreviewForm.php
@@ -74,7 +74,7 @@ public function getFormId() {
    * @return array
    *   The form structure.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $node = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?EntityInterface $node = NULL) {
     $view_mode = $node->preview_view_mode;
 
     $query_options = ['query' => ['uuid' => $node->uuid()]];
diff --git a/core/modules/node/src/Form/NodeRevisionDeleteForm.php b/core/modules/node/src/Form/NodeRevisionDeleteForm.php
index e9ff3f86b780..46867adc481f 100644
--- a/core/modules/node/src/Form/NodeRevisionDeleteForm.php
+++ b/core/modules/node/src/Form/NodeRevisionDeleteForm.php
@@ -125,7 +125,7 @@ public function getConfirmText() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node_revision = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $node_revision = NULL) {
     $this->revision = $node_revision;
     $form = parent::buildForm($form, $form_state);
 
diff --git a/core/modules/node/src/Form/NodeRevisionRevertForm.php b/core/modules/node/src/Form/NodeRevisionRevertForm.php
index beb6ffd52597..ffb58fb71fbf 100644
--- a/core/modules/node/src/Form/NodeRevisionRevertForm.php
+++ b/core/modules/node/src/Form/NodeRevisionRevertForm.php
@@ -111,7 +111,7 @@ public function getDescription() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node_revision = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $node_revision = NULL) {
     $this->revision = $node_revision;
     $form = parent::buildForm($form, $form_state);
 
diff --git a/core/modules/node/src/NodeAccessControlHandler.php b/core/modules/node/src/NodeAccessControlHandler.php
index acfde121ea30..6d3bbbb55e34 100644
--- a/core/modules/node/src/NodeAccessControlHandler.php
+++ b/core/modules/node/src/NodeAccessControlHandler.php
@@ -86,7 +86,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
   /**
    * {@inheritdoc}
    */
-  public function access(EntityInterface $entity, $operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access(EntityInterface $entity, $operation, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $account = $this->prepareUser($account);
 
     // Only bypass if not a revision operation, to retain compatibility.
@@ -106,7 +106,7 @@ public function access(EntityInterface $entity, $operation, AccountInterface $ac
   /**
    * {@inheritdoc}
    */
-  public function createAccess($entity_bundle = NULL, AccountInterface $account = NULL, array $context = [], $return_as_object = FALSE) {
+  public function createAccess($entity_bundle = NULL, ?AccountInterface $account = NULL, array $context = [], $return_as_object = FALSE) {
     $account = $this->prepareUser($account);
 
     if ($account->hasPermission('bypass node access')) {
@@ -199,7 +199,7 @@ protected function checkCreateAccess(AccountInterface $account, array $context,
   /**
    * {@inheritdoc}
    */
-  protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+  protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
     // Only users with the administer nodes permission can edit administrative
     // fields.
     $administrative_fields = ['uid', 'status', 'created', 'promote', 'sticky'];
diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php
index 734381a2a777..8a5e29d61ad8 100644
--- a/core/modules/node/src/Plugin/Search/NodeSearch.php
+++ b/core/modules/node/src/Plugin/Search/NodeSearch.php
@@ -209,7 +209,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation = 'view', ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $result = AccessResult::allowedIfHasPermission($account, 'access content');
     return $return_as_object ? $result : $result->isAllowed();
   }
diff --git a/core/modules/node/src/Plugin/migrate/source/d6/Node.php b/core/modules/node/src/Plugin/migrate/source/d6/Node.php
index b6a135241901..84548bee0322 100644
--- a/core/modules/node/src/Plugin/migrate/source/d6/Node.php
+++ b/core/modules/node/src/Plugin/migrate/source/d6/Node.php
@@ -88,7 +88,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/node/src/Plugin/migrate/source/d7/Node.php b/core/modules/node/src/Plugin/migrate/source/d7/Node.php
index 2210a8e57580..3c4f713338fe 100644
--- a/core/modules/node/src/Plugin/migrate/source/d7/Node.php
+++ b/core/modules/node/src/Plugin/migrate/source/d7/Node.php
@@ -68,7 +68,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/node/src/Plugin/views/field/Node.php b/core/modules/node/src/Plugin/views/field/Node.php
index 2ab90944f644..1b11a4ff4b78 100644
--- a/core/modules/node/src/Plugin/views/field/Node.php
+++ b/core/modules/node/src/Plugin/views/field/Node.php
@@ -25,7 +25,7 @@ class Node extends FieldPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     // Don't add the additional fields to groupby
diff --git a/core/modules/options/options.api.php b/core/modules/options/options.api.php
index ec4ab856486b..97641b1f5290 100644
--- a/core/modules/options/options.api.php
+++ b/core/modules/options/options.api.php
@@ -80,7 +80,7 @@ function hook_options_list_alter(array &$options, array $context) {
  * @see options_test_allowed_values_callback()
  * @see options_test_dynamic_values_callback()
  */
-function callback_allowed_values_function(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL, &$cacheable = TRUE) {
+function callback_allowed_values_function(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL, &$cacheable = TRUE) {
   if (isset($entity) && ($entity->bundle() == 'not_a_programmer')) {
     $values = [
       1 => 'One',
diff --git a/core/modules/options/options.module b/core/modules/options/options.module
index b5d51690db38..c1077d66382a 100644
--- a/core/modules/options/options.module
+++ b/core/modules/options/options.module
@@ -70,7 +70,7 @@ function options_field_storage_config_delete(FieldStorageConfigInterface $field_
  *
  * @see callback_allowed_values_function()
  */
-function options_allowed_values(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL) {
+function options_allowed_values(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL) {
   $allowed_values = &drupal_static(__FUNCTION__, []);
 
   $cache_keys = [$definition->getTargetEntityTypeId(), $definition->getName()];
diff --git a/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php b/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php
index a0f49905795e..46af4ccd42cd 100644
--- a/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php
+++ b/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php
@@ -34,7 +34,7 @@ public static function defaultStorageSettings() {
   /**
    * {@inheritdoc}
    */
-  public function getPossibleValues(AccountInterface $account = NULL) {
+  public function getPossibleValues(?AccountInterface $account = NULL) {
     // Flatten options firstly, because Possible Options may contain group
     // arrays.
     $flatten_options = OptGroup::flattenOptions($this->getPossibleOptions($account));
@@ -44,14 +44,14 @@ public function getPossibleValues(AccountInterface $account = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function getPossibleOptions(AccountInterface $account = NULL) {
+  public function getPossibleOptions(?AccountInterface $account = NULL) {
     return $this->getSettableOptions($account);
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getSettableValues(AccountInterface $account = NULL) {
+  public function getSettableValues(?AccountInterface $account = NULL) {
     // Flatten options firstly, because Settable Options may contain group
     // arrays.
     $flatten_options = OptGroup::flattenOptions($this->getSettableOptions($account));
@@ -61,7 +61,7 @@ public function getSettableValues(AccountInterface $account = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function getSettableOptions(AccountInterface $account = NULL) {
+  public function getSettableOptions(?AccountInterface $account = NULL) {
     $allowed_options = options_allowed_values($this->getFieldDefinition()->getFieldStorageDefinition(), $this->getEntity());
     return $allowed_options;
   }
diff --git a/core/modules/options/src/Plugin/views/argument/NumberListField.php b/core/modules/options/src/Plugin/views/argument/NumberListField.php
index b6be54385200..eef35fbf62dd 100644
--- a/core/modules/options/src/Plugin/views/argument/NumberListField.php
+++ b/core/modules/options/src/Plugin/views/argument/NumberListField.php
@@ -32,7 +32,7 @@ class NumberListField extends NumericArgument {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $field_storage = $this->getFieldStorageDefinition();
diff --git a/core/modules/options/src/Plugin/views/argument/StringListField.php b/core/modules/options/src/Plugin/views/argument/StringListField.php
index cab1e9c67579..916e09c9cb9d 100644
--- a/core/modules/options/src/Plugin/views/argument/StringListField.php
+++ b/core/modules/options/src/Plugin/views/argument/StringListField.php
@@ -32,7 +32,7 @@ class StringListField extends StringArgument {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $field_storage = $this->getFieldStorageDefinition();
diff --git a/core/modules/options/src/Plugin/views/filter/ListField.php b/core/modules/options/src/Plugin/views/filter/ListField.php
index 262ae7cc74f1..b7f24af3d627 100644
--- a/core/modules/options/src/Plugin/views/filter/ListField.php
+++ b/core/modules/options/src/Plugin/views/filter/ListField.php
@@ -21,7 +21,7 @@ class ListField extends ManyToOne {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $field_storage = $this->getFieldStorageDefinition();
diff --git a/core/modules/options/tests/options_test/options_test.module b/core/modules/options/tests/options_test/options_test.module
index 8bcd701f0588..b754bb0bf7d3 100644
--- a/core/modules/options/tests/options_test/options_test.module
+++ b/core/modules/options/tests/options_test/options_test.module
@@ -14,7 +14,7 @@
  *
  * @see options_allowed_values()
  */
-function options_test_allowed_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL) {
+function options_test_allowed_values_callback(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL) {
   $values = [
     'Group 1' => [
       0 => 'Zero',
@@ -41,7 +41,7 @@ function options_test_allowed_values_callback(FieldStorageDefinitionInterface $d
  *
  * @see options_allowed_values()
  */
-function options_test_dynamic_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL, &$cacheable = NULL) {
+function options_test_dynamic_values_callback(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL, &$cacheable = NULL) {
   $values = [];
   if (isset($entity)) {
     $cacheable = FALSE;
diff --git a/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php b/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php
index 0836df17abca..08710f943375 100644
--- a/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php
+++ b/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php
@@ -44,7 +44,7 @@ protected function computeValue() {
   /**
    * {@inheritdoc}
    */
-  public function defaultAccess($operation = 'view', AccountInterface $account = NULL) {
+  public function defaultAccess($operation = 'view', ?AccountInterface $account = NULL) {
     if ($operation == 'view') {
       return AccessResult::allowed();
     }
diff --git a/core/modules/path_alias/src/PathProcessor/AliasPathProcessor.php b/core/modules/path_alias/src/PathProcessor/AliasPathProcessor.php
index e9e572ca5c5b..14218d4c8cc2 100644
--- a/core/modules/path_alias/src/PathProcessor/AliasPathProcessor.php
+++ b/core/modules/path_alias/src/PathProcessor/AliasPathProcessor.php
@@ -41,7 +41,7 @@ public function processInbound($path, Request $request) {
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     if (empty($options['alias'])) {
       $langcode = isset($options['language']) ? $options['language']->getId() : NULL;
       $path = $this->aliasManager->getAliasByPath($path, $langcode);
diff --git a/core/modules/pgsql/tests/src/Kernel/pgsql/SchemaTest.php b/core/modules/pgsql/tests/src/Kernel/pgsql/SchemaTest.php
index 26f7129f1763..0b4cf94a0d40 100644
--- a/core/modules/pgsql/tests/src/Kernel/pgsql/SchemaTest.php
+++ b/core/modules/pgsql/tests/src/Kernel/pgsql/SchemaTest.php
@@ -19,7 +19,7 @@ class SchemaTest extends DriverSpecificSchemaTestBase {
   /**
    * {@inheritdoc}
    */
-  public function checkSchemaComment(string $description, string $table, string $column = NULL): void {
+  public function checkSchemaComment(string $description, string $table, ?string $column = NULL): void {
     $this->assertSame($description, $this->schema->getComment($table, $column), 'The comment matches the schema description.');
   }
 
diff --git a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
index 7842194cfd8e..1072854fe526 100644
--- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
+++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
@@ -159,7 +159,7 @@ public function get(EntityInterface $entity, Request $request) {
    *
    * @throws \Symfony\Component\HttpKernel\Exception\HttpException
    */
-  public function post(EntityInterface $entity = NULL) {
+  public function post(?EntityInterface $entity = NULL) {
     if ($entity == NULL) {
       throw new BadRequestHttpException('No entity content received.');
     }
@@ -216,7 +216,7 @@ public function post(EntityInterface $entity = NULL) {
    *
    * @throws \Symfony\Component\HttpKernel\Exception\HttpException
    */
-  public function patch(EntityInterface $original_entity, EntityInterface $entity = NULL) {
+  public function patch(EntityInterface $original_entity, ?EntityInterface $entity = NULL) {
     if ($entity == NULL) {
       throw new BadRequestHttpException('No entity content received.');
     }
diff --git a/core/modules/rest/src/Plugin/views/display/RestExport.php b/core/modules/rest/src/Plugin/views/display/RestExport.php
index cc9226c4e989..b5394e335ac0 100644
--- a/core/modules/rest/src/Plugin/views/display/RestExport.php
+++ b/core/modules/rest/src/Plugin/views/display/RestExport.php
@@ -154,7 +154,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function initDisplay(ViewExecutable $view, array &$display, array &$options = NULL) {
+  public function initDisplay(ViewExecutable $view, array &$display, ?array &$options = NULL) {
     parent::initDisplay($view, $display, $options);
 
     // If the default 'json' format is not selected as a format option in the
diff --git a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php
index e0efc39d8dde..c312b48553bb 100644
--- a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php
+++ b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php
@@ -44,7 +44,7 @@ class DataFieldRow extends RowPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if (!empty($this->options['field_options'])) {
diff --git a/core/modules/rest/tests/modules/rest_test/rest_test.module b/core/modules/rest/tests/modules/rest_test/rest_test.module
index 67aa7cd54104..440f5e7aa64e 100644
--- a/core/modules/rest/tests/modules/rest_test/rest_test.module
+++ b/core/modules/rest/tests/modules/rest_test/rest_test.module
@@ -17,7 +17,7 @@
  *
  * @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::setUp()
  */
-function rest_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function rest_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   // @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::testPost()
   // @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::testPatch()
   if ($field_definition->getName() === 'field_rest_test') {
diff --git a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
index 04bf42107d4d..e142e6eaffb2 100644
--- a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
+++ b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
@@ -102,7 +102,7 @@ public function testHandle() {
  */
 class StubRequestHandlerResourcePlugin extends ResourceBase {
 
-  public function get($example = NULL, Request $request = NULL) {}
+  public function get($example = NULL, ?Request $request = NULL) {}
 
   public function post() {}
 
diff --git a/core/modules/search/src/Form/SearchPageForm.php b/core/modules/search/src/Form/SearchPageForm.php
index 06aa988ae2e7..37beb992c63d 100644
--- a/core/modules/search/src/Form/SearchPageForm.php
+++ b/core/modules/search/src/Form/SearchPageForm.php
@@ -38,7 +38,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, SearchPageInterface $search_page = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?SearchPageInterface $search_page = NULL) {
     $this->entity = $search_page;
 
     $plugin = $this->entity->getPlugin();
diff --git a/core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php b/core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php
index ab008f33302f..5730ce5e949a 100644
--- a/core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php
+++ b/core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php
@@ -59,7 +59,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     $entity_type_id = static::getEntityTypeId($plugin_id);
     return new static(
       $configuration,
diff --git a/core/modules/search/src/Plugin/views/argument/Search.php b/core/modules/search/src/Plugin/views/argument/Search.php
index 996ab4cd27c1..daa4f3e9ac1a 100644
--- a/core/modules/search/src/Plugin/views/argument/Search.php
+++ b/core/modules/search/src/Plugin/views/argument/Search.php
@@ -42,7 +42,7 @@ class Search extends ArgumentPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->searchType = $this->definition['search_type'];
diff --git a/core/modules/search/src/Plugin/views/filter/Search.php b/core/modules/search/src/Plugin/views/filter/Search.php
index b581657c9210..4f9d3f88d858 100644
--- a/core/modules/search/src/Plugin/views/filter/Search.php
+++ b/core/modules/search/src/Plugin/views/filter/Search.php
@@ -55,7 +55,7 @@ class Search extends FilterPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->searchType = $this->definition['search_type'];
diff --git a/core/modules/search/src/SearchQuery.php b/core/modules/search/src/SearchQuery.php
index 456035c22304..8370caa28122 100644
--- a/core/modules/search/src/SearchQuery.php
+++ b/core/modules/search/src/SearchQuery.php
@@ -462,7 +462,7 @@ public function prepareAndNormalize() {
   /**
    * {@inheritdoc}
    */
-  public function preExecute(SelectInterface $query = NULL) {
+  public function preExecute(?SelectInterface $query = NULL) {
     if (!$this->executedPrepare) {
       $this->prepareAndNormalize();
     }
diff --git a/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php b/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php
index 6b2e22a387f3..c5d4d5af3d2f 100644
--- a/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php
+++ b/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php
@@ -36,7 +36,7 @@ class MigrateSearchPageTest extends MigrateDrupal7TestBase {
    *
    * @internal
    */
-  protected function assertEntity(string $id, string $path, bool $status = FALSE, array $expected_config = NULL): void {
+  protected function assertEntity(string $id, string $path, bool $status = FALSE, ?array $expected_config = NULL): void {
     /** @var \Drupal\search\Entity\SearchPage $search_page */
     $search_page = SearchPage::load($id);
     $this->assertSame($id, $search_page->id());
diff --git a/core/modules/serialization/src/Encoder/JsonEncoder.php b/core/modules/serialization/src/Encoder/JsonEncoder.php
index 3d85648b8b97..478813309445 100644
--- a/core/modules/serialization/src/Encoder/JsonEncoder.php
+++ b/core/modules/serialization/src/Encoder/JsonEncoder.php
@@ -25,7 +25,7 @@ class JsonEncoder extends BaseJsonEncoder {
   /**
    * {@inheritdoc}
    */
-  public function __construct(JsonEncode $encodingImpl = NULL, JsonDecode $decodingImpl = NULL) {
+  public function __construct(?JsonEncode $encodingImpl = NULL, ?JsonDecode $decodingImpl = NULL) {
     // Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be
     // embedded into HTML.
     // @see \Symfony\Component\HttpFoundation\JsonResponse
diff --git a/core/modules/serialization/src/Normalizer/NormalizerBase.php b/core/modules/serialization/src/Normalizer/NormalizerBase.php
index f0a1e5569184..ff4ab29ef366 100644
--- a/core/modules/serialization/src/Normalizer/NormalizerBase.php
+++ b/core/modules/serialization/src/Normalizer/NormalizerBase.php
@@ -23,7 +23,7 @@ abstract class NormalizerBase implements SerializerAwareInterface, CacheableNorm
   /**
    * {@inheritdoc}
    */
-  public function supportsNormalization($data, string $format = NULL, array $context = []): bool {
+  public function supportsNormalization($data, ?string $format = NULL, array $context = []): bool {
     // If we aren't dealing with an object or the format is not supported return
     // now.
     if (!is_object($data) || !$this->checkFormat($format)) {
@@ -43,7 +43,7 @@ public function supportsNormalization($data, string $format = NULL, array $conte
    * classes do. Therefore, this method is implemented at this level to reduce
    * code duplication.
    */
-  public function supportsDenormalization($data, string $type, string $format = NULL, array $context = []): bool {
+  public function supportsDenormalization($data, string $type, ?string $format = NULL, array $context = []): bool {
     // If the format is not supported return now.
     if (!$this->checkFormat($format)) {
       return FALSE;
diff --git a/core/modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php b/core/modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php
index 0c199b8a8b39..a1d2a7f70613 100644
--- a/core/modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php
+++ b/core/modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php
@@ -27,7 +27,7 @@ public function normalize($object, $format = NULL, array $context = []): array|s
   /**
    * {@inheritdoc}
    */
-  public function supportsNormalization($data, string $format = NULL, array $context = []): bool {
+  public function supportsNormalization($data, ?string $format = NULL, array $context = []): bool {
     return static::$format === $format;
   }
 
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
index e796bb0abb1f..ee6e9463436d 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
@@ -155,7 +155,7 @@ public function createMockForContentEntity($definitions) {
    *
    * @return \Drupal\Core\Field\FieldItemListInterface|\PHPUnit\Framework\MockObject\MockObject
    */
-  protected function createMockFieldListItem($access, $internal, AccountInterface $user_context = NULL) {
+  protected function createMockFieldListItem($access, $internal, ?AccountInterface $user_context = NULL) {
     $data_definition = $this->prophesize(DataDefinitionInterface::class);
     $mock = $this->createMock('Drupal\Core\Field\FieldItemListInterface');
     $mock->expects($this->once())
diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module
index a4ff0352e24d..44ee73483044 100644
--- a/core/modules/shortcut/shortcut.module
+++ b/core/modules/shortcut/shortcut.module
@@ -55,7 +55,7 @@ function shortcut_help($route_name, RouteMatchInterface $route_match) {
  * @return \Drupal\Core\Access\AccessResultInterface
  *   The access result.
  */
-function shortcut_set_edit_access(ShortcutSetInterface $shortcut_set = NULL) {
+function shortcut_set_edit_access(?ShortcutSetInterface $shortcut_set = NULL) {
   $account = \Drupal::currentUser();
 
   // Shortcut administrators can edit any set.
diff --git a/core/modules/shortcut/src/Form/SwitchShortcutSet.php b/core/modules/shortcut/src/Form/SwitchShortcutSet.php
index 1d389d3112e5..df6f09444b22 100644
--- a/core/modules/shortcut/src/Form/SwitchShortcutSet.php
+++ b/core/modules/shortcut/src/Form/SwitchShortcutSet.php
@@ -60,7 +60,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, UserInterface $user = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?UserInterface $user = NULL) {
     $account = $this->currentUser();
 
     $this->user = $user;
@@ -223,7 +223,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    * @return \Drupal\Core\Access\AccessResultInterface
    *   The access result.
    */
-  public function checkAccess(UserInterface $user = NULL) {
+  public function checkAccess(?UserInterface $user = NULL) {
     return shortcut_set_switch_access($user);
   }
 
diff --git a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php b/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php
index f52892f4d381..acad12e210cf 100644
--- a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php
+++ b/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php
@@ -46,7 +46,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/sqlite/tests/src/Kernel/sqlite/SchemaTest.php b/core/modules/sqlite/tests/src/Kernel/sqlite/SchemaTest.php
index 6eca16676f6c..8848c8586604 100644
--- a/core/modules/sqlite/tests/src/Kernel/sqlite/SchemaTest.php
+++ b/core/modules/sqlite/tests/src/Kernel/sqlite/SchemaTest.php
@@ -16,7 +16,7 @@ class SchemaTest extends DriverSpecificSchemaTestBase {
   /**
    * {@inheritdoc}
    */
-  public function checkSchemaComment(string $description, string $table, string $column = NULL): void {
+  public function checkSchemaComment(string $description, string $table, ?string $column = NULL): void {
     // The sqlite driver schema does not support fetching table/column
     // comments.
   }
diff --git a/core/modules/system/src/Form/ThemeAdminForm.php b/core/modules/system/src/Form/ThemeAdminForm.php
index 1951f548296d..a5b2a861632a 100644
--- a/core/modules/system/src/Form/ThemeAdminForm.php
+++ b/core/modules/system/src/Form/ThemeAdminForm.php
@@ -29,7 +29,7 @@ protected function getEditableConfigNames() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, array $theme_options = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?array $theme_options = NULL) {
     // Administration theme settings.
     $form['admin_theme'] = [
       '#type' => 'details',
diff --git a/core/modules/system/src/PathBasedBreadcrumbBuilder.php b/core/modules/system/src/PathBasedBreadcrumbBuilder.php
index 749dad24f7c9..b28cba3ff6dc 100644
--- a/core/modules/system/src/PathBasedBreadcrumbBuilder.php
+++ b/core/modules/system/src/PathBasedBreadcrumbBuilder.php
@@ -119,7 +119,7 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {
    * @param \Drupal\Core\Path\PathMatcherInterface $path_matcher
    *   The path matcher service.
    */
-  public function __construct(RequestContext $context, AccessManagerInterface $access_manager, RequestMatcherInterface $router, InboundPathProcessorInterface $path_processor, ConfigFactoryInterface $config_factory, TitleResolverInterface $title_resolver, AccountInterface $current_user, CurrentPathStack $current_path, PathMatcherInterface $path_matcher = NULL) {
+  public function __construct(RequestContext $context, AccessManagerInterface $access_manager, RequestMatcherInterface $router, InboundPathProcessorInterface $path_processor, ConfigFactoryInterface $config_factory, TitleResolverInterface $title_resolver, AccountInterface $current_user, CurrentPathStack $current_path, ?PathMatcherInterface $path_matcher = NULL) {
     $this->context = $context;
     $this->accessManager = $access_manager;
     $this->router = $router;
diff --git a/core/modules/system/src/Plugin/migrate/destination/d7/ThemeSettings.php b/core/modules/system/src/Plugin/migrate/destination/d7/ThemeSettings.php
index fb3f49cb5915..c7f854bbca59 100644
--- a/core/modules/system/src/Plugin/migrate/destination/d7/ThemeSettings.php
+++ b/core/modules/system/src/Plugin/migrate/destination/d7/ThemeSettings.php
@@ -45,7 +45,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/system/tests/modules/action_test/src/Plugin/Action/NoType.php b/core/modules/system/tests/modules/action_test/src/Plugin/Action/NoType.php
index 57bcec1ef3be..a824833c78ae 100644
--- a/core/modules/system/tests/modules/action_test/src/Plugin/Action/NoType.php
+++ b/core/modules/system/tests/modules/action_test/src/Plugin/Action/NoType.php
@@ -26,7 +26,7 @@ public function execute($entity = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $result = AccessResult::allowed();
     return $return_as_object ? $result : $result->isAllowed();
   }
diff --git a/core/modules/system/tests/modules/action_test/src/Plugin/Action/SaveEntity.php b/core/modules/system/tests/modules/action_test/src/Plugin/Action/SaveEntity.php
index 2bc7e83c4078..8756aeb8c184 100644
--- a/core/modules/system/tests/modules/action_test/src/Plugin/Action/SaveEntity.php
+++ b/core/modules/system/tests/modules/action_test/src/Plugin/Action/SaveEntity.php
@@ -27,7 +27,7 @@ public function execute($entity = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     /** @var \Drupal\Core\Entity\EntityInterface $object */
     return $object->access('update', $account, $return_as_object);
   }
diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module
index d4ee147ee841..98062f1b0ffb 100644
--- a/core/modules/system/tests/modules/entity_test/entity_test.module
+++ b/core/modules/system/tests/modules/entity_test/entity_test.module
@@ -401,7 +401,7 @@ function entity_test_entity_update(EntityInterface $entity) {
  *
  * @see \Drupal\system\Tests\Entity\FieldAccessTest::testFieldAccess()
  */
-function entity_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function entity_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   if ($field_definition->getName() == 'field_test_text') {
     if ($items) {
       if ($items->value == 'no access value') {
diff --git a/core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php b/core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php
index d00395ac58b5..ba96e4cefa36 100644
--- a/core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php
+++ b/core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php
@@ -131,7 +131,7 @@ public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeI
   /**
    * {@inheritdoc}
    */
-  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
     $this->storeEvent(EntityTypeEvents::UPDATE);
   }
 
diff --git a/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/FieldTestItem.php b/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/FieldTestItem.php
index dd2c0497e265..c5d463be714e 100644
--- a/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/FieldTestItem.php
+++ b/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/FieldTestItem.php
@@ -55,7 +55,7 @@ public static function schema(FieldStorageDefinitionInterface $field_definition)
   /**
    * {@inheritdoc}
    */
-  public function __construct(DataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL) {
+  public function __construct(DataDefinitionInterface $definition, $name = NULL, ?TypedDataInterface $parent = NULL) {
     parent::__construct($definition, $name, $parent);
 
     $name = $this->getFieldDefinition()->getName();
diff --git a/core/modules/system/tests/modules/form_test/src/FormTestControllerObject.php b/core/modules/system/tests/modules/form_test/src/FormTestControllerObject.php
index 8e28437a4266..5f66c7adda09 100644
--- a/core/modules/system/tests/modules/form_test/src/FormTestControllerObject.php
+++ b/core/modules/system/tests/modules/form_test/src/FormTestControllerObject.php
@@ -42,7 +42,7 @@ public static function create(ContainerInterface $container) {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL, $custom_attributes = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?Request $request = NULL, $custom_attributes = NULL) {
     $form['element'] = ['#markup' => 'The FormTestControllerObject::buildForm() method was used for this form.'];
 
     $form['custom_attribute']['#markup'] = $custom_attributes;
diff --git a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/ContextualLink/TestContextualLink.php b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/ContextualLink/TestContextualLink.php
index 8257d32232fd..406991a46b84 100644
--- a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/ContextualLink/TestContextualLink.php
+++ b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/ContextualLink/TestContextualLink.php
@@ -13,7 +13,7 @@ class TestContextualLink extends ContextualLinkDefault {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     return "<script>alert('Welcome to the jungle!')</script>";
   }
 
diff --git a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction.php b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction.php
index 13f2e5a0235c..e2c72028b9fb 100644
--- a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction.php
+++ b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction.php
@@ -13,7 +13,7 @@ class TestLocalAction extends LocalActionDefault {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     return 'Title override';
   }
 
diff --git a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction4.php b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction4.php
index eb8b1893c5d7..653186883626 100644
--- a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction4.php
+++ b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction4.php
@@ -16,7 +16,7 @@ class TestLocalAction4 extends LocalActionDefault {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     return $this->t('My @arg action', ['@arg' => 'dynamic-title']);
   }
 
diff --git a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction5.php b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction5.php
index e960e2661305..02d118991c57 100644
--- a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction5.php
+++ b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction5.php
@@ -13,7 +13,7 @@ class TestLocalAction5 extends LocalActionDefault {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     return "<script>alert('Welcome to the jungle!')</script>";
   }
 
diff --git a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalActionWithConfig.php b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalActionWithConfig.php
index 4f56977e8690..0b461e81ecb0 100644
--- a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalActionWithConfig.php
+++ b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalActionWithConfig.php
@@ -21,7 +21,7 @@ class TestLocalActionWithConfig extends LocalActionDefault {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     return $this->config->get('title');
   }
 
diff --git a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalTask/TestTaskWithUserInput.php b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalTask/TestTaskWithUserInput.php
index 81fc22240d90..105a11879699 100644
--- a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalTask/TestTaskWithUserInput.php
+++ b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalTask/TestTaskWithUserInput.php
@@ -10,7 +10,7 @@ class TestTaskWithUserInput extends LocalTaskDefault {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     return "<script>alert('Welcome to the jungle!')</script>";
   }
 
diff --git a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalTask/TestTasksSettingsSub1.php b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalTask/TestTasksSettingsSub1.php
index 4b979c70bf49..c8e58dae141a 100644
--- a/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalTask/TestTasksSettingsSub1.php
+++ b/core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalTask/TestTasksSettingsSub1.php
@@ -18,7 +18,7 @@ class TestTasksSettingsSub1 extends LocalTaskDefault {
   /**
    * {@inheritdoc}
    */
-  public function getTitle(Request $request = NULL) {
+  public function getTitle(?Request $request = NULL) {
     return $this->t('Dynamic title for @class', ['@class' => 'TestTasksSettingsSub1']);
   }
 
diff --git a/core/modules/system/tests/modules/new_dependency_test/src/Service.php b/core/modules/system/tests/modules/new_dependency_test/src/Service.php
index 413226ea4e00..a8585018175b 100644
--- a/core/modules/system/tests/modules/new_dependency_test/src/Service.php
+++ b/core/modules/system/tests/modules/new_dependency_test/src/Service.php
@@ -22,7 +22,7 @@ class Service {
    * @param \Drupal\new_dependency_test\Service|null $inner
    *   The service to decorate.
    */
-  public function __construct(Service $inner = NULL) {
+  public function __construct(?Service $inner = NULL) {
     $this->inner = $inner;
   }
 
diff --git a/core/modules/system/tests/modules/new_dependency_test/src/ServiceWithDependency.php b/core/modules/system/tests/modules/new_dependency_test/src/ServiceWithDependency.php
index c5c57d500e70..27b2a9829d41 100644
--- a/core/modules/system/tests/modules/new_dependency_test/src/ServiceWithDependency.php
+++ b/core/modules/system/tests/modules/new_dependency_test/src/ServiceWithDependency.php
@@ -22,7 +22,7 @@ class ServiceWithDependency {
    * @param \Drupal\new_dependency_test\InjectedService|null $service
    *   The service of the same module which has the new dependency.
    */
-  public function __construct(InjectedService $service = NULL) {
+  public function __construct(?InjectedService $service = NULL) {
     $this->service = $service;
   }
 
diff --git a/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php b/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php
index 4af543f29401..1bc7d8d749a8 100644
--- a/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php
+++ b/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php
@@ -34,7 +34,7 @@ public function processInbound($path, Request $request) {
   /**
    * {@inheritdoc}
    */
-  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+  public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
     // Rewrite user/uid to user/username.
     if (preg_match('!^/user/([0-9]+)(/.*)?!', $path, $matches)) {
       if ($account = User::load($matches[1])) {
diff --git a/core/modules/system/tests/src/Functional/Menu/LinksetControllerTestBase.php b/core/modules/system/tests/src/Functional/Menu/LinksetControllerTestBase.php
index 1899690ac546..832799176521 100644
--- a/core/modules/system/tests/src/Functional/Menu/LinksetControllerTestBase.php
+++ b/core/modules/system/tests/src/Functional/Menu/LinksetControllerTestBase.php
@@ -69,7 +69,7 @@ abstract class LinksetControllerTestBase extends BrowserTestBase {
    * @return \GuzzleHttp\Psr7\Response
    *   The response object.
    */
-  protected function doRequest(string $method, Url $url, $expected_status = 200, UserInterface $account = NULL): Response {
+  protected function doRequest(string $method, Url $url, $expected_status = 200, ?UserInterface $account = NULL): Response {
     $request_options = [];
     if (!is_null($account)) {
       $credentials = $account->name->value . ':' . $account->passRaw;
diff --git a/core/modules/system/tests/src/Functional/Pager/PagerTest.php b/core/modules/system/tests/src/Functional/Pager/PagerTest.php
index d8e8ce09ce29..573a0dad4421 100644
--- a/core/modules/system/tests/src/Functional/Pager/PagerTest.php
+++ b/core/modules/system/tests/src/Functional/Pager/PagerTest.php
@@ -328,7 +328,7 @@ protected function assertPagerItems(int $current_page): void {
    *
    * @internal
    */
-  protected function assertClass(NodeElement $element, string $class, string $message = NULL): void {
+  protected function assertClass(NodeElement $element, string $class, ?string $message = NULL): void {
     if (!isset($message)) {
       $message = "Class .$class found.";
     }
@@ -347,7 +347,7 @@ protected function assertClass(NodeElement $element, string $class, string $mess
    *
    * @internal
    */
-  protected function assertNoClass(NodeElement $element, string $class, string $message = NULL): void {
+  protected function assertNoClass(NodeElement $element, string $class, ?string $message = NULL): void {
     if (!isset($message)) {
       $message = "Class .$class not found.";
     }
diff --git a/core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php b/core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php
index 706a1dd6aaf5..8049de69da6b 100644
--- a/core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php
+++ b/core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php
@@ -76,7 +76,7 @@ protected function setUp(): void {
    *
    * @dataProvider providerShowAdvisories
    */
-  public function testShowAdvisories(array $feed_item, string $existing_version = NULL): void {
+  public function testShowAdvisories(array $feed_item, ?string $existing_version = NULL): void {
     $this->setFeedItems([$feed_item]);
     if ($existing_version !== NULL) {
       $this->setExistingProjectVersion($existing_version);
@@ -247,7 +247,7 @@ public static function providerShowAdvisories(): array {
    *
    * @dataProvider providerIgnoreAdvisories
    */
-  public function testIgnoreAdvisories(array $feed_item, string $existing_version = NULL): void {
+  public function testIgnoreAdvisories(array $feed_item, ?string $existing_version = NULL): void {
     $this->setFeedItems([$feed_item]);
     if ($existing_version !== NULL) {
       $this->setExistingProjectVersion($existing_version);
diff --git a/core/modules/system/tests/src/Unit/Event/SecurityFileUploadEventSubscriberTest.php b/core/modules/system/tests/src/Unit/Event/SecurityFileUploadEventSubscriberTest.php
index b014da5019cb..50a4baed4af1 100644
--- a/core/modules/system/tests/src/Unit/Event/SecurityFileUploadEventSubscriberTest.php
+++ b/core/modules/system/tests/src/Unit/Event/SecurityFileUploadEventSubscriberTest.php
@@ -32,7 +32,7 @@ class SecurityFileUploadEventSubscriberTest extends UnitTestCase {
    *
    * @covers ::sanitizeName
    */
-  public function testSanitizeName(string $filename, string $allowed_extensions, string $expected_filename, string $expected_filename_with_insecure_uploads = NULL) {
+  public function testSanitizeName(string $filename, string $allowed_extensions, string $expected_filename, ?string $expected_filename_with_insecure_uploads = NULL) {
     // Configure insecure uploads to be renamed.
     $config_factory = $this->getConfigFactoryStub([
       'system.file' => [
diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php
index 24e16c8a0b9b..5fa49755de33 100644
--- a/core/modules/taxonomy/src/Form/OverviewTerms.php
+++ b/core/modules/taxonomy/src/Form/OverviewTerms.php
@@ -130,7 +130,7 @@ public function getFormId() {
    * @return array
    *   The form structure.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, VocabularyInterface $taxonomy_vocabulary = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?VocabularyInterface $taxonomy_vocabulary = NULL) {
     $form_state->set(['taxonomy', 'vocabulary'], $taxonomy_vocabulary);
     $vocabulary_hierarchy = $this->storageController->getVocabularyHierarchyType($taxonomy_vocabulary->id());
     $parent_fields = FALSE;
diff --git a/core/modules/taxonomy/src/Plugin/views/argument_validator/TermName.php b/core/modules/taxonomy/src/Plugin/views/argument_validator/TermName.php
index 9ed0a1bb51a7..a43dea587769 100644
--- a/core/modules/taxonomy/src/Plugin/views/argument_validator/TermName.php
+++ b/core/modules/taxonomy/src/Plugin/views/argument_validator/TermName.php
@@ -29,7 +29,7 @@ class TermName extends Entity {
   /**
    * {@inheritdoc}
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $entity_type_bundle_info);
     // Not handling exploding term names.
     $this->multipleCapable = FALSE;
diff --git a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php
index c1a3c4fa082d..d7b7de8dbb7f 100644
--- a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php
@@ -57,7 +57,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     // @todo: Wouldn't it be possible to use $this->base_table and no if here?
diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
index 79218476b5e0..77c79660904f 100644
--- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
@@ -91,7 +91,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if (!empty($this->definition['vocabulary'])) {
diff --git a/core/modules/taxonomy/src/TermStorage.php b/core/modules/taxonomy/src/TermStorage.php
index ce6347514b7f..867097b962fe 100644
--- a/core/modules/taxonomy/src/TermStorage.php
+++ b/core/modules/taxonomy/src/TermStorage.php
@@ -77,7 +77,7 @@ public function create(array $values = []) {
   /**
    * {@inheritdoc}
    */
-  public function resetCache(array $ids = NULL) {
+  public function resetCache(?array $ids = NULL) {
     $this->ancestors = [];
     $this->treeChildren = [];
     $this->treeParents = [];
diff --git a/core/modules/taxonomy/src/TermStorageSchema.php b/core/modules/taxonomy/src/TermStorageSchema.php
index 0aa097bcf763..d9e1bbf7aa85 100644
--- a/core/modules/taxonomy/src/TermStorageSchema.php
+++ b/core/modules/taxonomy/src/TermStorageSchema.php
@@ -111,7 +111,7 @@ protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $st
   /**
    * {@inheritdoc}
    */
-  protected function getDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition, ContentEntityTypeInterface $entity_type = NULL) {
+  protected function getDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition, ?ContentEntityTypeInterface $entity_type = NULL) {
     $dedicated_table_schema = parent::getDedicatedTableSchema($storage_definition, $entity_type);
 
     // Add an index on 'bundle', 'delta' and 'parent_target_id' columns to
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php
index efb8d2d73162..e05b439c434e 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php
@@ -77,7 +77,7 @@ protected function setUp(): void {
    *
    * @internal
    */
-  protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, ?string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL): void {
+  protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, ?string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], ?int $expected_field_integer_value = NULL, ?int $expected_term_reference_tid = NULL): void {
     /** @var \Drupal\taxonomy\TermInterface $entity */
     $entity = Term::load($id);
     $this->assertInstanceOf(TermInterface::class, $entity);
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php
index 113d0e2b8359..1ee4e4986f69 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php
@@ -83,7 +83,7 @@ protected function setUp(): void {
    *
    * @internal
    */
-  protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, ?string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL, int|NULL $expected_container_flag = NULL): void {
+  protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, ?string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], ?int $expected_field_integer_value = NULL, ?int $expected_term_reference_tid = NULL, int|NULL $expected_container_flag = NULL): void {
     /** @var \Drupal\taxonomy\TermInterface $entity */
     $entity = Term::load($id);
     $this->assertInstanceOf(TermInterface::class, $entity);
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php
index 1044eb116e9c..84c30acb4e11 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php
@@ -88,7 +88,7 @@ protected function setUp(): void {
    *
    * @internal
    */
-  protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, ?string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL): void {
+  protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, ?string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], ?int $expected_field_integer_value = NULL, ?int $expected_term_reference_tid = NULL): void {
     /** @var \Drupal\taxonomy\TermInterface $entity */
     $entity = Term::load($id);
     $this->assertInstanceOf(TermInterface::class, $entity);
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php
index 27c3238dc742..926d7cafffcf 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php
@@ -73,7 +73,7 @@ protected function setUp(): void {
    *
    * @internal
    */
-  protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, string $expected_description = '', string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL): void {
+  protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], ?int $expected_field_integer_value = NULL, ?int $expected_term_reference_tid = NULL): void {
     /** @var \Drupal\taxonomy\TermInterface $entity */
     $entity = Term::load($id);
     $this->assertInstanceOf(TermInterface::class, $entity);
diff --git a/core/modules/text/src/TextProcessed.php b/core/modules/text/src/TextProcessed.php
index 941317534a41..212c11440dcd 100644
--- a/core/modules/text/src/TextProcessed.php
+++ b/core/modules/text/src/TextProcessed.php
@@ -27,7 +27,7 @@ class TextProcessed extends TypedData implements CacheableDependencyInterface {
   /**
    * {@inheritdoc}
    */
-  public function __construct(DataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL) {
+  public function __construct(DataDefinitionInterface $definition, $name = NULL, ?TypedDataInterface $parent = NULL) {
     parent::__construct($definition, $name, $parent);
 
     if ($definition->getSetting('text source') === NULL) {
diff --git a/core/modules/text/tests/src/Kernel/TextSummaryTest.php b/core/modules/text/tests/src/Kernel/TextSummaryTest.php
index e6c9372c7338..89175b4a3b42 100644
--- a/core/modules/text/tests/src/Kernel/TextSummaryTest.php
+++ b/core/modules/text/tests/src/Kernel/TextSummaryTest.php
@@ -244,7 +244,7 @@ public function testInvalidFilterFormat() {
    *
    * @internal
    */
-  public function assertTextSummary(string $text, string $expected, ?string $format = NULL, int $size = NULL): void {
+  public function assertTextSummary(string $text, string $expected, ?string $format = NULL, ?int $size = NULL): void {
     $summary = text_summary($text, $format, $size);
     $this->assertSame($expected, $summary, '<pre style="white-space: pre-wrap">' . $summary . '</pre> is identical to <pre style="white-space: pre-wrap">' . $expected . '</pre>');
   }
diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php
index 23b2140fd721..991ba659171b 100644
--- a/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php
+++ b/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php
@@ -114,7 +114,7 @@ public function testToolbarCacheContextsCaller() {
    *
    * @internal
    */
-  protected function assertToolbarCacheContexts(array $cache_contexts, string $message = NULL): void {
+  protected function assertToolbarCacheContexts(array $cache_contexts, ?string $message = NULL): void {
     // Default cache contexts that should exist on all test cases.
     $default_cache_contexts = [
       'languages:language_interface',
diff --git a/core/modules/update/tests/src/Functional/UpdateTestBase.php b/core/modules/update/tests/src/Functional/UpdateTestBase.php
index 98d36f0828c9..f9afb144f00f 100644
--- a/core/modules/update/tests/src/Functional/UpdateTestBase.php
+++ b/core/modules/update/tests/src/Functional/UpdateTestBase.php
@@ -215,7 +215,7 @@ protected function confirmRevokedStatus($revoked_version, $newer_version, $new_v
    *   (optional) The expected label for the newer version. For example
    *   'Recommended version:' or 'Also available:'.
    */
-  protected function confirmUnsupportedStatus(string $unsupported_version, string $newer_version = NULL, string $new_version_label = NULL) {
+  protected function confirmUnsupportedStatus(string $unsupported_version, ?string $newer_version = NULL, ?string $new_version_label = NULL) {
     $this->drupalGet('admin/reports/updates');
     $this->clickLink('Check manually');
     $this->checkForMetaRefresh();
diff --git a/core/modules/user/src/AccountForm.php b/core/modules/user/src/AccountForm.php
index cca8d0acad41..17e9d129fc14 100644
--- a/core/modules/user/src/AccountForm.php
+++ b/core/modules/user/src/AccountForm.php
@@ -44,7 +44,7 @@ abstract class AccountForm extends ContentEntityForm implements TrustedCallbackI
    * @param \Drupal\Component\Datetime\TimeInterface $time
    *   The time service.
    */
-  public function __construct(EntityRepositoryInterface $entity_repository, LanguageManagerInterface $language_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) {
+  public function __construct(EntityRepositoryInterface $entity_repository, LanguageManagerInterface $language_manager, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, ?TimeInterface $time = NULL) {
     parent::__construct($entity_repository, $entity_type_bundle_info, $time);
     $this->languageManager = $language_manager;
   }
diff --git a/core/modules/user/src/Controller/UserController.php b/core/modules/user/src/Controller/UserController.php
index 833debaeeb13..3a6a33cfb3d4 100644
--- a/core/modules/user/src/Controller/UserController.php
+++ b/core/modules/user/src/Controller/UserController.php
@@ -383,7 +383,7 @@ public function userEditPage() {
    *   The user account name as a render array or an empty string if $user is
    *   NULL.
    */
-  public function userTitle(UserInterface $user = NULL) {
+  public function userTitle(?UserInterface $user = NULL) {
     return $user ? ['#markup' => $user->getDisplayName(), '#allowed_tags' => Xss::getHtmlTagList()] : '';
   }
 
diff --git a/core/modules/user/src/EventSubscriber/UserFloodSubscriber.php b/core/modules/user/src/EventSubscriber/UserFloodSubscriber.php
index 83538025d611..2acf9af6cbc5 100644
--- a/core/modules/user/src/EventSubscriber/UserFloodSubscriber.php
+++ b/core/modules/user/src/EventSubscriber/UserFloodSubscriber.php
@@ -26,7 +26,7 @@ class UserFloodSubscriber implements EventSubscriberInterface {
    * @param \Psr\Log\LoggerInterface $logger
    *   A logger instance.
    */
-  public function __construct(LoggerInterface $logger = NULL) {
+  public function __construct(?LoggerInterface $logger = NULL) {
     $this->logger = $logger;
   }
 
diff --git a/core/modules/user/src/Form/EntityPermissionsForm.php b/core/modules/user/src/Form/EntityPermissionsForm.php
index 48cd436145a5..41c6f140f095 100644
--- a/core/modules/user/src/Form/EntityPermissionsForm.php
+++ b/core/modules/user/src/Form/EntityPermissionsForm.php
@@ -127,7 +127,7 @@ function ($dependent_config) {
    * @param string|\Drupal\Core\Entity\EntityInterface $bundle
    *   (optional) Either the bundle name or the bundle object.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, string $bundle_entity_type = NULL, $bundle = NULL): array {
+  public function buildForm(array $form, FormStateInterface $form_state, ?string $bundle_entity_type = NULL, $bundle = NULL): array {
     // Set $this->bundle for use by ::permissionsByProvider().
     if ($bundle instanceof EntityInterface) {
       $this->bundle = $bundle;
diff --git a/core/modules/user/src/Form/UserPasswordResetForm.php b/core/modules/user/src/Form/UserPasswordResetForm.php
index a53c716e20d4..9dde77d5995f 100644
--- a/core/modules/user/src/Form/UserPasswordResetForm.php
+++ b/core/modules/user/src/Form/UserPasswordResetForm.php
@@ -40,7 +40,7 @@ public function getFormId() {
    * @param string $hash
    *   Login link hash.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, AccountInterface $user = NULL, $expiration_date = NULL, $timestamp = NULL, $hash = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?AccountInterface $user = NULL, $expiration_date = NULL, $timestamp = NULL, $hash = NULL) {
     if ($expiration_date) {
       $form['message'] = ['#markup' => $this->t('<p>This is a one-time login for %user_name and will expire on %expiration_date.</p><p>Click on this button to log in to the site and change your password.</p>', ['%user_name' => $user->getAccountName(), '%expiration_date' => $expiration_date])];
       $form['#title'] = $this->t('Reset password');
diff --git a/core/modules/user/src/Form/UserPermissionsRoleSpecificForm.php b/core/modules/user/src/Form/UserPermissionsRoleSpecificForm.php
index c9794634a0a0..24babbb80cd0 100644
--- a/core/modules/user/src/Form/UserPermissionsRoleSpecificForm.php
+++ b/core/modules/user/src/Form/UserPermissionsRoleSpecificForm.php
@@ -36,7 +36,7 @@ protected function getRoles() {
    * @param \Drupal\user\RoleInterface|null $user_role
    *   (optional) The user role used for this form. Defaults to NULL.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, RoleInterface $user_role = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?RoleInterface $user_role = NULL) {
     $this->userRole = $user_role;
     return parent::buildForm($form, $form_state);
   }
diff --git a/core/modules/user/src/Plugin/Action/BlockUser.php b/core/modules/user/src/Plugin/Action/BlockUser.php
index 560c97e33bd9..87c3a9d0ef44 100644
--- a/core/modules/user/src/Plugin/Action/BlockUser.php
+++ b/core/modules/user/src/Plugin/Action/BlockUser.php
@@ -34,7 +34,7 @@ public function execute($account = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     /** @var \Drupal\user\UserInterface $object */
     $access = $object->status->access('edit', $account, TRUE)
       ->andIf($object->access('update', $account, TRUE));
diff --git a/core/modules/user/src/Plugin/Action/CancelUser.php b/core/modules/user/src/Plugin/Action/CancelUser.php
index 68ad56ad9c6f..8933fd9e05b3 100644
--- a/core/modules/user/src/Plugin/Action/CancelUser.php
+++ b/core/modules/user/src/Plugin/Action/CancelUser.php
@@ -86,7 +86,7 @@ public function execute($object = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     /** @var \Drupal\user\UserInterface $object */
     return $object->access('delete', $account, $return_as_object);
   }
diff --git a/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php b/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php
index a7ad025de38d..adada62ebc96 100644
--- a/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php
+++ b/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php
@@ -94,7 +94,7 @@ public function calculateDependencies() {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     /** @var \Drupal\user\UserInterface $object */
     $access = $object->access('update', $account, TRUE)
       ->andIf($object->roles->access('edit', $account, TRUE));
diff --git a/core/modules/user/src/Plugin/Action/UnblockUser.php b/core/modules/user/src/Plugin/Action/UnblockUser.php
index 6df7686731bc..cdf1ddbeee71 100644
--- a/core/modules/user/src/Plugin/Action/UnblockUser.php
+++ b/core/modules/user/src/Plugin/Action/UnblockUser.php
@@ -31,7 +31,7 @@ public function execute($account = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     /** @var \Drupal\user\UserInterface $object */
     $access = $object->status->access('edit', $account, TRUE)
       ->andIf($object->access('update', $account, TRUE));
diff --git a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
index 7a285e5817ae..96f127b9fcf4 100644
--- a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
+++ b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
@@ -61,7 +61,7 @@ class UserSelection extends DefaultSelection {
    * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
    *   The entity repository.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user, Connection $connection, EntityFieldManagerInterface $entity_field_manager = NULL, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, EntityRepositoryInterface $entity_repository = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user, Connection $connection, ?EntityFieldManagerInterface $entity_field_manager = NULL, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, ?EntityRepositoryInterface $entity_repository = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $module_handler, $current_user, $entity_field_manager, $entity_type_bundle_info, $entity_repository);
 
     $this->connection = $connection;
diff --git a/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUser.php b/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUser.php
index 4f51a396afbb..0345fe24908e 100644
--- a/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUser.php
+++ b/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUser.php
@@ -26,7 +26,7 @@ class LanguageNegotiationUser extends LanguageNegotiationMethodBase {
   /**
    * {@inheritdoc}
    */
-  public function getLangcode(Request $request = NULL) {
+  public function getLangcode(?Request $request = NULL) {
     $langcode = NULL;
 
     // User preference (only for authenticated users).
diff --git a/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUserAdmin.php b/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUserAdmin.php
index a2556662a641..f9640b396793 100644
--- a/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUserAdmin.php
+++ b/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUserAdmin.php
@@ -99,7 +99,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function getLangcode(Request $request = NULL) {
+  public function getLangcode(?Request $request = NULL) {
     $langcode = NULL;
 
     // User preference (only for administrators).
diff --git a/core/modules/user/src/Plugin/Search/UserSearch.php b/core/modules/user/src/Plugin/Search/UserSearch.php
index c5d99b156a5c..cec883895d21 100644
--- a/core/modules/user/src/Plugin/Search/UserSearch.php
+++ b/core/modules/user/src/Plugin/Search/UserSearch.php
@@ -97,7 +97,7 @@ public function __construct(Connection $database, EntityTypeManagerInterface $en
   /**
    * {@inheritdoc}
    */
-  public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation = 'view', ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     $result = AccessResult::allowedIf(!empty($account) && $account->hasPermission('access user profiles'))->cachePerPermissions();
     return $return_as_object ? $result : $result->isAllowed();
   }
diff --git a/core/modules/user/src/Plugin/migrate/destination/EntityUser.php b/core/modules/user/src/Plugin/migrate/destination/EntityUser.php
index c05661bbb01f..0e4f2d0e00e2 100644
--- a/core/modules/user/src/Plugin/migrate/destination/EntityUser.php
+++ b/core/modules/user/src/Plugin/migrate/destination/EntityUser.php
@@ -97,7 +97,7 @@ class EntityUser extends EntityContentBase {
    * @param \Drupal\Core\Session\AccountSwitcherInterface|null $account_switcher
    *   The account switcher service.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityFieldManagerInterface $entity_field_manager, FieldTypePluginManagerInterface $field_type_manager, PasswordInterface $password, AccountSwitcherInterface $account_switcher = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityFieldManagerInterface $entity_field_manager, FieldTypePluginManagerInterface $field_type_manager, PasswordInterface $password, ?AccountSwitcherInterface $account_switcher = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $entity_field_manager, $field_type_manager, $account_switcher);
     $this->password = $password;
   }
@@ -105,7 +105,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     $entity_type = static::getEntityTypeId($plugin_id);
     return new static(
       $configuration,
diff --git a/core/modules/user/src/Plugin/migrate/destination/EntityUserRole.php b/core/modules/user/src/Plugin/migrate/destination/EntityUserRole.php
index 02bf9c7f2bac..5e8390454ba2 100644
--- a/core/modules/user/src/Plugin/migrate/destination/EntityUserRole.php
+++ b/core/modules/user/src/Plugin/migrate/destination/EntityUserRole.php
@@ -54,7 +54,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     $entity_type_id = static::getEntityTypeId($plugin_id);
     return new static(
       $configuration,
diff --git a/core/modules/user/src/Plugin/migrate/destination/UserData.php b/core/modules/user/src/Plugin/migrate/destination/UserData.php
index 183e3d9b901a..9ec1d0d20cce 100644
--- a/core/modules/user/src/Plugin/migrate/destination/UserData.php
+++ b/core/modules/user/src/Plugin/migrate/destination/UserData.php
@@ -43,7 +43,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php b/core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php
index b7f6f5f8ec6a..f2c9d185d3c8 100644
--- a/core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php
+++ b/core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php
@@ -96,7 +96,7 @@ public static function create(ContainerInterface $container, array $configuratio
    * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
    * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
    */
-  public function post(UserInterface $account = NULL) {
+  public function post(?UserInterface $account = NULL) {
     $this->ensureAccountCanRegister($account);
 
     // Only activate new users if visitors are allowed to register.
@@ -131,7 +131,7 @@ public function post(UserInterface $account = NULL) {
    * @param \Drupal\user\UserInterface $account
    *   The user account to register.
    */
-  protected function ensureAccountCanRegister(UserInterface $account = NULL) {
+  protected function ensureAccountCanRegister(?UserInterface $account = NULL) {
     if ($account === NULL) {
       throw new BadRequestHttpException('No user account data for registration received.');
     }
diff --git a/core/modules/user/src/Plugin/views/argument_validator/User.php b/core/modules/user/src/Plugin/views/argument_validator/User.php
index 15e169f77513..ee714080ecc2 100644
--- a/core/modules/user/src/Plugin/views/argument_validator/User.php
+++ b/core/modules/user/src/Plugin/views/argument_validator/User.php
@@ -31,7 +31,7 @@ class User extends Entity {
   /**
    * {@inheritdoc}
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $entity_type_bundle_info);
 
     $this->userStorage = $entity_type_manager->getStorage('user');
diff --git a/core/modules/user/src/Plugin/views/field/Permissions.php b/core/modules/user/src/Plugin/views/field/Permissions.php
index cad795c7fa5c..6e8d2f015e8b 100644
--- a/core/modules/user/src/Plugin/views/field/Permissions.php
+++ b/core/modules/user/src/Plugin/views/field/Permissions.php
@@ -69,7 +69,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->additional_fields['uid'] = ['table' => 'users_field_data', 'field' => 'uid'];
diff --git a/core/modules/user/src/Plugin/views/field/Roles.php b/core/modules/user/src/Plugin/views/field/Roles.php
index 45124cd0f2a9..ed121eea6ec1 100644
--- a/core/modules/user/src/Plugin/views/field/Roles.php
+++ b/core/modules/user/src/Plugin/views/field/Roles.php
@@ -53,7 +53,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->additional_fields['uid'] = ['table' => 'users_field_data', 'field' => 'uid'];
diff --git a/core/modules/user/src/Plugin/views/filter/Current.php b/core/modules/user/src/Plugin/views/filter/Current.php
index 61064e1c8a30..07871fa24afe 100644
--- a/core/modules/user/src/Plugin/views/filter/Current.php
+++ b/core/modules/user/src/Plugin/views/filter/Current.php
@@ -18,7 +18,7 @@ class Current extends BooleanOperator {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->value_value = $this->t('Is the logged in user');
diff --git a/core/modules/user/src/UserAccessControlHandler.php b/core/modules/user/src/UserAccessControlHandler.php
index 46b97cfa2e1e..6c4e9bdcfe0d 100644
--- a/core/modules/user/src/UserAccessControlHandler.php
+++ b/core/modules/user/src/UserAccessControlHandler.php
@@ -84,7 +84,7 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter
   /**
    * {@inheritdoc}
    */
-  protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+  protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
     // Fields that are not implicitly allowed to administrative users.
     $explicit_check_fields = [
       'pass',
diff --git a/core/modules/user/tests/modules/user_access_test/user_access_test.module b/core/modules/user/tests/modules/user_access_test/user_access_test.module
index 4bb79a368ea5..b149cfa30dc4 100644
--- a/core/modules/user/tests/modules/user_access_test/user_access_test.module
+++ b/core/modules/user/tests/modules/user_access_test/user_access_test.module
@@ -47,7 +47,7 @@ function user_access_test_entity_create_access(AccountInterface $account, array
 /**
  * Implements hook_entity_field_access().
  */
-function user_access_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function user_access_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   // Account with role sub-admin can view the status, init and mail fields for
   // user with no roles.
   if ($field_definition->getTargetEntityTypeId() == 'user' && $operation === 'view' && in_array($field_definition->getName(), ['status', 'init', 'mail'])) {
diff --git a/core/modules/user/tests/src/Functional/UserLoginTest.php b/core/modules/user/tests/src/Functional/UserLoginTest.php
index 2d50e7ebdacd..94a6d34d63fd 100644
--- a/core/modules/user/tests/src/Functional/UserLoginTest.php
+++ b/core/modules/user/tests/src/Functional/UserLoginTest.php
@@ -285,7 +285,7 @@ public function testCookiesNotAccepted() {
    *
    * @internal
    */
-  public function assertFailedLogin(User $account, string $flood_trigger = NULL): void {
+  public function assertFailedLogin(User $account, ?string $flood_trigger = NULL): void {
     $database = \Drupal::database();
     $edit = [
       'name' => $account->getAccountName(),
diff --git a/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php b/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php
index 9e49d76bf1e8..ab2ae11d35f2 100644
--- a/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php
+++ b/core/modules/user/tests/src/Unit/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidatorTest.php
@@ -44,7 +44,7 @@ protected function createValidator() {
   /**
    * Perform the validation.
    */
-  protected function validate($items, string $name = NULL): void {
+  protected function validate($items, ?string $name = NULL): void {
     $constraint = new ProtectedUserFieldConstraint();
 
     // If a violation is expected, then the context's addViolation method will
diff --git a/core/modules/views/src/Entity/Render/EntityFieldRenderer.php b/core/modules/views/src/Entity/Render/EntityFieldRenderer.php
index 3f051e9205d5..20fd800b84a9 100644
--- a/core/modules/views/src/Entity/Render/EntityFieldRenderer.php
+++ b/core/modules/views/src/Entity/Render/EntityFieldRenderer.php
@@ -135,7 +135,7 @@ public function query(QueryPluginBase $query, $relationship = NULL) {
    * @return array
    *   A renderable array for the entity data contained in the result row.
    */
-  public function render(ResultRow $row, EntityField $field = NULL) {
+  public function render(ResultRow $row, ?EntityField $field = NULL) {
     // The method is called for each field in each result row. In order to
     // leverage multiple-entity building of formatter output, we build the
     // render arrays for all fields in all rows on the first call.
diff --git a/core/modules/views/src/Form/ViewsForm.php b/core/modules/views/src/Form/ViewsForm.php
index 06e4d08d9d4b..5c8283d84107 100644
--- a/core/modules/views/src/Form/ViewsForm.php
+++ b/core/modules/views/src/Form/ViewsForm.php
@@ -95,7 +95,7 @@ public function __construct(ClassResolverInterface $class_resolver, UrlGenerator
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, $view_id = NULL, $view_display_id = NULL, array $view_args = NULL) {
+  public static function create(ContainerInterface $container, $view_id = NULL, $view_display_id = NULL, ?array $view_args = NULL) {
     return new static(
       $container->get('class_resolver'),
       $container->get('url_generator'),
@@ -141,7 +141,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, ViewExecutable $view = NULL, $output = []) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?ViewExecutable $view = NULL, $output = []) {
     if (!$step = $form_state->get('step')) {
       $step = 'views_form_views_form';
       $form_state->set('step', $step);
diff --git a/core/modules/views/src/Form/ViewsFormMainForm.php b/core/modules/views/src/Form/ViewsFormMainForm.php
index 8446fedcd177..ebb8be19f076 100644
--- a/core/modules/views/src/Form/ViewsFormMainForm.php
+++ b/core/modules/views/src/Form/ViewsFormMainForm.php
@@ -75,7 +75,7 @@ public static function trustedCallbacks() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, ViewExecutable $view = NULL, $output = []) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?ViewExecutable $view = NULL, $output = []) {
     $form['#prefix'] = '<div class="views-form">';
     $form['#suffix'] = '</div>';
 
diff --git a/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
index 15a4d7738aed..b907ff59fb62 100644
--- a/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
+++ b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
@@ -254,7 +254,7 @@ public function getReferenceableEntities($match = NULL, $match_operator = 'CONTA
    * @return array
    *   The results.
    */
-  protected function getDisplayExecutionResults(string $match = NULL, string $match_operator = 'CONTAINS', int $limit = 0, array $ids = NULL) {
+  protected function getDisplayExecutionResults(?string $match = NULL, string $match_operator = 'CONTAINS', int $limit = 0, ?array $ids = NULL) {
     $display_name = $this->getConfiguration()['view']['display_name'];
     $arguments = $this->getConfiguration()['view']['arguments'];
     $results = [];
diff --git a/core/modules/views/src/Plugin/views/HandlerBase.php b/core/modules/views/src/Plugin/views/HandlerBase.php
index 4b6dc42bfc08..f8eabb0b722f 100644
--- a/core/modules/views/src/Plugin/views/HandlerBase.php
+++ b/core/modules/views/src/Plugin/views/HandlerBase.php
@@ -106,7 +106,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     // Check to see if this handler type is defaulted. Note that
diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php
index dc3b2da42796..31a5979dcaa1 100644
--- a/core/modules/views/src/Plugin/views/PluginBase.php
+++ b/core/modules/views/src/Plugin/views/PluginBase.php
@@ -137,7 +137,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     $this->view = $view;
     $this->options = $this->options ?? [];
     $this->setOptionDefaults($this->options, $this->defineOptions());
@@ -560,7 +560,7 @@ public function getProvider() {
    *   Only configurable languages and languages that are in $current_values are
    *   included in the list.
    */
-  protected function listLanguages($flags = LanguageInterface::STATE_ALL, array $current_values = NULL) {
+  protected function listLanguages($flags = LanguageInterface::STATE_ALL, ?array $current_values = NULL) {
     $manager = \Drupal::languageManager();
     $languages = $manager->getLanguages($flags);
     $list = [];
diff --git a/core/modules/views/src/Plugin/views/ViewsPluginInterface.php b/core/modules/views/src/Plugin/views/ViewsPluginInterface.php
index 54933eb7294f..4304be07d8db 100644
--- a/core/modules/views/src/Plugin/views/ViewsPluginInterface.php
+++ b/core/modules/views/src/Plugin/views/ViewsPluginInterface.php
@@ -78,7 +78,7 @@ public static function preRenderAddFieldsetMarkup(array $form);
    * @param array $options
    *   The options configured for this plugin.
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL);
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL);
 
   /**
    * Handle any special handling on the validate form.
diff --git a/core/modules/views/src/Plugin/views/area/AreaPluginBase.php b/core/modules/views/src/Plugin/views/area/AreaPluginBase.php
index dda6daf883ad..d31cf7c6e3fe 100644
--- a/core/modules/views/src/Plugin/views/area/AreaPluginBase.php
+++ b/core/modules/views/src/Plugin/views/area/AreaPluginBase.php
@@ -38,7 +38,7 @@ abstract class AreaPluginBase extends HandlerBase {
    * Make sure that no result area handlers are set to be shown when the result
    * is empty.
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if ($this->areaType == 'empty') {
diff --git a/core/modules/views/src/Plugin/views/area/Entity.php b/core/modules/views/src/Plugin/views/area/Entity.php
index bde1ea4684f0..84894c942c87 100644
--- a/core/modules/views/src/Plugin/views/area/Entity.php
+++ b/core/modules/views/src/Plugin/views/area/Entity.php
@@ -88,7 +88,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
     $this->entityType = $this->definition['entity_type'];
   }
diff --git a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
index 38776044e295..8e95bff968b8 100644
--- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
+++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
@@ -134,7 +134,7 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
   /**
    * Overrides Drupal\views\Plugin\views\HandlerBase:init().
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if (!empty($this->definition['name field'])) {
diff --git a/core/modules/views/src/Plugin/views/argument/Formula.php b/core/modules/views/src/Plugin/views/argument/Formula.php
index 246e476983b8..1bfc914d5ae9 100644
--- a/core/modules/views/src/Plugin/views/argument/Formula.php
+++ b/core/modules/views/src/Plugin/views/argument/Formula.php
@@ -26,7 +26,7 @@ class Formula extends ArgumentPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if (!empty($this->definition['formula'])) {
diff --git a/core/modules/views/src/Plugin/views/argument/ManyToOne.php b/core/modules/views/src/Plugin/views/argument/ManyToOne.php
index 9fb7cae6b496..2ede2c9d4f8e 100644
--- a/core/modules/views/src/Plugin/views/argument/ManyToOne.php
+++ b/core/modules/views/src/Plugin/views/argument/ManyToOne.php
@@ -36,7 +36,7 @@ class ManyToOne extends ArgumentPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->helper = new ManyToOneHelper($this);
diff --git a/core/modules/views/src/Plugin/views/argument/StringArgument.php b/core/modules/views/src/Plugin/views/argument/StringArgument.php
index 7e542a0baf9a..35b65acfe59e 100644
--- a/core/modules/views/src/Plugin/views/argument/StringArgument.php
+++ b/core/modules/views/src/Plugin/views/argument/StringArgument.php
@@ -31,7 +31,7 @@ class StringArgument extends ArgumentPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if (!empty($this->definition['many to one'])) {
diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
index 2271afd4ff8c..8de85ffda91e 100644
--- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
@@ -162,7 +162,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
   /**
    * {@inheritdoc}
    */
-  public function initDisplay(ViewExecutable $view, array &$display, array &$options = NULL) {
+  public function initDisplay(ViewExecutable $view, array &$display, ?array &$options = NULL) {
     $this->view = $view;
 
     // Load extenders as soon as possible.
@@ -2300,7 +2300,7 @@ public function renderArea($area, $empty = FALSE) {
   /**
    * {@inheritdoc}
    */
-  public function access(AccountInterface $account = NULL) {
+  public function access(?AccountInterface $account = NULL) {
     if (!isset($account)) {
       $account = \Drupal::currentUser();
     }
diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php b/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php
index bb75dde12b1f..11b0df989119 100644
--- a/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php
+++ b/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php
@@ -42,7 +42,7 @@ interface DisplayPluginInterface {
    * @param array $options
    *   (optional) The options for the display plugin. Defaults to NULL.
    */
-  public function initDisplay(ViewExecutable $view, array &$display, array &$options = NULL);
+  public function initDisplay(ViewExecutable $view, array &$display, ?array &$options = NULL);
 
   /**
    * Destroys the display's components and the display itself.
@@ -427,7 +427,7 @@ public function renderArea($area, $empty = FALSE);
   /**
    * Determines if the user has access to this display of the view.
    */
-  public function access(AccountInterface $account = NULL);
+  public function access(?AccountInterface $account = NULL);
 
   /**
    * Sets up any variables on the view prior to execution.
diff --git a/core/modules/views/src/Plugin/views/display/Page.php b/core/modules/views/src/Plugin/views/display/Page.php
index 504a589cec6b..281ebdaa9e89 100644
--- a/core/modules/views/src/Plugin/views/display/Page.php
+++ b/core/modules/views/src/Plugin/views/display/Page.php
@@ -124,7 +124,7 @@ protected function getRoute($view_id, $display_id) {
    * @return array
    *   The page render array.
    */
-  public static function &setPageRenderArray(array &$element = NULL) {
+  public static function &setPageRenderArray(?array &$element = NULL) {
     if (isset($element)) {
       static::$pageRenderArray = &$element;
     }
@@ -176,7 +176,7 @@ protected function defineOptions() {
   /**
    * {@inheritdoc}
    */
-  public static function buildBasicRenderable($view_id, $display_id, array $args = [], Route $route = NULL) {
+  public static function buildBasicRenderable($view_id, $display_id, array $args = [], ?Route $route = NULL) {
     $build = parent::buildBasicRenderable($view_id, $display_id, $args);
 
     if ($route) {
diff --git a/core/modules/views/src/Plugin/views/field/Boolean.php b/core/modules/views/src/Plugin/views/field/Boolean.php
index d30391c740cc..a2f84c4d27fe 100644
--- a/core/modules/views/src/Plugin/views/field/Boolean.php
+++ b/core/modules/views/src/Plugin/views/field/Boolean.php
@@ -50,7 +50,7 @@ protected function defineOptions() {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $default_formats = [
diff --git a/core/modules/views/src/Plugin/views/field/BulkForm.php b/core/modules/views/src/Plugin/views/field/BulkForm.php
index 2c135158d03c..e0973053efef 100644
--- a/core/modules/views/src/Plugin/views/field/BulkForm.php
+++ b/core/modules/views/src/Plugin/views/field/BulkForm.php
@@ -137,7 +137,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $entity_type = $this->getEntityType();
diff --git a/core/modules/views/src/Plugin/views/field/EntityField.php b/core/modules/views/src/Plugin/views/field/EntityField.php
index ee811f0d3b07..4c29b9a178e3 100644
--- a/core/modules/views/src/Plugin/views/field/EntityField.php
+++ b/core/modules/views/src/Plugin/views/field/EntityField.php
@@ -210,7 +210,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->multiple = FALSE;
diff --git a/core/modules/views/src/Plugin/views/field/EntityLabel.php b/core/modules/views/src/Plugin/views/field/EntityLabel.php
index 5295e54eb309..6ac4f505c3a5 100644
--- a/core/modules/views/src/Plugin/views/field/EntityLabel.php
+++ b/core/modules/views/src/Plugin/views/field/EntityLabel.php
@@ -65,7 +65,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
     $this->additional_fields[$this->definition['entity type field']] = $this->definition['entity type field'];
   }
diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
index 148eb8fc7d41..d6eb4eb5e284 100644
--- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
@@ -138,7 +138,7 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->additional_fields = [];
diff --git a/core/modules/views/src/Plugin/views/field/Markup.php b/core/modules/views/src/Plugin/views/field/Markup.php
index 8d3b8074c6d9..2926ad8b1dc1 100644
--- a/core/modules/views/src/Plugin/views/field/Markup.php
+++ b/core/modules/views/src/Plugin/views/field/Markup.php
@@ -28,7 +28,7 @@ class Markup extends FieldPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->format = $this->definition['format'];
diff --git a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php
index 6789bdd3afc5..8e354c72edbe 100644
--- a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php
+++ b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php
@@ -103,7 +103,7 @@ public function operators() {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->value_value = $this->t('True');
diff --git a/core/modules/views/src/Plugin/views/filter/Broken.php b/core/modules/views/src/Plugin/views/filter/Broken.php
index b80a154af8f5..bec668bd12ea 100644
--- a/core/modules/views/src/Plugin/views/filter/Broken.php
+++ b/core/modules/views/src/Plugin/views/filter/Broken.php
@@ -19,7 +19,7 @@ class Broken extends FilterPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
   }
 
 }
diff --git a/core/modules/views/src/Plugin/views/filter/Bundle.php b/core/modules/views/src/Plugin/views/filter/Bundle.php
index 903fbbabd80b..ca00305cd66e 100644
--- a/core/modules/views/src/Plugin/views/filter/Bundle.php
+++ b/core/modules/views/src/Plugin/views/filter/Bundle.php
@@ -88,7 +88,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->entityTypeId = $this->getEntityType();
diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
index d79e1feca572..284faa46f549 100644
--- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
+++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
@@ -119,7 +119,7 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen
    * This likely has to be overridden by filters which are more complex
    * than simple operator/value.
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->operator = $this->options['operator'];
@@ -796,7 +796,7 @@ protected function buildGroupValidate($form, FormStateInterface $form_state) {
    *
    * @return string
    */
-  protected function validateIdentifier($identifier, FormStateInterface $form_state = NULL, &$form_group = []) {
+  protected function validateIdentifier($identifier, ?FormStateInterface $form_state = NULL, &$form_group = []) {
     $error = '';
     if (empty($identifier)) {
       $error = $this->t('The identifier is required if the filter is exposed.');
diff --git a/core/modules/views/src/Plugin/views/filter/InOperator.php b/core/modules/views/src/Plugin/views/filter/InOperator.php
index 5ff50e626d3e..fea8fdabd357 100644
--- a/core/modules/views/src/Plugin/views/filter/InOperator.php
+++ b/core/modules/views/src/Plugin/views/filter/InOperator.php
@@ -40,7 +40,7 @@ class InOperator extends FilterPluginBase implements FilterOperatorsInterface {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->valueTitle = $this->t('Options');
diff --git a/core/modules/views/src/Plugin/views/filter/ManyToOne.php b/core/modules/views/src/Plugin/views/filter/ManyToOne.php
index c0a5200a787e..ba42ba788aef 100644
--- a/core/modules/views/src/Plugin/views/filter/ManyToOne.php
+++ b/core/modules/views/src/Plugin/views/filter/ManyToOne.php
@@ -32,7 +32,7 @@ class ManyToOne extends InOperator {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->helper = new ManyToOneHelper($this);
diff --git a/core/modules/views/src/Plugin/views/pager/None.php b/core/modules/views/src/Plugin/views/pager/None.php
index f9a27373799a..69b05b85d5e8 100644
--- a/core/modules/views/src/Plugin/views/pager/None.php
+++ b/core/modules/views/src/Plugin/views/pager/None.php
@@ -24,7 +24,7 @@ class None extends PagerPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     // If the pager is set to none, then it should show all items.
diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php
index 394e3c92b351..12242518469e 100644
--- a/core/modules/views/src/Plugin/views/query/Sql.php
+++ b/core/modules/views/src/Plugin/views/query/Sql.php
@@ -186,7 +186,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $base_table = $this->view->storage->get('base_table');
@@ -449,7 +449,7 @@ public function addRelationship($alias, JoinPluginBase $join, $base, $link_point
    *   adding parts to the query. Or FALSE if the table was not able to be
    *   added.
    */
-  public function addTable($table, $relationship = NULL, JoinPluginBase $join = NULL, $alias = NULL) {
+  public function addTable($table, $relationship = NULL, ?JoinPluginBase $join = NULL, $alias = NULL) {
     if (!$this->ensurePath($table, $relationship, $join)) {
       return FALSE;
     }
@@ -488,7 +488,7 @@ public function addTable($table, $relationship = NULL, JoinPluginBase $join = NU
    *   adding parts to the query. Or FALSE if the table was not able to be
    *   added.
    */
-  public function queueTable($table, $relationship = NULL, JoinPluginBase $join = NULL, $alias = NULL) {
+  public function queueTable($table, $relationship = NULL, ?JoinPluginBase $join = NULL, $alias = NULL) {
     // If the alias is set, make sure it doesn't already exist.
     if (isset($this->tableQueue[$alias])) {
       return $alias;
@@ -595,7 +595,7 @@ protected function markTable($table, $relationship, $alias) {
    *   The alias used to refer to this specific table, or NULL if the table
    *   cannot be ensured.
    */
-  public function ensureTable($table, $relationship = NULL, JoinPluginBase $join = NULL) {
+  public function ensureTable($table, $relationship = NULL, ?JoinPluginBase $join = NULL) {
     // ensure a relationship
     if (empty($relationship)) {
       $relationship = $this->view->storage->get('base_table');
diff --git a/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php b/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php
index deafd82f4057..18d1983a1574 100644
--- a/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php
+++ b/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php
@@ -63,7 +63,7 @@ abstract class RelationshipPluginBase extends HandlerBase {
    * Init handler to let relationships live on tables other than
    * the table they operate on.
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if (isset($this->definition['relationship table'])) {
diff --git a/core/modules/views/src/Plugin/views/row/EntityRow.php b/core/modules/views/src/Plugin/views/row/EntityRow.php
index bc145caeb84b..3305ec2fe046 100644
--- a/core/modules/views/src/Plugin/views/row/EntityRow.php
+++ b/core/modules/views/src/Plugin/views/row/EntityRow.php
@@ -92,7 +92,7 @@ class EntityRow extends RowPluginBase {
    * @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository
    *   The entity display repository.
    */
-  public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, EntityRepositoryInterface $entity_repository = NULL, EntityDisplayRepositoryInterface $entity_display_repository = NULL) {
+  public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, ?EntityRepositoryInterface $entity_repository = NULL, ?EntityDisplayRepositoryInterface $entity_display_repository = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
 
     $this->entityTypeManager = $entity_type_manager;
@@ -104,7 +104,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     $this->entityTypeId = $this->definition['entity_type'];
diff --git a/core/modules/views/src/Plugin/views/sort/GroupByNumeric.php b/core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
index 50c70ab0dabc..5a16857a76f2 100644
--- a/core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
+++ b/core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
@@ -22,7 +22,7 @@ class GroupByNumeric extends SortPluginBase {
   /**
    * {@inheritdoc}
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     // Initialize the original handler.
diff --git a/core/modules/views/src/Plugin/views/style/StylePluginBase.php b/core/modules/views/src/Plugin/views/style/StylePluginBase.php
index 78c1a2d2ae90..156ed3792e32 100644
--- a/core/modules/views/src/Plugin/views/style/StylePluginBase.php
+++ b/core/modules/views/src/Plugin/views/style/StylePluginBase.php
@@ -124,7 +124,7 @@ abstract class StylePluginBase extends PluginBase {
    * The style options might come externally as the style can be sourced from at
    * least two locations. If it's not included, look on the display.
    */
-  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
+  public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
     parent::init($view, $display, $options);
 
     if ($this->usesRowPlugin() && $display->getOption('row')) {
diff --git a/core/modules/views/tests/modules/action_bulk_test/src/Plugin/Action/TestAction.php b/core/modules/views/tests/modules/action_bulk_test/src/Plugin/Action/TestAction.php
index 9e60d2895b90..d77f1508c546 100644
--- a/core/modules/views/tests/modules/action_bulk_test/src/Plugin/Action/TestAction.php
+++ b/core/modules/views/tests/modules/action_bulk_test/src/Plugin/Action/TestAction.php
@@ -23,7 +23,7 @@ class TestAction extends ActionBase {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE): bool|AccessResultInterface {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE): bool|AccessResultInterface {
     return $return_as_object ? AccessResult::allowed() : TRUE;
   }
 
diff --git a/core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php b/core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php
index c494903ecaca..6bc8fce889e5 100644
--- a/core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php
+++ b/core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php
@@ -56,7 +56,7 @@ public function execute($entity = NULL) {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     return TRUE;
   }
 
diff --git a/core/modules/views/tests/modules/views_entity_test/views_entity_test.module b/core/modules/views/tests/modules/views_entity_test/views_entity_test.module
index 7d80e84c7857..61d454cf1679 100644
--- a/core/modules/views/tests/modules/views_entity_test/views_entity_test.module
+++ b/core/modules/views/tests/modules/views_entity_test/views_entity_test.module
@@ -34,7 +34,7 @@ function views_entity_test_entity_base_field_info(EntityTypeInterface $entity_ty
  *
  * @see \Drupal\system\Tests\Entity\FieldAccessTest::testFieldAccess()
  */
-function views_entity_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
+function views_entity_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
   if ($field_definition->getName() == 'test_text_access') {
     if ($items) {
       if ($items->value == 'no access value') {
diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php
index 82392489840f..96dafd635501 100644
--- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php
+++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php
@@ -75,7 +75,7 @@ public function addOrderBy($table, $field = NULL, $order = 'ASC', $alias = '', $
     $this->orderBy = ['field' => $field, 'order' => $order];
   }
 
-  public function ensureTable($table, $relationship = NULL, JoinPluginBase $join = NULL) {
+  public function ensureTable($table, $relationship = NULL, ?JoinPluginBase $join = NULL) {
     // There is no concept of joins.
   }
 
diff --git a/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php b/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php
index a535e971eeef..f05589b85021 100644
--- a/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php
@@ -207,7 +207,7 @@ public function testBuildFailed() {
 
 if (!function_exists('views_add_contextual_links')) {
 
-  function views_add_contextual_links(&$render_element, $location, $display_id, array $view_element = NULL) {
+  function views_add_contextual_links(&$render_element, $location, $display_id, ?array $view_element = NULL) {
   }
 
 }
diff --git a/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php b/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php
index 57db7fe28718..81a003915485 100644
--- a/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php
+++ b/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php
@@ -190,7 +190,7 @@ public function testHandleWithArgumentsOnOverriddenRouteWithUpcasting() {
 
 if (!function_exists('views_add_contextual_links')) {
 
-  function views_add_contextual_links(&$render_element, $location, $display_id, array $view_element = NULL) {
+  function views_add_contextual_links(&$render_element, $location, $display_id, ?array $view_element = NULL) {
   }
 
 }
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index 0735b1de872e..a85f945b4be9 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -363,7 +363,7 @@ function views_theme_suggestions_container_alter(array &$suggestions, array $var
  * @see \Drupal\views\Plugin\Block\ViewsBlock::addContextualLinks()
  * @see template_preprocess_views_view()
  */
-function views_add_contextual_links(&$render_element, $location, $display_id, array $view_element = NULL) {
+function views_add_contextual_links(&$render_element, $location, $display_id, ?array $view_element = NULL) {
   if (!isset($view_element)) {
     $view_element = $render_element;
   }
diff --git a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
index c00d4696b228..8d6cadad4dde 100644
--- a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
+++ b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
@@ -49,7 +49,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?Request $request = NULL) {
     /** @var \Drupal\views\Entity\View $view */
     $view = $form_state->get('view');
     $display_id = $form_state->get('display_id');
diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php
index b73ca002174a..ab6c3d1ac375 100644
--- a/core/modules/views_ui/src/ViewUI.php
+++ b/core/modules/views_ui/src/ViewUI.php
@@ -982,7 +982,7 @@ public static function load($id) {
   /**
    * {@inheritdoc}
    */
-  public static function loadMultiple(array $ids = NULL) {
+  public static function loadMultiple(?array $ids = NULL) {
     return View::loadMultiple($ids);
   }
 
@@ -1052,7 +1052,7 @@ public function language() {
   /**
    * {@inheritdoc}
    */
-  public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($operation = 'view', ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     return $this->storage->access($operation, $account, $return_as_object);
   }
 
diff --git a/core/modules/workflows/src/Form/WorkflowStateDeleteForm.php b/core/modules/workflows/src/Form/WorkflowStateDeleteForm.php
index fd0fa43f2123..c2acdfed4e6d 100644
--- a/core/modules/workflows/src/Form/WorkflowStateDeleteForm.php
+++ b/core/modules/workflows/src/Form/WorkflowStateDeleteForm.php
@@ -71,7 +71,7 @@ public function getConfirmText() {
    * @return array
    *   The form structure.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, WorkflowInterface $workflow = NULL, $workflow_state = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?WorkflowInterface $workflow = NULL, $workflow_state = NULL) {
     if (!$workflow->getTypePlugin()->hasState($workflow_state)) {
       throw new NotFoundHttpException();
     }
diff --git a/core/modules/workflows/src/Form/WorkflowTransitionDeleteForm.php b/core/modules/workflows/src/Form/WorkflowTransitionDeleteForm.php
index 1fee5d415791..22c939c8a755 100644
--- a/core/modules/workflows/src/Form/WorkflowTransitionDeleteForm.php
+++ b/core/modules/workflows/src/Form/WorkflowTransitionDeleteForm.php
@@ -78,7 +78,7 @@ public function getConfirmText() {
    * @return array
    *   The form structure.
    */
-  public function buildForm(array $form, FormStateInterface $form_state, WorkflowInterface $workflow = NULL, $workflow_transition = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?WorkflowInterface $workflow = NULL, $workflow_transition = NULL) {
     try {
       $this->transition = $workflow->getTypePlugin()->getTransition($workflow_transition);
     }
diff --git a/core/modules/workflows/src/Plugin/WorkflowTypeBase.php b/core/modules/workflows/src/Plugin/WorkflowTypeBase.php
index 959df2ebb5c3..47488b38801b 100644
--- a/core/modules/workflows/src/Plugin/WorkflowTypeBase.php
+++ b/core/modules/workflows/src/Plugin/WorkflowTypeBase.php
@@ -258,7 +258,7 @@ public function addTransition($transition_id, $label, array $from_state_ids, $to
   /**
    * {@inheritdoc}
    */
-  public function getTransitions(array $transition_ids = NULL) {
+  public function getTransitions(?array $transition_ids = NULL) {
     if ($transition_ids === NULL) {
       $transition_ids = array_keys($this->configuration['transitions']);
     }
diff --git a/core/modules/workflows/src/WorkflowTypeInterface.php b/core/modules/workflows/src/WorkflowTypeInterface.php
index 37901e5ad30c..36a7f4a40bc9 100644
--- a/core/modules/workflows/src/WorkflowTypeInterface.php
+++ b/core/modules/workflows/src/WorkflowTypeInterface.php
@@ -241,7 +241,7 @@ public function hasTransition($transition_id);
    * @throws \InvalidArgumentException
    *   Thrown if $transition_ids contains a transition ID that does not exist.
    */
-  public function getTransitions(array $transition_ids = NULL);
+  public function getTransitions(?array $transition_ids = NULL);
 
   /**
    * Gets the transitions for a state for the provided direction.
diff --git a/core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php b/core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php
index a7e32b1c147a..7550077555b5 100644
--- a/core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php
+++ b/core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php
@@ -109,7 +109,7 @@ public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeI
   /**
    * {@inheritdoc}
    */
-  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL) {
+  public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, ?array &$sandbox = NULL) {
     $this->onEntityTypeUpdate($entity_type, $original);
   }
 
diff --git a/core/modules/workspaces/src/Form/WorkspaceDeleteForm.php b/core/modules/workspaces/src/Form/WorkspaceDeleteForm.php
index 4fdb1b691258..8f4ff979047e 100644
--- a/core/modules/workspaces/src/Form/WorkspaceDeleteForm.php
+++ b/core/modules/workspaces/src/Form/WorkspaceDeleteForm.php
@@ -67,7 +67,7 @@ public static function create(ContainerInterface $container) {
    * @param \Drupal\Component\Datetime\TimeInterface $time
    *   The time service.
    */
-  public function __construct(EntityRepositoryInterface $entity_repository, WorkspaceAssociationInterface $workspace_association, WorkspaceRepositoryInterface $workspace_repository, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) {
+  public function __construct(EntityRepositoryInterface $entity_repository, WorkspaceAssociationInterface $workspace_association, WorkspaceRepositoryInterface $workspace_repository, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, ?TimeInterface $time = NULL) {
     parent::__construct($entity_repository, $entity_type_bundle_info, $time);
     $this->workspaceAssociation = $workspace_association;
     $this->workspaceRepository = $workspace_repository;
diff --git a/core/modules/workspaces/src/Form/WorkspaceMergeForm.php b/core/modules/workspaces/src/Form/WorkspaceMergeForm.php
index 046a1a13d78d..671895ceb3ec 100644
--- a/core/modules/workspaces/src/Form/WorkspaceMergeForm.php
+++ b/core/modules/workspaces/src/Form/WorkspaceMergeForm.php
@@ -78,7 +78,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, WorkspaceInterface $source_workspace = NULL, WorkspaceInterface $target_workspace = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?WorkspaceInterface $source_workspace = NULL, ?WorkspaceInterface $target_workspace = NULL) {
     $this->sourceWorkspace = $source_workspace;
     $this->targetWorkspace = $target_workspace;
 
diff --git a/core/modules/workspaces/src/Form/WorkspacePublishForm.php b/core/modules/workspaces/src/Form/WorkspacePublishForm.php
index 35570089bab8..5d5b59182a28 100644
--- a/core/modules/workspaces/src/Form/WorkspacePublishForm.php
+++ b/core/modules/workspaces/src/Form/WorkspacePublishForm.php
@@ -72,7 +72,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, WorkspaceInterface $workspace = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?WorkspaceInterface $workspace = NULL) {
     $this->workspace = $workspace;
 
     $form = parent::buildForm($form, $form_state);
diff --git a/core/modules/workspaces/src/WorkspaceAssociation.php b/core/modules/workspaces/src/WorkspaceAssociation.php
index 4a6d8825d392..02d6924c4e4b 100644
--- a/core/modules/workspaces/src/WorkspaceAssociation.php
+++ b/core/modules/workspaces/src/WorkspaceAssociation.php
@@ -152,7 +152,7 @@ public function getTrackedEntities($workspace_id, $entity_type_id = NULL, $entit
   /**
    * {@inheritdoc}
    */
-  public function getTrackedEntitiesForListing($workspace_id, int $pager_id = NULL, int|false $limit = 50): array {
+  public function getTrackedEntitiesForListing($workspace_id, ?int $pager_id = NULL, int|false $limit = 50): array {
     $query = $this->database->select(static::TABLE)
       ->extend(PagerSelectExtender::class)
       ->limit($limit);
diff --git a/core/modules/workspaces/src/WorkspaceAssociationInterface.php b/core/modules/workspaces/src/WorkspaceAssociationInterface.php
index f65b11c1cf2d..5b79609ea2c0 100644
--- a/core/modules/workspaces/src/WorkspaceAssociationInterface.php
+++ b/core/modules/workspaces/src/WorkspaceAssociationInterface.php
@@ -69,7 +69,7 @@ public function getTrackedEntities($workspace_id, $entity_type_id = NULL, $entit
    *   Returns a multidimensional array where the first level keys are entity
    *   type IDs and the values are an array of entity IDs keyed by revision IDs.
    */
-  public function getTrackedEntitiesForListing($workspace_id, int $pager_id = NULL, int|false $limit = 50): array;
+  public function getTrackedEntitiesForListing($workspace_id, ?int $pager_id = NULL, int|false $limit = 50): array;
 
   /**
    * Retrieves all content revisions tracked by a given workspace.
diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist
index a5d9f759ec43..00205148bc03 100644
--- a/core/phpcs.xml.dist
+++ b/core/phpcs.xml.dist
@@ -278,6 +278,7 @@
     <!-- @todo remove this in https://www.drupal.org/project/drupal/issues/3402707 -->
     <exclude-pattern>./tests/Drupal/KernelTests/AssertContentTrait.php</exclude-pattern>
   </rule>
+  <rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
 
   <!-- Squiz sniffs -->
   <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
diff --git a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
index afdd7fcbcb55..11774331a81f 100644
--- a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
+++ b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
@@ -547,7 +547,7 @@ protected function getPortNumber() {
    *   (optional) Relative path within the test workspace file system that will
    *   contain the copy of the codebase. Defaults to the workspace directory.
    */
-  public function copyCodebase(\Iterator $iterator = NULL, $working_dir = NULL) {
+  public function copyCodebase(?\Iterator $iterator = NULL, $working_dir = NULL) {
     $working_path = $this->getWorkingPath($working_dir);
 
     if ($iterator === NULL) {
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php
index 96484e3c46bd..2086e2783c0d 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php
@@ -593,7 +593,7 @@ public static function isExceptionNotClickable(Exception $exception): bool {
    * @param int $timeout
    *   Optional timeout in milliseconds, defaults to 10000.
    */
-  public function statusMessageExistsAfterWait(string $type = NULL, int $timeout = 10000): void {
+  public function statusMessageExistsAfterWait(?string $type = NULL, int $timeout = 10000): void {
     $selector = $this->buildJavascriptStatusMessageSelector(NULL, $type);
     $status_message_element = $this->waitForElement('xpath', $selector, $timeout);
     if ($type) {
@@ -615,7 +615,7 @@ public function statusMessageExistsAfterWait(string $type = NULL, int $timeout =
    * @param int $timeout
    *   Optional timeout in milliseconds, defaults to 10000.
    */
-  public function statusMessageNotExistsAfterWait(string $type = NULL, int $timeout = 10000): void {
+  public function statusMessageNotExistsAfterWait(?string $type = NULL, int $timeout = 10000): void {
     $selector = $this->buildJavascriptStatusMessageSelector(NULL, $type);
     $status_message_element = $this->waitForElement('xpath', $selector, $timeout);
     if ($type) {
@@ -637,7 +637,7 @@ public function statusMessageNotExistsAfterWait(string $type = NULL, int $timeou
    * @param int $timeout
    *   Optional timeout in milliseconds, defaults to 10000.
    */
-  public function statusMessageContainsAfterWait(string $message, string $type = NULL, int $timeout = 10000): void {
+  public function statusMessageContainsAfterWait(string $message, ?string $type = NULL, int $timeout = 10000): void {
     $selector = $this->buildJavascriptStatusMessageSelector($message, $type);
     $status_message_element = $this->waitForElement('xpath', $selector, $timeout);
     if ($type) {
@@ -661,7 +661,7 @@ public function statusMessageContainsAfterWait(string $message, string $type = N
    * @param int $timeout
    *   Optional timeout in milliseconds, defaults to 10000.
    */
-  public function statusMessageNotContainsAfterWait(string $message, string $type = NULL, int $timeout = 10000): void {
+  public function statusMessageNotContainsAfterWait(string $message, ?string $type = NULL, int $timeout = 10000): void {
     $selector = $this->buildJavascriptStatusMessageSelector($message, $type);
     $status_message_element = $this->waitForElement('xpath', $selector, $timeout);
     if ($type) {
@@ -691,7 +691,7 @@ public function statusMessageNotContainsAfterWait(string $message, string $type
    * @throws \InvalidArgumentException
    *   Thrown when $type is not an allowed type.
    */
-  private function buildJavascriptStatusMessageSelector(string $message = NULL, string $type = NULL): string {
+  private function buildJavascriptStatusMessageSelector(?string $message = NULL, ?string $type = NULL): string {
     $allowed_types = [
       'status',
       'error',
diff --git a/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php b/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
index 470596a8751d..dd0fdbd9614b 100644
--- a/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
+++ b/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
@@ -130,7 +130,7 @@ protected function doTestAggregation(array $settings): void {
    * @param string|null $content_type
    *   The expected content type, or NULL to skip checking.
    */
-  protected function assertAggregate(string $url, bool $from_php = TRUE, string $content_type = NULL): void {
+  protected function assertAggregate(string $url, bool $from_php = TRUE, ?string $content_type = NULL): void {
     $url = $this->getAbsoluteUrl($url);
     if (!stripos($url, $this->fileAssetsPath) !== FALSE) {
       return;
diff --git a/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php
index 3d057a793193..9fd06a29d390 100644
--- a/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php
@@ -306,7 +306,7 @@ protected function activateTheme($theme_name) {
    *
    * @internal
    */
-  protected function assertAssetInLibrary(string $asset, string $extension, string $library_name, string $sub_key, string $message = NULL): void {
+  protected function assertAssetInLibrary(string $asset, string $extension, string $library_name, string $sub_key, ?string $message = NULL): void {
     if (!isset($message)) {
       $message = sprintf('Asset %s found in library "%s/%s"', $asset, $extension, $library_name);
     }
@@ -335,7 +335,7 @@ protected function assertAssetInLibrary(string $asset, string $extension, string
    *
    * @internal
    */
-  protected function assertNoAssetInLibrary(string $asset, string $extension, string $library_name, string $sub_key, string $message = NULL): void {
+  protected function assertNoAssetInLibrary(string $asset, string $extension, string $library_name, string $sub_key, ?string $message = NULL): void {
     if (!isset($message)) {
       $message = sprintf('Asset %s not found in library "%s/%s"', $asset, $extension, $library_name);
     }
diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php
index 3c520012d27f..d8f410aca2b1 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php
@@ -53,7 +53,7 @@ protected function setUp(): void {
    * @param string|null $column
    *   Optional column to test.
    */
-  abstract public function checkSchemaComment(string $description, string $table, string $column = NULL): void;
+  abstract public function checkSchemaComment(string $description, string $table, ?string $column = NULL): void;
 
   /**
    * Tests inserting data into an existing table.
diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
index 609fda1bf2de..6fd3182ea270 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
@@ -492,7 +492,7 @@ protected function cleanUp() {
    *
    * @internal
    */
-  public function assertRowPresent(string $name, string $message = NULL): void {
+  public function assertRowPresent(string $name, ?string $message = NULL): void {
     $present = (boolean) $this->connection->query('SELECT 1 FROM {test} WHERE [name] = :name', [':name' => $name])->fetchField();
     $this->assertTrue($present, $message ?? "Row '{$name}' should be present, but it actually does not exist.");
   }
@@ -507,7 +507,7 @@ public function assertRowPresent(string $name, string $message = NULL): void {
    *
    * @internal
    */
-  public function assertRowAbsent(string $name, string $message = NULL): void {
+  public function assertRowAbsent(string $name, ?string $message = NULL): void {
     $present = (boolean) $this->connection->query('SELECT 1 FROM {test} WHERE [name] = :name', [':name' => $name])->fetchField();
     $this->assertFalse($present, $message ?? "Row '{$name}' should be absent, but it actually exists.");
   }
diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php
index ffb9f5540dfe..eb8dd5f64b17 100644
--- a/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php
@@ -44,7 +44,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function datelistDateCallbackTrusted(array &$element, FormStateInterface $form_state, DrupalDateTime $date = NULL) {
+  public function datelistDateCallbackTrusted(array &$element, FormStateInterface $form_state, ?DrupalDateTime $date = NULL) {
     $element['datelistDateCallbackExecuted'] = [
       '#value' => TRUE,
     ];
@@ -54,7 +54,7 @@ public function datelistDateCallbackTrusted(array &$element, FormStateInterface
   /**
    * {@inheritdoc}
    */
-  public function datelistDateCallback(array &$element, FormStateInterface $form_state, DrupalDateTime $date = NULL) {
+  public function datelistDateCallback(array &$element, FormStateInterface $form_state, ?DrupalDateTime $date = NULL) {
     $element['datelistDateCallbackExecuted'] = [
       '#value' => TRUE,
     ];
diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php
index 80689d3865a7..12792adb067c 100644
--- a/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php
@@ -44,7 +44,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function datetimeDateCallbackTrusted(array &$element, FormStateInterface $form_state, DrupalDateTime $date = NULL) {
+  public function datetimeDateCallbackTrusted(array &$element, FormStateInterface $form_state, ?DrupalDateTime $date = NULL) {
     $element['datetimeDateCallbackExecuted'] = [
       '#value' => TRUE,
     ];
@@ -54,7 +54,7 @@ public function datetimeDateCallbackTrusted(array &$element, FormStateInterface
   /**
    * {@inheritdoc}
    */
-  public static function datetimeDateCallback(array &$element, FormStateInterface $form_state, DrupalDateTime $date = NULL) {
+  public static function datetimeDateCallback(array &$element, FormStateInterface $form_state, ?DrupalDateTime $date = NULL) {
     $element['datetimeDateCallbackExecuted'] = [
       '#value' => TRUE,
     ];
@@ -64,7 +64,7 @@ public static function datetimeDateCallback(array &$element, FormStateInterface
   /**
    * {@inheritdoc}
    */
-  public function datetimeTimeCallbackTrusted(array &$element, FormStateInterface $form_state, DrupalDateTime $date = NULL) {
+  public function datetimeTimeCallbackTrusted(array &$element, FormStateInterface $form_state, ?DrupalDateTime $date = NULL) {
     $element['timeCallbackExecuted'] = [
       '#value' => TRUE,
     ];
@@ -74,7 +74,7 @@ public function datetimeTimeCallbackTrusted(array &$element, FormStateInterface
   /**
    * {@inheritdoc}
    */
-  public static function datetimeTimeCallback(array &$element, FormStateInterface $form_state, DrupalDateTime $date = NULL) {
+  public static function datetimeTimeCallback(array &$element, FormStateInterface $form_state, ?DrupalDateTime $date = NULL) {
     $element['timeCallbackExecuted'] = [
       '#value' => TRUE,
     ];
@@ -159,7 +159,7 @@ public function testDatetimeElement() {
    * @dataProvider providerUntrusted
    * @group legacy
    */
-  public function testDatetimeElementUntrustedCallbacks(string $date_callback = 'datetimeDateCallbackTrusted', string $time_callback = 'datetimeTimeCallbackTrusted', string $expected_exception = NULL) : void {
+  public function testDatetimeElementUntrustedCallbacks(string $date_callback = 'datetimeDateCallbackTrusted', string $time_callback = 'datetimeTimeCallbackTrusted', ?string $expected_exception = NULL) : void {
     if ($expected_exception) {
       $this->expectException(UntrustedCallbackException::class);
       $this->expectExceptionMessage($expected_exception);
diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
index e3d3b2f5d2ee..37bda0da403d 100644
--- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
+++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
@@ -56,7 +56,7 @@ protected function bootKernel() {
    * @return \Drupal\Core\DrupalKernel
    *   New kernel for testing.
    */
-  protected function getTestKernel(Request $request, array $modules_enabled = NULL) {
+  protected function getTestKernel(Request $request, ?array $modules_enabled = NULL) {
     // Manually create kernel to avoid replacing settings.
     $class_loader = require $this->root . '/autoload.php';
     $kernel = DrupalKernel::createFromRequest($request, $class_loader, 'testing');
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
index 07c9797120f5..933f8566f5e3 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
@@ -43,7 +43,7 @@ protected function setUp(): void {
    *
    * @internal
    */
-  public function assertEntityAccess(array $ops, AccessibleInterface $object, AccountInterface $account = NULL): void {
+  public function assertEntityAccess(array $ops, AccessibleInterface $object, ?AccountInterface $account = NULL): void {
     foreach ($ops as $op => $result) {
       $message = new FormattableMarkup("Entity access returns @result with operation '@op'.", [
         '@result' => !isset($result) ? 'null' : ($result ? 'true' : 'false'),
diff --git a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
index fd7dc6c65213..582f395ebfbf 100644
--- a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
+++ b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
@@ -92,7 +92,7 @@ class TestSiteInstallCommand extends Command {
    * @todo Remove and fix test to not rely on super user.
    * @see https://www.drupal.org/project/drupal/issues/3437620
    */
-  public function __construct(string $name = NULL) {
+  public function __construct(?string $name = NULL) {
     parent::__construct($name);
     $this->usesSuperUserAccessPolicy = TRUE;
   }
diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php
index 486e86def42d..d0027e137430 100644
--- a/core/tests/Drupal/Tests/BrowserTestBase.php
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -526,7 +526,7 @@ protected function getHttpClient() {
    * @return array
    *   Associative array of option keys and values.
    */
-  protected function getOptions($select, Element $container = NULL) {
+  protected function getOptions($select, ?Element $container = NULL) {
     if (is_string($select)) {
       $select = $this->assertSession()->selectExists($select, $container);
     }
diff --git a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
index ed1f19a68686..271bef19ca0b 100644
--- a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
+++ b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
@@ -432,7 +432,7 @@ public function methodWithParameter($parameter) {
 
 class TestServiceComplexMethod {
 
-  public function complexMethod(string $parameter, callable $function, TestServiceNoMethod $test_service = NULL, array &$elements = []): array {
+  public function complexMethod(string $parameter, callable $function, ?TestServiceNoMethod $test_service = NULL, array &$elements = []): array {
     return [];
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php b/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php
index c50b832aa72a..ce176d262990 100644
--- a/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php
+++ b/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php
@@ -91,7 +91,7 @@ public static function providerTestPhpTransliterationRemoveDiacritics() {
    *
    * @dataProvider providerTestPhpTransliteration
    */
-  public function testPhpTransliteration(string $langcode, string $original, string $expected, string $unknown_character = '?', int $max_length = NULL): void {
+  public function testPhpTransliteration(string $langcode, string $original, string $expected, string $unknown_character = '?', ?int $max_length = NULL): void {
     $transliterator_class = new PhpTransliteration();
     $actual = $transliterator_class->transliterate($original, $langcode, $unknown_character, $max_length);
     $this->assertSame($expected, $actual);
diff --git a/core/tests/Drupal/Tests/Component/Utility/XssTest.php b/core/tests/Drupal/Tests/Component/Utility/XssTest.php
index 27ed10a57c59..e25dd3e5dfc9 100644
--- a/core/tests/Drupal/Tests/Component/Utility/XssTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/XssTest.php
@@ -68,7 +68,7 @@ protected function setUp(): void {
    *
    * @dataProvider providerTestFilterXssNormalized
    */
-  public function testFilterXssNormalized($value, $expected, $message, array $allowed_tags = NULL) {
+  public function testFilterXssNormalized($value, $expected, $message, ?array $allowed_tags = NULL) {
     if ($allowed_tags === NULL) {
       $value = Xss::filter($value);
     }
@@ -135,7 +135,7 @@ public static function providerTestFilterXssNormalized() {
    *
    * @dataProvider providerTestFilterXssNotNormalized
    */
-  public function testFilterXssNotNormalized($value, $expected, $message, array $allowed_tags = NULL) {
+  public function testFilterXssNotNormalized($value, $expected, $message, ?array $allowed_tags = NULL) {
     if ($allowed_tags === NULL) {
       $value = Xss::filter($value);
     }
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php
index b25c5072a98b..624aaa59f6cd 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php
@@ -237,7 +237,7 @@ public function appendOp($project_name, $source) {
    *
    * @see \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::destinationPath()
    */
-  public function destinationPath($destination, Interpolator $interpolator = NULL, $package_name = NULL) {
+  public function destinationPath($destination, ?Interpolator $interpolator = NULL, $package_name = NULL) {
     $interpolator = $interpolator ?: $this->getLocationReplacements();
     $package_name = $package_name ?: $interpolator->interpolate('[package-name]');
     return ScaffoldFilePath::destinationPath($package_name, $destination, $interpolator);
diff --git a/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php b/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php
index b53040970b29..64a11e90de49 100644
--- a/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php
@@ -492,7 +492,7 @@ protected function assertVariationCacheMiss(CacheableMetadata $initial_cacheabil
    *   (optional) The cacheability that should have been used. Does not apply
    *   when checking for cache redirects.
    */
-  protected function assertCacheBackendItem(string $cid, $data, CacheableMetadata $cacheability = NULL) {
+  protected function assertCacheBackendItem(string $cid, $data, ?CacheableMetadata $cacheability = NULL) {
     $cache_backend_item = $this->memoryBackend->get($cid);
     $this->assertNotFalse($cache_backend_item, 'The data was stored and retrieved successfully.');
     $this->assertEquals($data, $cache_backend_item->data, 'Cache item contains the right data.');
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
index 49ae87a2cf9d..f148e18af832 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
@@ -520,7 +520,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity_test = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?EntityInterface $entity_test = NULL) {
     return [];
   }
 
@@ -571,7 +571,7 @@ public function getFormId() {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity_test = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?EntityInterface $entity_test = NULL) {
     return [];
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php b/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php
index 70c7358bf01c..629ebc8dc2e1 100644
--- a/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php
+++ b/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php
@@ -25,7 +25,7 @@ class FieldItemListTest extends UnitTestCase {
    *
    * @dataProvider providerTestEquals
    */
-  public function testEquals($expected, FieldItemInterface $first_field_item = NULL, FieldItemInterface $second_field_item = NULL) {
+  public function testEquals($expected, ?FieldItemInterface $first_field_item = NULL, ?FieldItemInterface $second_field_item = NULL) {
 
     // Mock the field type manager and place it in the container.
     $field_type_manager = $this->createMock('Drupal\Core\Field\FieldTypePluginManagerInterface');
@@ -167,7 +167,7 @@ public static function providerTestEquals() {
    *
    * @dataProvider providerTestEquals
    */
-  public function testHasAffectingChanges($expected, FieldItemInterface $first_field_item = NULL, FieldItemInterface $second_field_item = NULL) {
+  public function testHasAffectingChanges($expected, ?FieldItemInterface $first_field_item = NULL, ?FieldItemInterface $second_field_item = NULL) {
     // Mock the field type manager and place it in the container.
     $field_type_manager = $this->createMock(FieldTypePluginManagerInterface::class);
     $container = new ContainerBuilder();
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php
index 5e9c909e4a3a..c1f253096a11 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php
@@ -192,7 +192,7 @@ public static function providerTestIsSatisfiedBy() {
    *
    * @dataProvider providerTestIsSatisfiedByGenerateBundledEntity
    */
-  public function testIsSatisfiedByGenerateBundledEntity($expected, array $requirement_bundles, array $candidate_bundles, array $bundles_to_instantiate = NULL) {
+  public function testIsSatisfiedByGenerateBundledEntity($expected, array $requirement_bundles, array $candidate_bundles, ?array $bundles_to_instantiate = NULL) {
     // If no bundles are explicitly specified, instantiate all bundles.
     if (!$bundles_to_instantiate) {
       $bundles_to_instantiate = $candidate_bundles;
diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php
index c290c8733462..43ccb8fd864e 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php
@@ -18,7 +18,7 @@ class DefaultSingleLazyPluginCollectionTest extends LazyPluginCollectionTestBase
   /**
    * {@inheritdoc}
    */
-  protected function setupPluginCollection(InvocationOrder $create_count = NULL) {
+  protected function setupPluginCollection(?InvocationOrder $create_count = NULL) {
     $definitions = $this->getPluginDefinitions();
     $this->pluginInstances['apple'] = new ConfigurablePlugin(['id' => 'apple', 'key' => 'value'], 'apple', $definitions['apple']);
     $this->pluginInstances['banana'] = new ConfigurablePlugin(['id' => 'banana', 'key' => 'other_value'], 'banana', $definitions['banana']);
diff --git a/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php b/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
index d14cff7867f8..a4f169b1565f 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
@@ -66,7 +66,7 @@ protected function setUp(): void {
    *   called. For example, $this->any(), $this->once(), $this->exactly(6).
    *   Defaults to $this->never().
    */
-  protected function setupPluginCollection(InvocationOrder $create_count = NULL) {
+  protected function setupPluginCollection(?InvocationOrder $create_count = NULL) {
     $this->pluginInstances = [];
     $map = [];
     foreach ($this->getPluginDefinitions() as $plugin_id => $definition) {
diff --git a/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php b/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php
index 4f001bfda58d..3acf540c4b5a 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php
@@ -29,7 +29,7 @@ class TestPluginManager extends DefaultPluginManager {
    * @param string $interface
    *   (optional) The interface required for the plugins.
    */
-  public function __construct(\Traversable $namespaces, array $definitions, ModuleHandlerInterface $module_handler = NULL, $alter_hook = NULL, $interface = NULL) {
+  public function __construct(\Traversable $namespaces, array $definitions, ?ModuleHandlerInterface $module_handler = NULL, $alter_hook = NULL, $interface = NULL) {
     // Create the object that can be used to return definitions for all the
     // plugins available for this type. Most real plugin managers use a richer
     // discovery implementation, but StaticDiscovery lets us add some simple
diff --git a/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php
index 969c70a345de..8f2c03d76d74 100644
--- a/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php
@@ -167,7 +167,7 @@ class TestServiceNoMethod {
 
 class TestServiceComplexMethod {
 
-  public function complexMethod($parameter, callable $function, TestServiceNoMethod $test_service = NULL, array &$elements = []) {
+  public function complexMethod($parameter, callable $function, ?TestServiceNoMethod $test_service = NULL, array &$elements = []) {
 
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/core/tests/Drupal/Tests/Core/Render/RendererTest.php
index 552fbee231d6..d14a083c177c 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php
@@ -41,7 +41,7 @@ class RendererTest extends RendererTestBase {
    *
    * @dataProvider providerTestRenderBasic
    */
-  public function testRenderBasic($build, $expected, callable $setup_code = NULL) {
+  public function testRenderBasic($build, $expected, ?callable $setup_code = NULL) {
     if (isset($setup_code)) {
       $setup_code = $setup_code->bindTo($this);
       $setup_code($this->themeManager);
diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
index e35d06a73062..068f13f23b78 100644
--- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
@@ -515,7 +515,7 @@ public function testGenerateWithPathProcessorChangingOptions() {
     $path_processor = $this->createMock(OutboundPathProcessorInterface::CLASS);
     $path_processor->expects($this->atLeastOnce())
       ->method('processOutbound')
-      ->willReturnCallback(function ($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+      ->willReturnCallback(function ($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
         $options['query'] = ['zoo' => 5];
         $options['fragment'] = 'foo';
         return $path;
diff --git a/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php b/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php
index 070f1d12631d..b7f55934346b 100644
--- a/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php
+++ b/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php
@@ -60,7 +60,7 @@ protected function tearDown(): void {
    *
    * @dataProvider providerTestRequestSanitization
    */
-  public function testRequestSanitization(Request $request, array $expected = [], array $expected_errors = NULL, array $whitelist = []) {
+  public function testRequestSanitization(Request $request, array $expected = [], ?array $expected_errors = NULL, array $whitelist = []) {
     // Set up globals.
     $_GET = $request->query->all();
     $_POST = $request->request->all();
diff --git a/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php b/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php
index a3d0b64d2b56..ebd6002999ce 100644
--- a/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php
+++ b/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php
@@ -369,11 +369,11 @@ public function testCacheContextCaching() {
    * @return \Drupal\Core\Session\AccessPolicyProcessorInterface
    */
   protected function setUpAccessPolicyProcessor(
-    VariationCacheInterface $variation_cache = NULL,
-    VariationCacheInterface $variation_cache_static = NULL,
-    CacheBackendInterface $cache_static = NULL,
-    AccountProxyInterface $current_user = NULL,
-    AccountSwitcherInterface $account_switcher = NULL,
+    ?VariationCacheInterface $variation_cache = NULL,
+    ?VariationCacheInterface $variation_cache_static = NULL,
+    ?CacheBackendInterface $cache_static = NULL,
+    ?AccountProxyInterface $current_user = NULL,
+    ?AccountSwitcherInterface $account_switcher = NULL,
   ) {
     // Prophecy does not accept a willReturn call on a mocked method if said
     // method has a return type of void. However, without willReturn() or any
diff --git a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
index a1a6aed5c92a..d0eb9c871a78 100644
--- a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
@@ -154,7 +154,7 @@ public function testAssembleWithEnabledProcessing() {
     $this->setupRequestStack(FALSE);
     $this->pathProcessor->expects($this->exactly(2))
       ->method('processOutbound')
-      ->willReturnCallback(function ($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+      ->willReturnCallback(function ($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
         if ($bubbleable_metadata) {
           $bubbleable_metadata->setCacheContexts(['some-cache-context']);
         }
@@ -179,7 +179,7 @@ public function testAssembleWithStartingSlashEnabledProcessing() {
     $this->pathProcessor->expects($this->exactly(2))
       ->method('processOutbound')
       ->with('/test-uri', $this->anything(), $this->anything(), $this->anything())
-      ->willReturnCallback(function ($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+      ->willReturnCallback(function ($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
         $bubbleable_metadata?->setCacheContexts(['some-cache-context']);
         return '/test-other-uri';
       });
diff --git a/core/tests/Drupal/Tests/PhpCs/SortTest.php b/core/tests/Drupal/Tests/PhpCs/SortTest.php
index 41ffab51b387..6927f442ccd7 100644
--- a/core/tests/Drupal/Tests/PhpCs/SortTest.php
+++ b/core/tests/Drupal/Tests/PhpCs/SortTest.php
@@ -81,7 +81,7 @@ public function testSorted() {
    * @param null|string $column
    *   The column of the value or NULL.
    */
-  private function assertSorted(array $input, string $column = NULL) {
+  private function assertSorted(array $input, ?string $column = NULL) {
     $input_sorted = $input;
 
     if ($column === NULL) {
diff --git a/core/tests/Drupal/Tests/WebAssert.php b/core/tests/Drupal/Tests/WebAssert.php
index c3d2a69824f5..a60597aa6658 100644
--- a/core/tests/Drupal/Tests/WebAssert.php
+++ b/core/tests/Drupal/Tests/WebAssert.php
@@ -145,7 +145,7 @@ public function pageTextMatchesCount(int $count, string $regex, string $message
    * @throws \Behat\Mink\Exception\ElementNotFoundException
    *   When the element doesn't exist.
    */
-  public function buttonExists($button, TraversableElement $container = NULL) {
+  public function buttonExists($button, ?TraversableElement $container = NULL) {
     if (!is_string($button)) {
       // @todo Trigger deprecation in
       //   https://www.drupal.org/project/drupal/issues/3421105.
@@ -172,7 +172,7 @@ public function buttonExists($button, TraversableElement $container = NULL) {
    * @throws \Behat\Mink\Exception\ExpectationException
    *   When the button exists.
    */
-  public function buttonNotExists($button, TraversableElement $container = NULL) {
+  public function buttonNotExists($button, ?TraversableElement $container = NULL) {
     $container = $container ?: $this->session->getPage();
     $node = $container->findButton($button);
 
@@ -193,7 +193,7 @@ public function buttonNotExists($button, TraversableElement $container = NULL) {
    * @throws \Behat\Mink\Exception\ElementNotFoundException
    *   When the element doesn't exist.
    */
-  public function selectExists($select, TraversableElement $container = NULL) {
+  public function selectExists($select, ?TraversableElement $container = NULL) {
     $container = $container ?: $this->session->getPage();
     $node = $container->find('named', [
       'select',
@@ -223,7 +223,7 @@ public function selectExists($select, TraversableElement $container = NULL) {
    * @throws \Behat\Mink\Exception\ElementNotFoundException
    *   When the element doesn't exist.
    */
-  public function optionExists($select, $option, TraversableElement $container = NULL) {
+  public function optionExists($select, $option, ?TraversableElement $container = NULL) {
     $container = $container ?: $this->session->getPage();
     $select_field = $container->find('named', [
       'select',
@@ -256,7 +256,7 @@ public function optionExists($select, $option, TraversableElement $container = N
    * @throws \Behat\Mink\Exception\ElementNotFoundException
    *   When the select element doesn't exist.
    */
-  public function optionNotExists($select, $option, TraversableElement $container = NULL) {
+  public function optionNotExists($select, $option, ?TraversableElement $container = NULL) {
     $container = $container ?: $this->session->getPage();
     $select_field = $container->find('named', [
       'select',
@@ -601,7 +601,7 @@ public function assert($condition, $message) {
    * @throws \Behat\Mink\Exception\ElementNotFoundException
    * @throws \Behat\Mink\Exception\ExpectationException
    */
-  public function fieldDisabled($field, TraversableElement $container = NULL) {
+  public function fieldDisabled($field, ?TraversableElement $container = NULL) {
     $container = $container ?: $this->session->getPage();
     $node = $container->findField($field);
 
@@ -630,7 +630,7 @@ public function fieldDisabled($field, TraversableElement $container = NULL) {
    * @throws \Behat\Mink\Exception\ElementNotFoundException
    * @throws \Behat\Mink\Exception\ExpectationException
    */
-  public function fieldEnabled($field, TraversableElement $container = NULL) {
+  public function fieldEnabled($field, ?TraversableElement $container = NULL) {
     $container = $container ?: $this->session->getPage();
     $node = $container->findField($field);
 
@@ -658,7 +658,7 @@ public function fieldEnabled($field, TraversableElement $container = NULL) {
    *
    * @throws \Behat\Mink\Exception\ElementNotFoundException
    */
-  public function hiddenFieldExists($field, TraversableElement $container = NULL) {
+  public function hiddenFieldExists($field, ?TraversableElement $container = NULL) {
     $container = $container ?: $this->session->getPage();
     if ($node = $container->find('hidden_field_selector', ['hidden_field', $field])) {
       return $node;
@@ -676,7 +676,7 @@ public function hiddenFieldExists($field, TraversableElement $container = NULL)
    *
    * @throws \Behat\Mink\Exception\ExpectationException
    */
-  public function hiddenFieldNotExists($field, TraversableElement $container = NULL) {
+  public function hiddenFieldNotExists($field, ?TraversableElement $container = NULL) {
     $container = $container ?: $this->session->getPage();
     $node = $container->find('hidden_field_selector', ['hidden_field', $field]);
     $this->assert($node === NULL, "A hidden field '$field' exists on this page, but it should not.");
@@ -695,7 +695,7 @@ public function hiddenFieldNotExists($field, TraversableElement $container = NUL
    * @throws \Behat\Mink\Exception\ElementNotFoundException
    * @throws \Behat\Mink\Exception\ExpectationException
    */
-  public function hiddenFieldValueEquals($field, $value, TraversableElement $container = NULL) {
+  public function hiddenFieldValueEquals($field, $value, ?TraversableElement $container = NULL) {
     $node = $this->hiddenFieldExists($field, $container);
     $actual = $node->getValue();
     $regex = '/^' . preg_quote($value, '/') . '$/ui';
@@ -716,7 +716,7 @@ public function hiddenFieldValueEquals($field, $value, TraversableElement $conta
    * @throws \Behat\Mink\Exception\ElementNotFoundException
    * @throws \Behat\Mink\Exception\ExpectationException
    */
-  public function hiddenFieldValueNotEquals($field, $value, TraversableElement $container = NULL) {
+  public function hiddenFieldValueNotEquals($field, $value, ?TraversableElement $container = NULL) {
     $node = $this->hiddenFieldExists($field, $container);
     $actual = $node->getValue();
     $regex = '/^' . preg_quote($value, '/') . '$/ui';
@@ -813,7 +813,7 @@ public function elementTextEquals(string $selectorType, $selector, string $text)
    * @param string|null $type
    *   The optional message type: status, error, or warning.
    */
-  public function statusMessageExists(string $type = NULL): void {
+  public function statusMessageExists(?string $type = NULL): void {
     $selector = $this->buildStatusMessageSelector(NULL, $type);
     try {
       $this->elementExists('xpath', $selector);
@@ -829,7 +829,7 @@ public function statusMessageExists(string $type = NULL): void {
    * @param string|null $type
    *   The optional message type: status, error, or warning.
    */
-  public function statusMessageNotExists(string $type = NULL): void {
+  public function statusMessageNotExists(?string $type = NULL): void {
     $selector = $this->buildStatusMessageSelector(NULL, $type);
     try {
       $this->elementNotExists('xpath', $selector);
@@ -847,7 +847,7 @@ public function statusMessageNotExists(string $type = NULL): void {
    * @param string|null $type
    *   The optional message type: status, error, or warning.
    */
-  public function statusMessageContains(string $message, string $type = NULL): void {
+  public function statusMessageContains(string $message, ?string $type = NULL): void {
     $selector = $this->buildStatusMessageSelector($message, $type);
     try {
       $this->elementExists('xpath', $selector);
@@ -865,7 +865,7 @@ public function statusMessageContains(string $message, string $type = NULL): voi
    * @param string|null $type
    *   The optional message type: status, error, or warning.
    */
-  public function statusMessageNotContains(string $message, string $type = NULL): void {
+  public function statusMessageNotContains(string $message, ?string $type = NULL): void {
     $selector = $this->buildStatusMessageSelector($message, $type);
     try {
       $this->elementNotExists('xpath', $selector);
@@ -894,7 +894,7 @@ public function statusMessageNotContains(string $message, string $type = NULL):
    * @throws \InvalidArgumentException
    *   Thrown when $type is not an allowed type.
    */
-  protected function buildStatusMessageSelector(string $message = NULL, string $type = NULL): string {
+  protected function buildStatusMessageSelector(?string $message = NULL, ?string $type = NULL): string {
     $allowed_types = [
       'status',
       'error',
@@ -978,7 +978,7 @@ public function pageTextContains($text) {
   /**
    * {@inheritdoc}
    */
-  public function fieldValueEquals(string $field, $value, TraversableElement $container = NULL) {
+  public function fieldValueEquals(string $field, $value, ?TraversableElement $container = NULL) {
     if (!is_string($value)) {
       // @todo Trigger deprecation in
       //   https://www.drupal.org/project/drupal/issues/3421105.
-- 
GitLab