diff --git a/core/lib/Drupal/Core/Access/AccessArgumentsResolverFactory.php b/core/lib/Drupal/Core/Access/AccessArgumentsResolverFactory.php index 2bf807149db0637b85de01da64ec5feacc6442c7..ace302b7d467940941735789efe4482e09a508d3 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 c62c5276b92211aaf3b7608c0db542177b3d849d..27ea3867b2dedc1b84851555ed67db8df7d92ef9 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 7650fb672417fcfe9a6f4ecd2239c66b0b865517..cac1b7609b2055b8de64c124bd4a1fefafcd5ccb 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 2ea6a6a9c2addb3df99862d65a94df3764af101a..7fc86ad08a13c4c25798521a404a946e12e4e8cf 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 eea600ae391826838050a799233854542c2479a7..61a7b27c37ffe601bad7d9a0ed6c0bab7283f950 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 c7f00b547daa9bada16516fb861627a2f0d233ee..20ed9a251f12c9a797a09e9324fe82658074c4d0 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 d0aec3018557b7052ce050ef00ac14b7f4c9a2bd..6b70d7c63c308f6729eeaf9e7d7e065f532e2982 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 5158f96a1f12c3ce8513f22fb9809840cb761f5b..622e519f614f67cde0674185f889f8a10f16dc1c 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 6a7994a977abb9ce1156686cb56e68bb98730942..05382c2a066d7cc62525a759069d38d70154f3dd 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 dab1c6d14326847e2e81d7bb7a9e9b20dcc75bea..369d47ac0e97913fa5041edd8173dcdff6e63398 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 565529af7223a988abaa2794b2347c083b83b5e6..92e92e006489852594bb505c821b4eb138d27126 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 a498d2dccef3beff6ddf90a4ecaab32b4d3e9c67..9b1aba2439e1ecd2a96598a67dffc23ee995f342 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 0c79430a3f0702de1d7771db8b29dc585bee09f5..6aa0df0c70077a6bef035bc7e4fa6cb8aade78ec 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 e9fbbd62e728aa435e405361c6f1d06212634a07..3db0e999c1154dd904c1639cd2c3e5691ebe36dd 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 b8ef0f3db66ebde5721355b44605bf4ea21b44f6..8b44880ea02434f5fbf6279f605418838d19d844 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 65479c3fb4dc5e6e3a1f7bb00ae04fa42c06d156..92f5155b793043f2397d6228642d53a6226cc580 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 2d3f8ebee66db68a4f69d2af97df29561e8747c8..e21fddf91a87eb2fef2883b4a3d62d4bf402a888 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 30f0901df2ca1e3cde073bd29c3a13fcbe11476b..0fac59ca44ac091fa2107bc7884e1c6bc184d328 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 0741e1579403205f70e799d0b2bf0dae31029b25..95f487858cadec1c045673a7ce6cb465f3028055 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 6109806eec94794033d5f3f5c4ebd37e00bc2876..4c4c6a26df951ed13b3c88f3e46937e9e62abe5b 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 55d344e366a6aaf5e260d9618889f2af1007633d..121775fdda33cb51c2e06f5e8f5fe13d2bf02654 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 c68ac7255e687e502bc7f19884cfdc1a50ca4a4f..d033ef0ddea88799ec4220f7d910042d17c1dc6d 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 665c4ff2d58fc44ce3c265a80f6863a1f6550085..70933f8fb0eb3006b43603b72e24a9c040714568 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 72ae7e7fc879bc476864b3b66e7a317832a3f534..d6ac429ce38b2df8c53351874c88ac99b806e0e0 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 fc49f26bc64c0b67dca8c5721ee86da8a66ac9e9..72e33d1c54295b4edab9b8c30cdb77518b206a46 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 21ebf27e723d716e9a84591e6c71a36732fcabe1..689425ff1606451c7edfe5ba80dafb1f04ab007f 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 8443c1aa7cb1e4380637d55cc6053f87bd09d52b..82bbb9720b37108fd4568782244e3be27beea6ff 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 2ce93c3e4ec5f25217be60a4c33d8a284699633d..4adf7826444cb63694e6f75f0a8fe6c545bf7209 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 bad8ae78bd9cd5f365c40dd4f68f0e20997162df..bd3128fe19d4d9c2c16947908795b746bca284d1 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 99f48104f6a7e5a30d9679804f6499f31966a696..313914eb1268d90b551dbc90861f733698f85880 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 ef2d1945b6c013acc9e5d91e1183c8079417cecc..afdcdde2443709e8eacc9e0e8465401f18af1fee 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 2be8256ff094d703174256b54f5098f174fa20ce..17346fedf0714f9714abdd04a73879c73f3d775f 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 2e7a00cb7f9d1e3b9dce9b313a08449f5b94d7bf..c5685741e9fa48cf148f1b84c5cd21a63780dc32 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 cccdc6ad5e967412bbeefc109877140bbcc9c10c..ad29bbf5056186e12fb98dcf195bb73f28db9674 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 0681813f04cc47821b225e41282ef1322324fcb0..61d91867a8928081e0e4a4ab612dec50c9cf9dff 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 2293c45ffe0512d3d5c6525d78f32c55ebd9e8a5..f3a161af2da6261c8c5a090376495d5ed6746bd6 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 f1ac9ceba35593d231718b8bd1da32dfa4c128fb..f9add858545aff1a9a4f3da15003f0c6081727c5 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 c3272e0ea90b01cd3f3627d47b22b1785f910569..c2c2c6a8b2717c2b0fa2e707912409c3d9a15e1f 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 c269c9819b55c079df9cba38d297f6ecd6f64787..be86951f970a4ea60a8dcd9525bae46367fa876f 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 4e7ef8fb32724fb5de04724b6a7d860c0c5f5499..40f2f2bf297dad9170c71b9689a353aa8b99a854 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 cc1a25ed5237d63a201b578668bb4c78f4fb77d0..980ef74ed2e103575fd361ce00c92baa8f3dc0b5 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 b646b874b37ef5db2644fd141a744088e5ccf18d..278aab3673b2bc59905fc82291c4042568e061bb 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 6a801859d23fce02e6ddebfe717c05e089564fae..dafb060d59f67f8f28a7e5f94a8741796616306a 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 948f59019cb3a6b2f62bcc269ee7432b09f1c27e..4f47ea1937d0df4ef2995401fa1fb4abd0d8525e 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 b70022f29d9964f51dfe31252c4684e58a98efdb..cbb7896cc09c274f73504c4c5b08599fce6f708e 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 1a72442e6dda34b111cb3b92a0d860858c99694d..b713264f2f56930c5fc3ccc58e8c652f5e252707 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 d056c7bf4e7db2a96cac45cbfb9d0acd48466784..574d3871db0749a3cd9d2f28bf4f63d3dbbd68aa 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 15e7153189e0b2c22e4d0433e1550e5cedb63589..8240d9a5f8b0bc6e637724aaf15ca00a98a901c6 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 c4c0674bf9e6c9d12bc0fa0e7573449b821f7649..5d7ba3aa5fa50456609b7537796e237fad86ece8 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 92e09562d54f96abf3c2b4111d9136b0f931d39f..64651f03c5e909c2af6bef2d74f8516ba50033e9 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 8a32728bf2b53b21adaf6d0ebf7399e894b3b89a..f18253f1579e3b8caf48dc856de1ebf6c9c0dc39 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 ee9af88b22a87461a82e53a29bb92339ad83a465..2537c6bfd7c291b603d358f1248eb28605adf47b 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 c344e2a29792ae9579446bc7001be22a7182e2ea..0f6db71217d466973bdf5b5c28a0c7a0aeeb4b87 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 47c8360887029e78eedaef04b0bea5f3952fb37b..72449e7a8d6dac061660629c21e651b860590226 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 edae57c9e44ec41d701afe12d3d1f3f5f6dea1ea..5f28d54fdafebd6657599f57104467520c715b7f 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 b154eca3b25584764364bee18795b3bc3362bc59..592a265477ee42438f0fac4caa1264e4bf497e4b 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 5bca2897bb8440f1ae97bf80b1bc578c35cfd8cd..5e9b2cd3c6d8026230f357d7787b2ee3324a7d84 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 4d8437de715145bd0a6d567c252303d0ea76f39a..b0570c90dab9b0de1383b5031c391a5f3e8a49d5 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 76ea90b24a26067a5b70a4b911360e05d28e00f1..2f117986d910355c7fa1c85c35313fc6b51d2d02 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 43328232eeab386e06d4ac8bd5ddd9fe19c85017..cba3eb5002a6854f547649890ef7c86f808148f1 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 2abbdcd31c3c9689c7cb2c6d63da6ce13cc62338..a1171201414fe9ff0e67d2335a9f986a43e73611 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 336b7c2c41c641663e6b327a298fb7c09ebb6b8b..f62b420d3c4633e10b0d2ce21af613ad7096fb39 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 df7a8127a61679c2a45800d0d600c267dc68f4a5..d31d6235ab2e93ea6b3566273007b5892c628fe8 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 417de18f6652a3be518bba80bb16e51696e51110..05aa84a0447243252f7146d1b622ccddc63ced44 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 0768dee0c892c17ca58482dbf27bb0a27223df58..c3eaa97dda6fab84ecde13cb95b0e5fa6bcf83f7 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 b00e6829d8a06152349721f44a287c5b9a8ea54c..c5775eab29f1938865a2f7f6dc870025be593261 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 5c5eef039ae5fc96472015290e8e54b631d93466..eb1486de473528e7f8e582395e9e6325dbd183d5 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 b453fe330b5d5317d6925e3a5a045eb691edb4b3..06f7f8e96925bf4ba57f83b445b0b8552ebda485 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 46a90168a4e5984394aa2a78faf2f0dc2cad72b7..149ea3ca32ce1ae6e08a07df460af457a940bd39 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 8951a18d14ed5ca59f0805d000af6f4d7de7282a..cf2a187a2f66535beeeb74d6487345708274f7c1 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 d6da061fc0fe92b29b05ec51aeb02f57330e3b1e..3c97ad50499a55e0627c8a4f92fd597116749ceb 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 e67614336ab17d6a3c570f54a26b4348c4f665a6..6d383ce3f518b95e61accb2bcf28af11ff7bb8ec 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 1a794a145f3f9eeff7596ebd19b02b40320f61cd..3b3abae2a04d0646681da85643a71a0c3885be79 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 65381a95015a99f9ad77572a13312e0943d11fa8..c9f1a13bcf4d8936ad8a7700ce729858b62c65c5 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 af967cda6eb7cdd8041254e0babbc34484c89004..827c7fa763c3244dc7bc5634fc21fe6ac5893855 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 e3910fd6f01e831fdc4f343860a2a6ab46a785d4..dc537b6b4534af469995a61d270259d10e5ad6b5 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 1fff95d122bede6dafe58d1b54b9aeacd8bb165b..dcff02886fe8090928b61204f05bf846dc43d38b 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 7a375e43c20a9bb4eaa30600719e0af567c0beba..4af6932e45f4dce82a293a3238796b1522a576b5 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 307afa9aac12263a7c5b163ab5ecad0764329497..0641bc85ea62c9f739d094dc4c33d95dab947974 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 db8566fef3e47576ccf2a99332c6a3072ebaeeec..13efce6d650f662a693968d4afdd7e4da86eaa4e 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 564359d3bef7974187a82791f5dcf798046ce0d7..2c8178ac134e07495c781ed4445e0821679cc448 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 dab8b035f8ce5e1cd0a55817d12dc3f5e1963798..8a1aecd732278820c808bfa056bc155e8336f7b9 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 d52834aace19201f755c4809146f9d3b24e29363..2c2683cfdb7872a9b5bbacdc6a822696a1b01415 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 9a6f3d3e34321fedd24a7206a55741b68c5f5695..ce3f17897209424ecac2de4587f6f528d887e7ec 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 5dcb8f1ed91fe662aa8b64dfeccb6b9c8c6d2a5c..5927e6a1ea3bc44ded04b67001b012837289b9ff 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 b00872f9bec2782a7d91d4a7b7ce8b82dae11f25..ed184e9eb3f3d8102e17c7d9fe41eb5a46ba56d7 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 e52da2578574cb527f41b2fb69036896a08c4baa..67c7571b1fc022c5712964de84822b3a1b138982 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 b2e621fd12d018243dc64c77cead1b2646d2c434..ef3d79d36ee5a1ecc822bfc43c5e35937c24a8e9 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 aec1052d517425588d4ee44672f6a8cd7bb0acf4..99357d4574d12184343b567f3f05b82bfb945c22 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 2961a32430cb15e427572a47c60464be671af02a..be1d70ad6e2b1a5d9b6ce80bb05ebf79b0418ac9 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 fee49efed8527d5fdbe616689583145b76bf8df5..014cf299f7d52013c6df970d973660f4b0813548 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 1fb5c4c6d5291c68c6f90941175f178ebd36c99c..eab63b75565ef372481d65b3f66ea94e67cc8b87 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 ca3b8b8688e14f6687e446e9fd2122e3b4b571c3..2df78ee5ba61027f4116b978c3387ad29ca1987f 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 312bc4f4c93a4c97e6bf043539989c552c52bf46..39e53d038d3ffab199943156f8bf40baecc32fec 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 a966736d0d53db233d7a24aea0d57ea8149f5cdc..5393c92f2f5c3171bc57bc30d5690a869001bdb3 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 fd2cfd04e375208bc26a7ba0af4467922ab3118c..938ab5244985def1ecfebc2e7f6654d447e662d5 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 ac6aefdcc7252e5bc636c4931af66ecc2fbc9a0e..85d4b184272813a8c789791f4c6a3214ab32289b 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 5b0a35b58516b76cc5e5eb89ae69043ce16f6b3f..92ebd361c6baeedf82d32b2c39c3f258c537b7a9 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 4d2027ec1af3a69e1e26f8196bed1a75a58850d5..7580ed7e1ede9ad09192912f5d9880d86738f00d 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 8bbb11c7e9ebfa44484d7a1ee5733c1fca00c1c0..dc8d29a665617bf7d83a7c059c72f0f7f230b3fe 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 ffc3ba66a6e68ee9c2527520104d12f923519b85..2710c9f6b8f6a87c5d7325a645393562457ad1b1 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 c08635365ba189e35a281a86aa737e857f271d1f..b0004d943b22190ef01408dcc9844717c63a008c 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 2ea3346aba5a4a2115b5f574873a27edace45982..26f967ce31412a3099a044afa1dbeb84d674a0ed 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 4756380d6c2929285818ef811566abf53d055ff1..430db51fe55dabe0952386fa29a3167cf9df9273 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 6191a9b30b98d1445c9d6aaf7c52d92fdcc2522a..9149df14957b8d009c024f4596d67011cf8899ae 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 d102ccd433c6dc7ad1e91391f92175c069530f71..69d07debe6e95f6882633767d30fb1604691d962 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 97aa3f096583c640a502d5d602a2e5bf0272cb50..d86273fa8c0c7d7ab5469e331a384b1f73af180b 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 af3cfa4ddc52b928f694add08401c5f926dcc237..8a7eeea2e26b6054ee4666bd70bb72a8c7d587e9 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 3c908a78a1f1bde0ed8135bf808e22549f44b82b..89f16fd8f1644d1b9ccfec4a1e1e4b14d4bd28db 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 6ebcb6d4aa7391cd675bea09cd98c8e069824ecf..43f7ef587f2f881940d1beb23689c87fcc2588e4 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 e3e610b4076400e7eae2df8e3b5a68660f643361..53208360d3dafeccb4ba8e098f625b2e4771e470 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 53aef3fc691501c30c7f9af8e10961d5b1e75a5b..a1a2ac5a466db8bb0d6484be3643bff3a63c9957 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 4c1536eac7fff6ca92e563690e204b40dbf84c49..8fc2b8987db41b58b625a0c15811a5e4f81efe33 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 29136e0710455c581e00986debba32004a4c3be2..d0e0b6be7ff9b1ae5ff49df3932c152fac63f97a 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 45ee1cdd5070419fce64a43cb93045e7803fa079..6945e88ffe63618d844edf2199fb02367b84fb7d 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 a2d094c8cf2670a4b88b2babea062f4f55ab8de0..a774bd5d7d00ab981d895579d4200a2236dd67c0 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 7f7306d421021c9503b402259766d676e8005646..a52aa3c9ff567999b3f46dab8622349d8d7eb4c0 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 5e8f2f3b2ae69756d6ef71330b3b257528ef23c1..bc97ec66e05d5564d930d360028d06a2ccc28ad3 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 340a80d39ba07fe4de7ad13960fd4caa9f4be25e..366b1d41f65c3ec17e7d8e245a2519d4c3d753a3 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 ec5702f91c3a60eb302d2be4e39e983c374f91c4..9063e4e1ebeeec65c4a12f7e9f74c64a968662eb 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 c5c2bec0321b253cab426041d531d53133154aab..4e5a3b785e0fb3930a4d445d78f4a273ab9590fb 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 7b50cdaf52ea2d4b244e41d45f95648feb5338b1..5904dfd172b8e4c915954e843f5c723c24a71c03 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 f3c0962306ae7cc7020eb49987ff120ec6c79431..5d327421088589ef170a52eb2b016489ea7b8ab1 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 edc09131db2e275204f4af104b5d89c85165b8e8..8a5d2268029b597f432e1b9b201d4eb339177ff8 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 bf8ca0f1400d3fc03966c75d5f4bb00a556d53b5..8f7b9cefc3264b9045b0e52636bae102cd464994 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 1e1ec5bb5283e0d4110d4b07f0c01571f8dfdded..74a61dd798562c498ffe3a2446830b2aefc4e689 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 7ff9dc991bb2bb7a7f6dd8c6011feb9548a43791..ded46faeb76d6676a963ba60be9451bd5729c02f 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 51b97cd71e1b59db25dd2650dcb66e88a3fe10bc..1ca32da6ca63ffbaae688cabdb6ed8010ea8ff4f 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 9e6d3dae619871672fd4994e15617f2088027fdf..9c723ee76fa2ffd7017ed092413fe0da93ed8565 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 a5e6570ebe4d89e99c09f448afccf4555f710b37..c1c701acb0452996f54003f5dd613f1be68f0863 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 2b4ca1d389c1c040d31b5979a1a2fc5096cb933c..de55b6678b391826e12c5102bc70a6e2a3292071 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 763006bef54e099166de2e9785a6b31dccd4ee74..2a32b504f324d7a725793fa65689488e1a37d8e3 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 1f62d84e4a61a32ebd221fa570fbddd77676ddaf..a6ef61656f5ba01f2ea48dc47e4462720b5ca385 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 b0bc6bba50548ae7feacdb65e5e0e9789004250e..83d38ee2bbae48407fbfd74f7d42fce94241dc92 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 404ab0dc3002b92805490449d694e9e3d7cbac71..f3438e1fb9246dd3460d9bc5c6826254d45803d1 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 3322c2af4e4977e50e7281df37e1c43bfdaf1f86..37ed2874c67ed6b4f371a0d7831672d5f97ddd42 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 d45cc7ba494e5ed0b680555eb327c59a890f160e..3f040d35f8b2ddcfbe6e3170ab27ae42928a5ca7 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 3774cb2272432d0524c28866bfbd996dfd1607f3..7c54caf331f225712afcad527db8000969f593bf 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 e6454d4aa87ec4c84840a1319836e649dead8e30..8aa3484638e62a863c784775c37c653c0a61f852 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 e1555fb1de9c647b01cec341e8e913508707de16..41000fcd3727b32dcbeffee6b5cbd76311d068e3 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 7b64c90c6c6f3b73d1651b62ad0865419ad04f8d..5fc21c22cd21e5526d45130162477b4d82127a69 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 0ef77f2a08e070d032170a92c0a397834e6c0036..587c6a2b259e8ad46e31b7afcbf15cb245d1c164 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 ae0638d00fe549206ea642151445326c972bcc98..4f43b62e1a1d8e688bf22ffde9489ea9edfed381 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 15c0452b3972aaa086ea8233a47743aa6db6ab0c..a0b4384ad7f46a995573416dbc28822622c10f76 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 455a5dfbdb88b2726f6726f9d9d04748218ab55b..61ffe804865700e439225e278a3464067a9f9bff 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 766904e4daf192a1f02885bc76ff3c7079f11cdb..5e7d0440a02bb3e63a34cf7abcf2641d31d3827d 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 b1583e12d0ab5feebb1c8ecc56de364cd0d93e41..4255e893368a319d545d17a079793b7a52774104 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 dce967cfcf0c5fa5daafd46a30716c27a99481d8..06a1d1f7712c9f06e01b43d40463fa0c819d03e8 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 2eda886d62dda807714cc75af931c9eb02063f0e..abcd144f6d7da6261eeb8f660263b64beb1178fd 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 fa9d7c627b193d27aa80fd7ac097a110a071a126..19af760a2cbf33996e0e14d541ef202a5509ff86 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 801df897eee23901207ce132bc6322a3cf99c807..959b2b018644160ac4d19aac9722495327667206 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 6d62d661e6b5efd098dc64d270b1354ae78282f8..029ff5d04146a4c64a9c62d42118a3fe0a87350d 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 4aff3a7df3de348b8d434d2eed2b868273759798..c9341f886b2ead8c1dd8b534877e3c05f0be6866 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 41cd4b35bfb231cf8ea0e86d8021fa126b6a9554..530e7fc5a6df76c65ac94896624d2496491d8bd7 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 00127c839d632cbe8ac6ff7a05c05847442387d8..db36db950ddadcd05f2d27367ea84f2262c53cc3 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 7b240cebb96819205b3613988ec00aae76b96984..90074aa1b9466db273f793b46fb3afda8fb7d46d 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 6b8654a2e24015919b4442e069fd53bb0c8abb88..17f21a1cab0d60007e74a708c5c8069377815ee2 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 203e4a367edd1d2df51417aea7619ece317ec93f..11b03d3632b8ee445633bcbf4bc645576f71fbfe 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 36fde8b236570adc78fd4b8d4f523444027ce7ce..34ecb27fef695ed0c8a3a75e69f743d655eee1f6 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 27dd1d57344d0cfb8ecf0216fac01cb4683b8cf1..11dc646cc193c5983f6786e53191c767ec02c02a 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 0d1099acade3bdbf3ca0820a707ff6c69c6ffbf4..10055651e1f9aa1250da18329a99894e9fd91adb 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 dca560f36515757bb80821293297b305d5a1d45e..bad929cc7af57ea7b3d90e35ebb2e22c9f72050e 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 eb7dab9be1e8d22fa8bfeff2a30eb5c197c8e9c8..d79322f19af3bd848760436dabe08b56955cc705 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 dfa0caa0dd48ff4ac912ae362e00908534da1e4b..d50afd4f2c62fb8a59f095f3761eb7c5e910c6ce 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 70f9f2cc7da74bebdd1e6ef8b7160fc52e516be6..8aff37da3e1bbfc0cbeff658b9d722d058e9b819 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 8d41095b6f9770ceb874fdff88ff3bca086db48e..49dd67c04569cfb7e272999280a230ff406199a6 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 cf2dfaf45c47e05cf487259ee7e4ea3661eae1e0..24e90205c88edf47c3ad9d92af98968512591fc4 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 3a5a00d84694139d3fb962f525bca2e51c58cc70..e76743663430fe51927fb5e89bbb86eba0047fed 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 ee1688f93e5a0e39847a139175c53d1b13514fd6..b23358c50a89c7dfeabe2357262c95c7c0b76e3f 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 33bcfef2fccf44d41b3f4d98fdc64e2bacc86baa..eb36cded0bc73558cbe70f74abc4d7ed74f4523c 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 9b6f18c8d95bc7cb23b077aed9c9a4029b4e48c5..91ee670ca8b5e9fb74044708b2000b9d985f5ab5 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 1b115a02d69c6420839fe8e11a6386ddff821039..3f004aa16a8e612487cf425ddcb570ca876ef0b4 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 c8385021ed214596f3c65e9a35dc77d8347c9021..c0edc533de2e11e81931aa530ba9b2a00243849d 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 ccd22a0c352961dc839bd34e1896d919a4bd39e2..bde7c734d4e1f4bbae79aaa5c317ea40ccd9221d 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 a2f3d1e6211c5b1f74b08d387a8f143f0ad3fd84..be86d9e97000023f12868315302c64f6ac0c721e 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 c386d3d71688d75cfe961adb6a19261467583493..22459b1e939e317a7a7beb356a9d3767e9a30bd5 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 08cc21a2ecfa6995c5bc16b16ae9d21900d69aa2..de91116fc2896d65f63bc8386a94632cd5d99047 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 3c4c8a674b521c29e93dc67fe6b998d5111aeb95..668125d4b3950aa7d55641054d46d8ef0208bef3 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 7879bf002b0047ff521e4ee9ab2d806769500051..51a9fa6ba3e3402cc2a9fd20a668921f0d7b87ac 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 ce12f12d5a48614fe7a0d0e04e1847c8e8835ae8..87805f39357a64f43cb648c81536bb5ac3c87a36 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 53420df3e78bacda3172be43a19140947fae82ee..ab257a008aff2b59cb85b693f0086b76071c572a 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 cf94909240df0b4954b0fab2bf200c3fe2a91d37..c9daaa1859e05cc75ce0a118667d6c87acdb216e 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 999011b536f0d3b41917e6bb48a2fff295dcd58f..785f2b4c807eb4e1b8f4284c9f4e83a6fb2f93d6 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 f5c6ce7b3f015e938d7dc35bab8f74c298d212d8..7c587c86807ff8f025ada919e2386df6fa7aa510 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 3b04631fd89f6494a5a01f769998499f1094b756..23d025f8f575cda9aefcd25556d91be2f76fed8d 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 8110b79d373721debbb3e350616d746f56bc98a0..c0bd35f30cae9621dcd4210c69aae7aa163fd700 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 1ddcb16f4f772b2190da3222f72da1d5e046a68c..aeabfe3bca2fc5601eca49be825fbd41496bc645 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 4b74458f8ee027e6722dbba7d82535ab16c33287..9693ac528f7f8ea1747aaf71d84700e6ee7ff4dc 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 8f47b6418e397cb82e864022c6591265ed587d1d..d1fc1b8eb9a452baf69937a228b4f754e4058fc8 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 e61ac7775a08a2bb6cd854fe7a684b2743037271..39355303c07082c134b0730985863c90a22b8ea2 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 13f57db0c24463bcac68fec653ff71a6335b5fff..6ce0054a3d8e82890afb9990eef19d3234b8867f 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 491cb42c65f5eac1787f0b6a971c2655ca5efc78..a01add6213ae37a7982299bbc192353b615b9275 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 a0068ceec83c025483feca2211fe2c664adac3e7..7e62d29a91168a0831177e290ae1385d92c22f82 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 fed6c39d9d5ca85319f2ed824a1580350ed1dfe9..1dd44a132adf95c5624c68c6beda3846478876db 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 d420ee63dc5c85af46fc70b1bda7c986c27b3f60..fd34c50c4cb09045c96b336082a2069ef8984d15 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 8754d916509b71a1e8c76f3636d340646c67404c..42955ef6165933851296a72a410f967eda65e531 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 279465773a1b5b7874e9079e7a94504dfb600b68..fc95f45fc835b827ad77f679b78d63599a7f5971 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 c808ebf56a75f637da23869f45c6eb7708585583..aa2f2326d76748b91fd14684050427186ecbeb9c 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 e781c9bd9a22c7ab7ae994f20ba49276844ce7a0..f549f6035b23c5fae8b92e88b4ae7b31dcdc0d68 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 67b1b98c89b899c7d7344443a8a05f8b9e298657..709ae33245d444b88be3966fa5eff0a9b42b63cf 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 91facbd57508e60a039705b8df9085e1b1fbf575..da33c95fe236ba780c3d1478567e0d9e0f952c11 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 5366264907239bdc9455410be2672963338e169d..df332c35c47863c89e9df7fd194c016143ff6e7c 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 3ba5f659359a9ae945cf1ab114d9ef78b61754f3..7fa2bb84c7f4b1be9a05b9089b6b2e908686866a 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 919f4e5b5270aae9e8db31e77e2cd462b8344a41..751c6b3596e93fdf9341116a43f76bcb5bca2e61 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 1311bdb2f3fd3fbaef4462a7cdc5ac0e9fcbbdc4..0b63f78f2abb0c95201123a14f73975be8e17810 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 091a2ea3da508f1daf7b44fc1e2a4665966820d3..541429fecc0156d4143c62d4059879d5d2980f72 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 bbbea44a167438953115a40845481fc42bfb1019..20a5cf4128b9aee2d289820671905c09ef5549d4 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 f46e5ef3a0bad108cfa3a0972a601a4c74d3a570..0dbb05b54a6cd7e8a7e0da5e2e98dd7a414bbaf2 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 aed41a4d9be619589969531891e1ee9156e4b7fb..ae2f5a8e494a4b9761596977652b20e0d23681f0 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 f97e5a0c7b995f301ee4c452502ef068a9aef063..b54ca96aa61c11943df6dffa33cdfcde889c4dfb 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 5e80ea68f5515a9715255007b905f6337e96d440..2725098332aba08eeb11afe6cc180300e7432c15 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 8a55c3149ac4b57d25a5ff450351a77ccae22a1a..577449759c22c55a1e58a8dd9d44d62b28c93bc9 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 7e0d17c668f67b6e5b21253e2f2af10bccb1e8f2..b4a72ce05d1ef28afcf08d65d725c19b3f17c40d 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 e08f1ba18eda4e55644021d183384834b16d06e9..c448765cdbf30c7e4ffc3c0459c450bc3bd1c0ce 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 45e03ab6c54bb967fb439eb2c8c70e00241a1f62..d710774d5a3d71f81c0b17bf4cd51b9c982c9dc4 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 bdb7292d62a83ac1801728de8c8fc14121ba2a93..63608e1e703a3264605d36562f77d9d12178f1f3 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 41ba6a4f9a9f09e288dc83cb8d017b4b2935195a..af7cf6f4602009ecbdc860abca78f9a0bdaf627a 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 979b0ea49cae0e57da41c1cfa1e68fbc1afe195f..a4410b2119836674772f53b6d74f86892b50c03d 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 ac86816161fae2afa254dbd7f986fde6c0bf50b1..80bf8254365794a2119b82307d1293df867d58c2 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 d5b2e30075b68a4fe65f5cf561ea34c6b28a6605..2bee0b4e5d958c83e58f67e87ea7a5a247d108eb 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 df5fc26ac2a37b7690aa3c74e0de0b121eb96806..37f002d4b441e74fa17c5eb1c5e701ac42c0ec95 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 765c39559829e0860f23dd9a79819bd588a42985..90d07c4be6461b4992d360598bcd7a805580a54a 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 e1ae2f737997568a0a2c0c2869c3464640d75d39..fe205734d18dc287690b80021f3cf215e932a9dc 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 bb8bc221ea416a6b1e520abe4ba63da41f55ccce..eed508539e81822e86546550ba22fa5817a48d5a 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 628b1ae91715e3f7b974ef53a37ba4862567da48..77a7ecd9e20a387665e37514c13f4092a4b58e24 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 4c923a62ec7e19b2f9fc00911a768dd7dfad7527..db69c94a6903c8b18d46fd93ecf43044aa65c139 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 ecfb44964ba15dbd91b1439a0e3bb7069196fef4..0fa44813c568fa890822354660d471b384695871 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 19ad69d038ba81abaea7db70de4ac0f41c6f2b74..eab628e0a101a111a0a4c9e6b61ab7bb0ad5b410 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 44bc5135ec2bb501affcd7815bc4c3ea6833b84e..d59cc8dc2e0532b42c03a2ac868a8c1a1a601517 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 c8870ba26da983e2e20d2cebeaa731146b1acd95..7d64ec75464b90f4f505700cbadd212b12fc8e96 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 b91dc08e90f2b480daa53b64e71f27c735fc787e..ab2baa5d6d0ebb7e8a6a880f210ce9f44a659032 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 1002880d5fd9a961e4ebab5a5241e2049a17cc63..12e01ce1d04d71aa8e8ed2cddfb6fc8096ebb253 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 09b1c7a9c7c470975e62cd39f5d7716aeb1b1501..133d5c208a24e4ce89d795baccd42a965cbf8178 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 2ba66da8085e35686628703e882f4220a5f57f50..987d52db52e7425fd3826db4a38b33644e6046f4 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 8052e4c8b756b35e7c7c481326c121b5b56571d9..4a9dcbd4dfac7f9db07f07bf419dbc1c57fb1e04 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 451a9613ed0315f718b549142bad3cb0b2aaee91..cfc77ac97a72280403fbef3c15f3aca3c55fab1e 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 692ff827b9632b5e1f05ceba083cf58929ea1695..1886fb7739edd18c6ef0a1d7ead672a6885c6b3b 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 98d71db39c1a361bd5f0bdbdb12bde902b497c45..f88c1fa830b1429aa19a53145627644a84914ea0 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 f907c2e3f400df06c1a46bb9fabbfc75bf254396..6b6dd84b730c2d8b3f60d7fd97dc721f20065453 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 3d04ee86357ebcba67eaf8718a51a0b71a46e107..89bd8bf955988f2bda1347722a01ed5cd03b93a1 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 5af925479d2aab715788d28e4c0133983862d05a..a8bc970919348b29075d52f272b8768dd5e10e9f 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 42411ef4cbe5a977cd0f275604955e1d8b3e67df..3bc244daf1cf52e60340a9b99983696635ab2e4e 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 cc8dbb6c9b3a15846a53bc71ae66e5c412142ecf..048feb2a238066c8b808769bfb592b821403807e 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 158e9a109b3356dc8cf0b0afb95dde9249124133..abbd823ab8c8bc9895f8c33eab60ba3ca7ce0603 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 69ce18ad78fc2aa77294f2edd143f6bf1e85e823..1e9cd77c898dbfeeb40663423fefc28ca0369aae 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 568044e21c1e5e90d831557275a4619a6167cd1f..bae25d84ff241d2f898864937b1e3ac1d803aab2 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 1050d6ad0beca15ace7507b8afe14bf8a7be4038..177714c125a19ffb26337ea36dfcfd3c4ca3dafb 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 a76447f3829261552f24d672a8ecb28c5c15c9e7..9dd77cb01375cc2864f178306dc2912fae21beac 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 6ecaa1aca88e92e9d4eb8ed362b377191eea8dde..efc7a366e4ed8edc2848d82d4fd7e2fed5a127b7 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 4ca5b544369a3e1dd6e7824a7affad0f0521475b..b77fe9e0b95bffdbcc1caca15484d6020d777ab3 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 f63ccf09df9ee8804e5c06fbf40ea9ff212be03b..e19ef84866f2a1d13f06263fd254a6185bb4e6e3 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 78767040652c31399f64d82ad34aab3d4415faab..7e869a0d51979e46ad81e4046b2a26ecc65f8825 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 99291254cad26d307ad027a05b15fcb347d9a580..96d8bc918512aa937863f0ad806ee643fba8a41e 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 0d1d0cef219c14690bf96f41a772166b3b55b7a4..1e3ad6a20e30c173db9eb555623f42ab87471560 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 74ab245e5114002bfe3a6ae1047b360cf2e42cfa..a2b21ca82d20896c8142e4057b58e0918e7f313c 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 b9d5a6f58389ae5bb93b39134d7956cf077c1dba..4dce06e1e63ddce41f4afef0a219d29f37abf81b 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 9a77602d365932ef5e722af3b7ab69aec794cff6..bbc5d46e7d13f7e465cc75b820f21d7d7c8c0ef4 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 1beaa23056edd836eb2ee079f7bf7410d2057726..8100528edef6dd1826d80832f046b5f5ea6ae996 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 b5a383ea89c95cb4cc924feb03fbc58ee44f48b8..f63757df93038ed221de542e9a57c061bc9a972f 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 add89868f7221482e5c1f2d7732e9507d3a325e8..5ebba7c50228e667c5bdc77b496ee64d2aa74937 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 8a78cc68013c4342bdfd77453d67a1ca123c1b33..1d7c4ad84494e493a1d5d3ebaeaf3a259ed18ad9 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 4dcd68d1daf33882869aa64cdcecedf6cfaaf09d..56ddb05d8355447de1c462f8e867e70ecca3fa36 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 4074c5b09bab1e08e3427a6b256fbd3e092bcb84..8e3a680e4fc39dfec0c414f9b507009ab5345bf1 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 e93243ae6f5878db7ec16756583b33b98c1d2640..b622f5315e88ec6926074ed34d9de58e3d4327f1 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 4a870fdea63caac660b31c9bf14383b12eeb65f2..0b9347d7c899460fe18661f86d8af2694bcd9174 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 e2cd21992bf40bb800755c422fae91acddbb4eb4..0adc2dadcdbc09f9f485143c2a365c371db601dd 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 e972aca15f4170d0676a01d05b8f6e4477274266..a5f85fe90a003360f7d601839fc1f1912a55744f 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 f6ec17d1f2e28edf849a3b8ecef9c1cc94c97891..d5a6586125a902787a526cbfc753d3ada57aadc0 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 f3cca979fe91af70480320fcc501dcc29afdbfb5..b19337290a9212b77d881d0eebd68dd1bda7244f 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 f57eb69ce238214e619982f54df85f1a42f2d20d..534eb3b83efefe8140e3fdee1fda54655aa9391b 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 0d7efcfe8ba35e0af9f06eca9b27cee0701d4c2f..b8073afc16a468ef3e1dd2e18d7e8614b8f0a5b8 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 55c009905b20f50ba41554dea5bf43ea380f5179..055bc9319469a297ee01e42381f03f357d22fe04 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 361d4fe43feeb235dccce4caa04ff591821449ca..d5d8774e6f4423b91d43fb8ccbdb19f972b5ab60 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 9586bc1accc740266e4ab83c53e0adef7c514eed..80c6efbfcf02dce5ee1a16199d0b04062365ef81 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 20dd4b5f4ed288f156c8834d7f81d15c3c631c94..54f2ce2cef856dd40ca3540043a9b7b4417d706e 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 05d9212fdefc6636be2a3eba8093c8cac0c3ffae..3488320df324c39778994723862f99883a116d01 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 a281a743c7f2e501f6788ad176667490aa22259f..9baba6b96c1fd5c91e790d379a0fe2628c9150e8 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 d3d3a0d1a42b95d0b7851c59902af3f4ede14fa7..5f3dbb78b4b0262f4a30ca6f918e22b205d359db 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 632baf5d244886e336145f08a5cd6b22285cc79e..1e2064ae8aa9f60cdf3ba28436d0abcbfd077ae0 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 67ae7dfa994081ed068d4bf2826b16d9484c8619..563dbb95575b50a7ad2f55c7af4ec09078915d2e 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 dec0546b0f754b87d10c0f6656b526df5f637858..b8fc475582a88e8c070d566e73e21436a9c70f00 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 b39d7f3d25492cfdbfeca616154bc5c66f05a107..67ff2a991cbaf821873a5ac7d908775931d4e0d5 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 d25305f0306ca6faaf15e575f87e14aedf1f29a4..189e74e14ae1d2cfacec3d2b69da33b4dbf67c81 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 3aed7ecc2a8fc97108e9f0865b5300910faf0aab..3d9b3e17d1ef679bfa9a0dab059965dee92d17e4 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 2c1cf3ac8e791c080360032a7b107138f2a0560d..4affbd148a9ab5cace70b0a32b877a1a089cc8b6 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 2d4dda4fa8efa1f690c068c33102448aae70b2c6..a3a5df8ae63bed64609746f5ae97ee026421a1f0 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 0ee626f2b70e89b8acc1eb70731276afc9b2a414..243e3354e106a33b6d9e591232338d21d05f6b58 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 ae226cb5cc9261a42ccccb6778f4351c41b0d718..93f518162dda59136caf71bf30e44fa411e1c63a 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 365cfced6f032c9c8f5f83e99c6ef799e2024a9b..e432928cc6f6086010e0c74111962c789599a490 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 130f68fa4b4ee62a6281ead6e9c5e39206c4293f..f00a244aa2236f88a7f6c53a53ea9fc811f8656f 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 af5ecd3f8d7629bae97747897ca65d2b676f81a8..ac156eeee2d55f35b38d668a890b5dc54cf29d42 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 77f902fe7254e652e239a00179b35834a63885a8..a4bdd3027035787f43f9d697d3f5d0225e905fcc 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 5d08a6c9914e635f49efd4b73efafe9cd7b6016b..a9106becc204d9dc34c5b16b7eadad64725f1bd5 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 36a9d24ae03031e0424675ee5e87af430e201e92..a0938470025aeb23e574ed1cfc81bde21773015f 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 f5e4b41d0a590d077f49b0964e0b38bf907f7c20..4727cb08777f2455151e5c2ecbb5b92e48ef26e9 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 111acd0f1cc4e9ba22ca655331eb6b84f997cd23..e78de3fc6036640cd1c79c7a396163a3df4a2ad2 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 63c79c2c46c63ede803afd01688609a2f9eb379b..be4f796ce445ed384be00de67be6a55bdaf40632 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 cc5a8f1395762ddf5f3168fc968652944101e873..6974d97a99b2f46de3cf55373b4024f7e382cb48 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 6a6866885a331d3e509f1324450de7449ba4e536..38e57cdb10a64f0aa2e2909e3084f3ad377d7a88 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 4e8cee0c0891d1344aa97dfd245ad90113daeed6..a23cc6097cc9c45971e67bdfc23d919b1d875642 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 72eb56ed67335d1f33b510055f6c5628ce01780e..6157ac063de2a968e4469691c9df0b6bd2e87e35 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 117a4663e78f569de14bd34056ea1d66ecf05852..bf0c2d74dbf8ea84bab43ea6f7cd25bc675a7290 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 2fd3359aaf3e08ebede8b06661e46d08541c154e..a6cedf51c96eb22e1f0a9364cb80aa289986d3c9 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 98875bed408873bb5a9793b338807392091047fb..611259727540519b90ff003c18f879099657778a 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 3c572509a77db68fde3e7604686234e9ff09e1d3..56c7791deaf32e80fe75b3adbb2a8e51f2980abd 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 e4e15914446eb937d74d4b7bb2e223809a75af43..236441bc4eeb9d777a58901371e2b252e45555e0 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 128a5147031761865289edeb09d651e5f3c4edbb..8b4cf7e7369eb6bbfe4a8ad66b6459b0e840072e 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 9c8932d636348bb6f90a3eff5db545d2c8ab3c12..c488bd096552715458389b51c14cdc17c1c63c32 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 5b6f5281048c05eb8ba5dbb2d1634323cb2e343c..e56c4dfe0d689f30cedc7e028d7d0ab75839883d 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 e8a4114e6e2c730d01bfe7c4e1ff1d148f552377..2f1a25e775ab2ebd46f10ba2bb8fb1ee569d273c 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 1fefa2b455ea3a9ae9cd50066e320252868558c1..7fc7491fb85b14eb0593ef249eb7fc69acc83654 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 35b3a9c87b8e698c10d99babe32afc3f3ec83d09..ffd559f63aa35d69530155b574485d68e4f2075b 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 f918df25ea631574abd628260dbe3987f132f3a9..549aa1c250440944583ef83671c3a5e15775f312 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 d0b1f3472b5ca5293280df8603f17639e4c4bb7c..24ee135945ddcee449a5b56fa97fada8bf152f1f 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 c879139653de76d1b0c7f02db9f158a629bbc544..44bf5c6661260f92d527b0d4311fb5deefde5e0e 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 259c939ed115abfed7da9d305586fe6671373d8e..8fa6100c389e95bc58d57d1b3600beb18881569f 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 983f08df28d3c44215a89cccee981498af4b9c48..bd89099b0f10841c2a94e82369883d4f27a0b70e 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 433867834e5452ef05898e477d3b8b2689c7fcd4..7ac8dcf5974806bf8a211156be80d905daaf5865 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 8b70c896918ee27fa078cd8202b704955408c07e..b9fc104d4e7c681f37ff33223f71f7675eb36c8e 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 f7319244eda5fa94453bcf6935e6865ce10e499a..37847351a2229154bd437fba43572e595fbebbf3 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 bbebbb0f1e31a1e7449597a7b021018ab2d9caa3..bc56038b132112608dc76eb2f483b2c28f3380aa 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 77b6e43ef5f845473c4b04f0f37d40cb649166ac..dcfb5e60f8bbca82c20a3a55bd144db8c1b08cbd 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 fafb293dbed716e7144283742a087788604045de..0e102950e36cd04d45dd04af4f96b6280c6e5818 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 ae307bcd72b91a00087086e6c38406c789ff257c..d41c6c2bbe31b817faef2ac1ef9cd53b796c6ba4 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 488a22eaee03d03f8e20bc0eb03dfa661138541e..4e73933911924e96cb29ad41658e2758d95dc95a 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 d2ef2eb5d9aad6f21fa556cbef986cb3be75485d..1fbeb2ea399181bea1802dc395943eb1cc841cbe 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 7af71126cea3328e2e25a5d99c276484acb2380b..9958209c3e3d67169f8101081ec0d7c710d7dead 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 526fe043b6f379390ca10c9e1efa8d937879b842..f1132e5e7d022f08f7874fea266cfa7957702a3e 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 f4e026f0bbb8be21d8938e231b0f37ac1572ce78..af1f6dbc9e08e5458f677d771c631de905ea37f0 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 f4cd97ea806c7e50a49e27abc927ddf685464fde..d816bdd8a9168f67f589be90a915b13a1138bfc5 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 c51468911645ccba693d079be7126bddec93fa50..fec7cafce2b6ed77642d5bdedf7da45955da0d3c 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 081d4c01d536825fbca5bd010e733dc534b56271..deb92b858c18df2f1c04ed66f487f719aa0839a2 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 6b7514435f2920478aafce228ad96065bfd11677..d756f690c59c943d1577befff7f45b2de9a9c398 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 9eba756ab1be31715f37f0afc6dbb50cb1b17ca7..52406191e5a0435c7f5c7b4204ac844da3d0c78a 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 d6ed39fdc28addee8557d4066e8af8306006f0d1..32564a5c6a769b8e5e66184f484027dc6df1064a 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 482b52337925cb62a71f312f65c5da974f9642e5..1b9a8b1604237aa2a1becc9b025e17f4ef8749d4 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 507d09e5838e424aa003f0f30ad498f96638d0f3..1b7668fc84e8090c97dcbec2de822e487e5c8eeb 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 0cb37bb0805e581466b9eac8751ca9354ebab4a5..da285b9dfd67a07075972fc6ebc7d94f888f2d8c 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 9ea2d73dc9c851f3483f54d640e7bbe8dc996e35..e2648685bd65cf40a8273cff51f863be1e1b7369 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 49cbf873987e6b8b2c6bbc7310aa9fa5ec131861..e98792ca270687d1d3afe807e95f009a961b10dd 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 545db0802705c84d78d047564597c6e2f2f40c89..85b274e862ba64d493e8fb2a80f964c71ac105bd 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 7a8b96648c42cda424ab2b9f7b9257cf238d407f..a7bfda9f89fdd20f2788eb7d8ac8442aa081a235 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 27ad19d326fef4f9af9852784b2152236e664a73..5a7485772dbcedf94af3bb93bd5a67761fe6f55c 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 117ebf26a3160fce85420fa3a133966f324b059f..3af401e2517283463739d1b00a3949c8f95d4962 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 77e0ade9102c2eb84463eb28a8d69d40f06666d8..48fca72df2e21aa2af76bb80219f78ea05317213 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 fb8b73b7fa0bd77fef736e3f70a4484f38747441..0bddcd07e73064e3e4611afac5c24f553a36cb7b 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 d707344826986ca11f3acb71436310000e854852..c8357abfc89997a87091e9a0f84f8d6b888b159e 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 db2efa5774453c083ce17fb3a7af39842b202688..2d0408c6920ca463c6ab90d3a6ffa79e057c1c83 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 867943abc6a5acba777f2ca661c9d0861088d9d8..090e93837135aa658873526539337e8a262dfcb2 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 c8c368a1bd9b6115df023cc1a1f950523c9e0edc..958bfc1320e9461b173fc8d80b5ddbfbd5a67b5c 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 cce492cfc34cd4f67875f142c8a53562d8d19514..5f320a4da01c6582e353b5ef8517dee74e37b3f2 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 7219c2b301e52975cbab76f30939ae30431c4b6c..ec3575910d7d007eecc5afc5615f2893f7c75df5 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 5d80f6160a77df322a8c9d6e7a8e04f5f3cdf226..b66e89a1feefa748f8f30d35715287827956d6a8 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 14efa3d1634f1c1a0dfb20aea8d1497849ce6e99..7ee0786dfc06e072b5722fb7a5447008f0890392 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 7c6e2608ebe70916fc445f896e4ecf1739222d89..4a2113e075e5f70d1442ef58612e02ddd5b98481 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 e0483053e79d6be66a6e9189d7296b334b33d55a..bdf110bbc520c96367a669458c44273fc7f5e160 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 424b5ce33eb2f277b09b0314ed29ffc40b37cbc5..2c19b5984e341aa48d4947d40fa0134f42e5e050 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 dcc29f45f5b7838da2c679ff0da709805bd88424..71521c899764e2ae8a40b57af8147e7d1c39a553 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 074e1360690826278850cfdb56fbbe2793cfac9a..e3a0882a70944b43520980a0abb562c3fa8d4601 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 c9f12ec4797ecb66408af9357bf075941c4931e0..b00087d35f909dd5186cc741f8dfbd3c3aad255f 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 9d63f3556b880016238b9d3b9a40166df5052821..c7333fbe4034de230442d7930fd952367fbc3edf 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 e9ff3f86b7801fb97049b260e926e7e1ad1baa9b..46867adc481f75c4849981c3f84101ea25fc0d4d 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 beb6ffd525972c35e73c5bb8ac9aa7e187c99ed1..ffb58fb71fbf1c5d3cb9afee2583d489e6f95354 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 acfde121ea305e4477ae4e733ab76730ab3c8bc7..6d3bbbb55e34ed5b3b7ea8e461b559590c328be6 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 734381a2a777fa057b8907273f2778c89eb9e4ff..8a5e29d61ad8a7c217bddbcf35b14ef5c2446c64 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 b6a13524190172213c4f6b851abde9a075288c93..84548bee0322bc00840e3498006a9640c5a2f001 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 2210a8e57580b0679e9488dc92b0ecba3b450bdd..3c4f713338fe848e6b60e72e684c7bcab21511fd 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 2ab90944f6445d3e2883075facf15b28aa25a1f6..1b11a4ff4b78ba8ff0209645bede481d26b509c4 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 ec4ab856486bc5532cf18412b6d0e3bb39977371..97641b1f52908e22e5a7686aabc951e7627b46b2 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 b5d51690db38aa7b57a3e64f429127cf04e967ee..c1077d66382a342669a26d0d4e46e8707b9353b1 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 a0f49905795e0811b43ce26dc622beea2cf26841..46af4ccd42cdcb71f23573661bf60a353e603bc0 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 b6be543852003fd737a9a47a2310084ceacaceb4..eef35fbf62dde738f97a84e79ac15daebf1450f6 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 cab1e9c67579e3004789ded9ce5998ca58d5cc52..916e09c9cb9d9698ee852f1d1d5e9ab4dfc0ab67 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 262ae7cc74f10f5e5ade7419e1167cf66ef9a3fe..b7f24af3d6276655d38d769f58f7734a8e1ab120 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 8bcd701f0588838302a7e91ab7fe0a35c0bef18d..b754bb0bf7d3572b6a64633cb181d2e24fb3e44a 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 0836df17abca51e541d9aa0ae84170ac3e2d2800..08710f943375eb5c852a0539b4a3eb2636095a84 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 e9e572ca5c5b92a013b2671cb8e8e2b7d9403cfa..14218d4c8cc2af47cd745fb2bd3c375632b19aab 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 26f7129f1763e6b9c13ffb59e779df66e55cd073..0b4cf94a0d40d292d9583d1b4efcc61aa239b697 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 7842194cfd8e738b967e405e5cc390f3e881283d..1072854fe52601ff8aad6f0695bffdc4b68950a8 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 cc9226c4e989c70a5dad27f9f475b629071d320a..b5394e335ac04adf77621286fb325c70bb18618a 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 e0efc39d8dde7593c90184ae42bf5942a1298b01..c312b48553bb79b25e7895ad7947826ff02fd25c 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 67aa7cd54104c5a4b7ff295eb1b1a97440e59061..440f5e7aa64e7bba9da3e129ade8bfd533ad9b24 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 04bf42107d4d45c306c58cf5342d42103d23b53e..e142e6eaffb29ceec7b1ba34d430868eb195b356 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 06aa988ae2e7ea858de55975b252eda896fdbd68..37beb992c63d53e8476547c6eb3907e461146a43 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 ab008f33302f8e6ebee66e26d8688d473e2a8d83..5730ce5e949aac3f224fd07808c7231a05aa73ef 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 996ab4cd27c14f41df3945b849fa4b2339ca54bb..daa4f3e9ac1a401e364763580432d05dea26a730 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 b581657c92103f0dc7c72f1d4f30ea97f056471d..4f9d3f88d85829c41f3e379eb3dc2099aeda07c0 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 456035c22304c3c1da46c9db5f7efaf66e79899e..8370caa281222bce7aaffacb202d97b6f15efb00 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 6b2e22a387f390f2c7cc3d63d3e95d66e06c8ad8..c5d4d5af3d2f91e1299bd2b6a46c71c8e78d6c94 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 3d85648b8b97474ff0c3493cfa231d0950f29277..47881330944570e86eb49d9a4be2816c03f6f3fa 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 f0a1e55691843689ea2924ff61c6ecd37d484e71..ff4ab29ef366d4383c96a71fddf85c9253330ae0 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 0c199b8a8b39cef7c8f93a94e993782b9eaed720..a1d2a7f7061335a612c09803ac170f94b1ced147 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 e796bb0abb1fdd643cf53d08b294e729ff51e364..ee6e9463436de9798d0d616063ae0b0e05e317db 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 a4ff0352e24db432b58d837e9d64f074b512aca9..44ee73483044992d0e3d7c4c819dc66fc13fec7f 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 1d389d3112e59dba0d8353eab070448527295ed2..df6f09444b220f056ebeca3967835a4b98d59eb1 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 f52892f4d381390a684224b5c1aceec13dcf4830..acad12e210cf40b86d28f077fa5d079c8b6534d0 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 6eca16676f6c93b0886f5ca467d10d6d8c3e2880..8848c8586604f2fba0b9156c61dd869b9e5647af 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 1951f548296d44f8ff8983b4bde82c2e269a21b2..a5b2a861632ad9aa18e0560cc6913bc8d14cef9e 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 749dad24f7c9f78a118a3d43b9177b1afcb889f4..b28cba3ff6dcd0027f5e31d6f0e883741932fcf4 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 fb3f49cb59152849e237361ec5aea09eba58f57c..c7f854bbca591d333a5f5f66bfb4f5c248483a88 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 57bcec1ef3be55a23ce731f22b3a9dd544d8452f..a824833c78aec6944619021f08f275df9f808b09 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 2bc7e83c4078402770bd976a7e44f1ff75931c62..8756aeb8c184ab7b95d8da09a50787dcfe51a467 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 d4ee147ee841ec761e36a348cceaa23052d758f6..98062f1b0ffbd19ec6fa16fea216ade69cb2d22c 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 d00395ac58b596f760a79435090abb464558e60a..ba96e4cefa36343e0a675054f8bf1547c9f4e1d7 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 dd2c0497e26517af653dcfe476a3e8d9132e0490..c5d463be714ee85d8294efda88fae6124c8246be 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 8e28437a42662da7c52e2d2ad02ecb53485793b5..5f66c7adda095945a927750729e9f2d99ca8715a 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 8257d32232fd57c2a2ab37a8b3f1fc8bff354f31..406991a46b842bf66f2e458df6d74679d9d635e6 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 13f2e5a0235c568ac30c87ee240727f7057f387c..e2c72028b9fbd3a88220ec5d279cd3de435f0286 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 eb8b1893c5d74dce9009b4148fa8a36d27bf818a..65318688362657c708aa986814b7bc07d53a190f 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 e960e26613050f5b8536a9a929679dbddddd41a1..02d118991c570665a35126ee8042201d1af802b8 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 4f56977e869021b74a90e62465ddcaa8eee25d5b..0b461e81ecb0e3cbee4a4d161c2cb7775facd91a 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 81fc22240d9092822976e2500d3a193d206430d9..105a11879699cb1ed3fdac0b66aed600cedc0582 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 4b979c70bf499c8d5667634664b0e31e3aa8df5d..c8e58dae141aea13ce24cb44af06b0b396cac7be 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 413226ea4e0060a8fa55cd54a2b7c2ee25ee5d5d..a8585018175be2a473edd0074cd0e8e8e2b395bf 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 c5c57d500e70878eeb8f653ee06a8e65ff9f5e68..27b2a9829d413c9d9d7b3063da1b9d2a21947662 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 4af543f29401dfb803b05d00c07f6d88e09de34e..1bc7d8d749a869c6e2f69cb2c5782d777df7c854 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 1899690ac546e70c98b8d598ae77a405020266c5..8327991765212936315c33b1a90afc7632cd1ca2 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 d8e8ce09ce29aed1cab5dc024f7fae7cd9b7aea6..573a0dad4421a28d1ee88d771e2c74872d4fe6b0 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 706a1dd6aaf55c7584a9111079f1f024cfa5ea19..8049de69da6b88b4152f7b41b15bf0efee5d499a 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 b014da5019cb3ab44eca988ca43bbf884e68bf8e..50a4baed4af120443931d1afe545d03793bb0311 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 24e16c8a0b9bb2dda09dbede09fbd849567d33d4..5fa49755de33e90a1a3a9281e49f5d56e86b3c73 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 9ed0a1bb51a772897f0d04fcbf7be9c3d7fd6466..a43dea5877693c9be0b42afee8ca7b2a1ed25659 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 c1a3c4fa082d3da697eb4fa7ff096ec48dc718cb..d7b7de8dbb7f422df2ffddb8fe31ce205d02af17 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 79218476b5e0d31438e985a53d68ce8a1c2c744c..77c79660904faa7c05a9ae12ad491e5a9421b728 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 ce6347514b7f6d347d3c91d977ead67eefccf52c..867097b962fe100290624ab006bff386c287aacb 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 0aa097bcf763c9169245a276c54ee1a93fe82fd1..d9e1bbf7aa85807ddae4fdfe385b201fdb00f076 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 efb8d2d7316204f9b189335a72e9519ebcfbf465..e05b439c434ebc1a7785eb0a3500a9aff1d406bc 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 113d0e2b83595205bef4deb52e7a85dd4e90be91..1ee4e4986f699b6f84db80fddb85786190842d30 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 1044eb116e9cb6c8ce030787d53756d341517ffe..84c30acb4e11863102c3be7294b6df09393cbd7d 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 27c3238dc742f685af694156cf9d1e6960288880..926d7cafffcf48b856a2a646f1d74ff6b13166f0 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 941317534a41cf5d551460b98756aafc58b6e798..212c11440dcd19130589765efd823ed3ed01db67 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 e6c9372c733894c6252d5fd6708e1bb936a30c56..89175b4a3b4250262f3574b5ccb86fc41b9e48d2 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 23b2140fd7213dc498f55cd9e85c5a9f34d63048..991ba659171b154c344d3f2479524d8455150582 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 98d36f0828c989f859c5a8c1e23cdb229418c04c..f9afb144f00fb125c5ca468ba8d01a90ac961275 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 cca8d0acad410fefedee637620fe71ae5fc3f0e7..17e9d129fc14037d40157e7473c62b44e76774e1 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 833debaeeb138e0cbd1dcc9e158a2854d389ba64..3a6a33cfb3d432d7553242bc00c8db1f5311d45e 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 83538025d611593d0e30710bfabe49bb31322dc0..2acf9af6cbc533d5c954edca4a26c0a04bd80502 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 48cd436145a52fa3377cddf4ddceb00b2d6cfbdd..41c6f140f0959bcf27c0e334f5e40570fa295a06 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 a53c716e20d4004abb3b9d7ffa8db1cf20999d1b..9dde77d5995f84136bd1c77d4cd15d9399d6644e 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 c9794634a0a0b384f767a3729eba430fcf1a5d03..24babbb80cd0f563645811436b580c239a51881b 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 560c97e33bd91e1d8fb178861ac0a10e1fd6d4ec..87c3a9d0ef448e038e26c5ae5b241cf2c630bca7 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 68ad56ad9c6fcc7794716e9e505df7d3a2ab7f09..8933fd9e05b39d83c316970c4227717cd5d74731 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 a7ad025de38d609c8e8dde1f4042b3f28c5f87b0..adada62ebc96bd87654a4ce2d85e4cc8856afe06 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 6df7686731bc5c12b6848ad0e502aab6cb887091..cdf1ddbeee71e37e586d981e116308c77df4f4ae 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 7a285e5817ae980e702551cbb9a43cb3e2312eaf..96f127b9fcf4e3f4c3538a8efc53de5ce5c5edce 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 4f51a396afbbbb639090bbc07085ddcb47af04dd..0345fe24908e5b5858b476050e21ddb92d46741e 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 a2556662a641515e55305abd0a8ae124acfe0fdf..f9640b396793e7bfa96833b96961dab90cc1281e 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 c5d99b156a5cf10040e1f00489e6d6ba3488a27e..cec883895d21efe769e763a81931bd3edb51f4e9 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 c05661bbb01fdbea82adb4ca9f3c91454e6ec0de..0e4f2d0e00e2927a574a90726ac2438fcd5be220 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 02bf9c7f2bacabc16d9f5d023dd41ef7c516173f..5e8390454ba266962c2ec0c18f90ae22c1215344 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 183e3d9b901a1b03bbd3f8df011305659231f3e7..9ec1d0d20ccea0ee8c04497085a7306a1444354a 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 b7f6f5f8ec6a62238a6d0894bd8389abcb3f5c35..f2c9d185d3c8b272771e419fadef8b0d34a601e4 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 15e169f77513e52399b56f0ed2b82e3660ef1443..ee714080ecc2399e1ff9044f2204372a67c29dfc 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 cad795c7fa5ce55302918568c701418813e4ec9a..6e8d2f015e8b514c0031585c2a74f1221176bc4e 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 45124cd0f2a998476ce77fe49456eecfddc8036e..ed121eea6ec182dde937f81cad69cecd3314d468 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 61064e1c8a30b66645a702c28db4111553987c84..07871fa24afe7522fb6805588bba0239902c7d60 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 46b97cfa2e1e81da02957ae51e92a1d49d8334cf..6c4e9bdcfe0d49bdbb5a37acc0cd601aca83e3fc 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 4bb79a368ea5a481f7925416f2e1f98cb52584e0..b149cfa30dc4157eb6fdd209b51b35c320a5ea23 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 2d50e7ebdacdb12611fc6f05e82163ecadce4ea3..94a6d34d63fd31fe0fd177efa8e7f976a8f2012f 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 9e49d76bf1e8c7b3add1a244f2d8756f4ad5ff9a..ab2ae11d35f2f563b14be941c90ab5d139d98903 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 3f051e9205d566d30bae3443d82920c9e2ced82d..20fd800b84a98fd21d384387b4aaaf4d647c60cf 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 06e4d08d9d4bfeb08365ffe35f39dee70c0bad88..5c8283d84107861c5eec4354a82abbc270c8af71 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 8446fedcd1775882d0f380b78aee44d39e5b9dd1..ebb8be19f076f9de3b63897da30cd15b0e5036ce 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 15a4d7738aed6311e6650398c7b77ce4fc14739d..b907ff59fb622aed40e71b813f9154d63735854e 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 4b6dc42bfc088b7aa69be0e2dc0cfc366f858ce0..f8eabb0b722f1b9398c9c341f6268a0c44cc1346 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 dc3b2da427969dbe397ec66241436901fa32e87e..31a5979dcaa1c7474dd9b11d95fcebc5dfd56082 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 54933eb7294fce03a28ea2f5e9f94a33af1e6cd4..4304be07d8dbfe0d01aa9268ad30daffb7dd9450 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 dda6daf883addc7ba09c8039d3d531b3c01e5032..d31cf7c6e3fe3e4eddc8fcf0261a705e6e14bd32 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 bde1ea4684f054a37a227b08ed6045b0bb86b760..84894c942c875ae666dbec220b85271086151e03 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 38776044e2951226626866e5b9a6a4ca00bcea6f..8e95bff968b873d4d6b795620b3075cb981e584e 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 246e476983b82a0a38c180f9ab76567f833d19fd..1bfc914d5ae960074c8df473177992cc073b08e3 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 9fb7cae6b4960a1f99f6e933a2190be2517a11a1..2ede2c9d4f8ecc33b5f7bc878fab6d05eed4c0e4 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 7e542a0baf9a3a32c5f2cd7bf1883acebc512567..35b65acfe59e7028bb20bcfdf550eed3a8f4761f 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 2271afd4ff8c3e5677aade812f8bf7b58f90daa9..8de85ffda91edddadbfbb2286a4a6ff9b14e712d 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 bb75dde12b1fd824130a3ed7db3592a15a27aeee..11b0df989119f867f70540cb7e4c0116e7f8d5a9 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 504a589cec6b7eac4bb27ef07386fdba8a2a4115..281ebdaa9e89fad47530c7ba63483effa8650e54 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 d30391c740cc7f8c3f30ec7b155a306ed0b281a6..a2f84c4d27fef6996400942c4b22ee2f02f6de90 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 2c135158d03cadac051036ee1da2a9da0c558348..e0973053efef86f07dc23f3bffeb404989d41464 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 ee811f0d3b0769ff95c7026d96e3ca4b2ed7cff9..4c29b9a178e3a7f4f907daf68532bce85e68e2d7 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 5295e54eb309ee15548d0c2e59087f9b7b6c7b5c..6ac4f505c3a55be9e3373f4a781be0b4ef24ab7a 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 148eb8fc7d4186f27ab6ca75c8f1705aa3dfc6a5..d6eb4eb5e28413c3a2d5f6069e3dc4da213ff4c8 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 8d3b8074c6d9088360062134dceb5f2362f12f0f..2926ad8b1dc1ba029f7a29a32b4857de811967e2 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 6789bdd3afc5e94e2ee3ba09c94bd1767daf4486..8e354c72edbe96e975d1427c120d21954124e858 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 b80a154af8f507b0fa157622cc4fbce1e4defae9..bec668bd12ea787a112130b52753b72066f60188 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 903fbbabd80bb8fc251f0c48d31b10f52919d6ed..ca00305cd66eb1881b5aa813155651331f99e968 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 d79e1feca572cd24ee78b310ad7f425d4ec67725..284faa46f549d23e7adbc01395005ab7f2a64a8b 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 5ff50e626d3e9a3585c67c528f26ff14e8f4f129..fea8fdabd3577e64ee61fc86cf95f92d72b0b73b 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 c0a5200a787e39ee55b4fcfc35bbdd6393bc1281..ba42ba788aefb30080a82242d5fdf162c3cc0234 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 f9a27373799a11deae490512bdc1175d3ad02ba7..69b05b85d5e8c361381657b6816e5d40390c8a95 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 394e3c92b351643d779a3689afa965eb9d56e0ec..12242518469ee616a42e93041b3f1107287a8323 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 deafd82f40570b4d9abb584b3fd33587c6169ef3..18d1983a1574bd28a7d2c606e7a1549743616a7b 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 bc145caeb84b5a922b905dabe2a645ab2c420b4e..3305ec2fe0462f88d17364eb9c5729344ebab02c 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 50c70ab0dabc3389b32308732518bc85de2d42ff..5a16857a76f2722ee06ea092711803fedba193bc 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 78c1a2d2ae906c63fcd1623fed32839a5a29bc68..156ed3792e325122425b1042d73f58c830bddb67 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 9e60d2895b9092ebd6e9969a34f9664592328597..d77f1508c5469940a47146aefae196666e524ed8 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 c494903ecaca3422e47a5fb5949babe9edab1073..6bc8fce889e51c5177c873fa5bcb238d35db659b 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 7d80e84c78574214711c1e19825cf7f6a0eb95f6..61d454cf16791aa4b4342fc146c447e9bc4bd7b3 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 82392489840fc172303edba2d06e44725654a126..96dafd635501dccbca26638f978b616a6958d4fe 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 a535e971eeef7141a72514d707c3f68141c19ed5..f05589b85021ddc821a1f3017cb8067945dd511f 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 57db7fe287186bf4ad32cb5b5d25abeb2a407352..81a0039154850d6509ca2a6aa0642ada47144552 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 0735b1de872ebb383ad4097d85a40b8b5241ccff..a85f945b4be9e71ded2735b8a711891178c0f48c 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 c00d4696b2283bdcbf87d7a8273b6a6210232b72..8d6cadad4dde4fa9aff7f772567e462991585caa 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 b73ca002174a435dac1202739bd8bc25374eed44..ab6c3d1ac375af536897b315a72fe517556e6798 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 fd0fa43f21232e20b0b581152a3c191363ca81c5..c2acdfed4e6dc61cc01c5daea20ca6ca5503364e 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 1fee5d41579151ae1f2f3c29c7b60723e7bcfcff..22c939c8a755e17a5fc89a36e68f2a0b1c46bbee 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 959df2ebb5c32351de4e5eee1d79fd7f0fad2f34..47488b38801b3eb505ef7764a24d03d8defe2c02 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 37901e5ad30ceb0dee3029ec3f23fa3fe53f48c5..36a7f4a40bc9e52be44623a8f0d335fb94f1a84e 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 a7e32b1c147abcb1b66ec0bc41ac6f445d55e6b7..7550077555b5a377d72d738cdfdb671257d2bc7c 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 4fdb1b69125834cd2508218fd7d3e6d71eb5b1c6..8f4ff979047e518fadb6c268102c7632465cc2c1 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 046a1a13d78dad4eb8b3021e5f3aa974f16c4934..671895ceb3ec8763e36dfbd3148365424d35a9b3 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 35570089bab8c104e2dee155868ea1ab7fe7b06a..5d5b59182a284cde179c5c33e2b0192c8d67ae7a 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 4a6d8825d3929299d7145dc29034858dc3ede7e2..02d6924c4e4bbc8993cdfbea29e0688bff7edfeb 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 f65b11c1cf2d927127203df965af01ce2188f25a..5b79609ea2c0ddfd509722723a54527005a4df3e 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 a5d9f759ec4366cd53f7f619074d88f38c93f4c8..00205148bc0332ae1a59ff15bc696af4d5f08074 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 afdd7fcbcb552112e74cadb73723875c49c3787e..11774331a81fb9a6471ac5d863bcf81284a3fc97 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 96484e3c46bdb8672a0a3c4f2441cdf6238c1a10..2086e2783c0d9b1e5e16df68ba01e1cf37d3cb3f 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 470596a8751da8db2ae60543e8adb587684f8cb9..dd0fdbd9614b1b8c6725d4ab95dd94483567f5b4 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 3d057a79319377cbebf99fc1a45f0413c6b97a51..9fd06a29d3907309a1e479d26060151dc230eced 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 3c520012d27fe5fc0e043432910713eaf494819f..d8f410aca2b19636e8a9f86c32af26b18b0052a1 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 609fda1bf2dee58c61e5b79e7b6ff3767f779b99..6fd3182ea270992b01ed65d0dc47d2fc663759fb 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 ffb9f5540dfeae9532ea3813c31eea481ed2ca0f..eb8dd5f64b1798f718d0035eceb5acf01a3b2216 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 80689d3865a745f68872d4cebec41131a21f61d8..12792adb067cc418b34a4d60abb4e0be27816120 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 e3d3b2f5d2eed0226325a092a19d6730895ad673..37bda0da403d38ec4cef6dedb2e2eae937fe347e 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 07c9797120f5a9d080179599271b5f3bbb6c03ee..933f8566f5e33268c640ab075748e33f812d0bdb 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 fd7dc6c6521326841847b421c38bc39ae19ca87e..582f395ebfbf985c82cbd4c8485e842716f940a3 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 486e86def42d1921b31cf88960aad050c3bf4e8d..d0027e13743071c171d035ada9efc081bec1e010 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 ed1f19a68686d9f293c48ebb2ed0a35de89dedf7..271bef19ca0bf0076a3d4ef1e8baad5a03227780 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 c50b832aa72adde6ce7822f664a37d01872ba2a6..ce176d262990dfa2f4db3d7ebef95a70f94c9c8c 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 27ed10a57c5995dc02a52f84864023756c2818cd..e25dd3e5dfc9f15e69a3d51047ba9e8f08a8cdb1 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 b25c5072a98b2acbe6e9f00cbe8f1532a9dca5d7..624aaa59f6cda3282490300bfd1392181dd7e5ce 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 b53040970b2970c2fca1aa98252d250e395da1f0..64a11e90de49b2a2ff4f3a626a8945efa1d6f51d 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 49ae87a2cf9dd380cbb7541ca6bdb36097e77afb..f148e18af832069b971db558ab40a49853f073d1 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 70c7358bf01cd81dbfe3a13a165515c7a7270853..629ebc8dc2e18a704c0f308ca648b78fcc030fec 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 5e9c909e4a3a154bfc16ac3192f6b283c3b179ea..c1f253096a11b63ef1322d47f67346ea83f9b994 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 c290c87334629da47dd90e05fe9ee40ca93f259d..43ccb8fd864e96f48b3410d9ef67a8abe4e92105 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 d14cff7867f86490e372d9829808e78632df9a4a..a4f169b1565ff8c7d7436978548e4ef3f5e2f60d 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 4f001bfda58d83f496f8d6ce93900bae90928eb0..3acf540c4b5ae8907dfe418ece4d0a08f7d2083c 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 969c70a345de34754c4190df77fba4d546d7762a..8f2c03d76d744bf30028a15a1b56748797e654ad 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 552fbee231d63f866d63b340910e34237c66dffb..d14a083c177cff2113176d6d1f8469e9c5ff8799 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 e35d06a730620831a59ab7e4ace34021009abc14..068f13f23b78ce0b2918b431d149386f1922b9d9 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 070f1d12631d886d45d025b61b25f14243e3c12a..b7f55934346b7b093a1476648dd1d6fa261d3a39 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 a3d0b64d2b56bef1a616361bfac84e2bbee00908..ebd6002999cea4a4a5b9b7aac17b4c6e8930b897 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 a1a6aed5c92a9c801d8a38a76d88fdf159bffe83..d0eb9c871a78a14c21e2a4437083e0ca460068d0 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 41ffab51b38781494b37c868e85e52a1d0bd64a6..6927f442ccd7b96834498f5fe950d513a0ee1f76 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 c3d2a69824f5e0f96118bd8873a73b83c14abeaa..a60597aa6658e56c29e926634d3e6ac42c309444 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.