Issue #3442766 by smustgrave, quietone, mikelutz, catch: Remove deprecated code from bootstrap and lib/Controller, lib/Config

merge-requests/6756/merge
catch 2024-04-29 18:33:48 +01:00
parent b33c9f935b
commit 2f44d215e8
10 changed files with 5 additions and 190 deletions

View File

@ -37,23 +37,6 @@ const ERROR_REPORTING_DISPLAY_VERBOSE = 'verbose';
*/
const DRUPAL_EXTENSION_NAME_MAX_LENGTH = 50;
/**
* Time of the current request in seconds elapsed since the Unix Epoch.
*
* This differs from $_SERVER['REQUEST_TIME'], which is stored as a float
* since PHP 5.4.0. Float timestamps confuse most PHP functions
* (including date_create()).
*
* @see http://php.net/manual/reserved.variables.server.php
* @see http://php.net/manual/function.time.php
*
* @deprecated in drupal:8.3.0 and is removed from drupal:11.0.0.
* Use \Drupal::time()->getRequestTime();
*
* @see https://www.drupal.org/node/2785211
*/
define('REQUEST_TIME', (int) $_SERVER['REQUEST_TIME']);
/**
* Defines the root directory of the Drupal installation.
*

View File

@ -125,29 +125,6 @@ final class ConfigEvents {
*/
const IMPORT_MISSING_CONTENT = 'config.importer.missing_content';
/**
* Name of event fired to collect information on all config collections.
*
* This event allows modules to add to the list of configuration collections
* retrieved by \Drupal\Core\Config\ConfigManager::getConfigCollectionInfo().
* The event listener method receives a
* \Drupal\Core\Config\ConfigCollectionInfo instance.
*
* @Event
*
* @see \Drupal\Core\Config\ConfigCollectionInfo
* @see \Drupal\Core\Config\ConfigManager::getConfigCollectionInfo()
* @see \Drupal\Core\Config\ConfigFactoryOverrideBase
*
* @var string
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use
* \Drupal\Core\Config\ConfigCollectionEvents::COLLECTION_INFO instead.
*
* @see https://www.drupal.org/node/3406105
*/
const COLLECTION_INFO = ConfigCollectionEvents::COLLECTION_INFO;
/**
* Name of the event fired just before importing configuration.
*

View File

@ -201,7 +201,7 @@ class ConfigImporter {
* @param \Drupal\Core\Extension\ThemeExtensionList $extension_list_theme
* The theme extension list.
*/
public function __construct(StorageComparerInterface $storage_comparer, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, LockBackendInterface $lock, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler, TranslationInterface $string_translation, ModuleExtensionList $extension_list_module, ThemeExtensionList $extension_list_theme = NULL) {
public function __construct(StorageComparerInterface $storage_comparer, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, LockBackendInterface $lock, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler, TranslationInterface $string_translation, ModuleExtensionList $extension_list_module, ThemeExtensionList $extension_list_theme) {
$this->moduleExtensionList = $extension_list_module;
$this->storageComparer = $storage_comparer;
$this->eventDispatcher = $event_dispatcher;
@ -212,10 +212,6 @@ class ConfigImporter {
$this->moduleInstaller = $module_installer;
$this->themeHandler = $theme_handler;
$this->stringTranslation = $string_translation;
if ($extension_list_theme === NULL) {
@trigger_error('Calling ' . __METHOD__ . ' without the $extension_list_theme argument is deprecated in drupal:10.1.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3284397', E_USER_DEPRECATED);
$extension_list_theme = \Drupal::service('extension.list.theme');
}
$this->themeExtensionList = $extension_list_theme;
foreach ($this->storageComparer->getAllCollectionNames() as $collection) {
$this->processedConfiguration[$collection] = $this->storageComparer->getEmptyChangelist();

View File

@ -24,14 +24,8 @@ class Sequence extends ArrayElement {
*/
protected function getElementDefinition($key) {
$value = $this->value[$key] ?? NULL;
// @todo: Remove BC layer for sequence with hyphen in front. https://www.drupal.org/node/2444979
$definition = [];
if (isset($this->definition['sequence'][0])) {
$definition = $this->definition['sequence'][0];
$bc_sequence_location = $this->getPropertyPath();
@trigger_error("The definition for the '$bc_sequence_location' sequence declares the type of its items in a way that is deprecated in drupal:8.0.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/2442603", E_USER_DEPRECATED);
}
elseif ($this->definition['sequence']) {
if ($this->definition['sequence']) {
$definition = $this->definition['sequence'];
}
return $this->buildDataDefinition($definition, $value, $key);

View File

@ -389,51 +389,6 @@ class TypedConfigManager extends TypedDataManager implements TypedConfigManagerI
}
}
/**
* Replaces dynamic type expressions in configuration type.
*
* @param string $name
* Configuration type, potentially with expressions in square brackets.f
* @param array $data
* Configuration data for the element.
*
* @return string
* Configuration type name with all expressions resolved.
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use
* \Drupal\Core\Config\Schema\TypeResolver::resolveDynamicTypeName::resolveDynamicTypeName()
* instead.
*
* @see https://www.drupal.org/node/3408266
*/
protected function replaceName($name, $data) {
@trigger_error(__METHOD__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Config\Schema\TypeResolver::resolveDynamicTypeName() instead. See https://www.drupal.org/node/3408266', E_USER_DEPRECATED);
return TypeResolver::resolveDynamicTypeName($name, $data);
}
/**
* Resolves a dynamic type expression using configuration data.
*
* @param string $value
* Expression to be resolved.
* @param array $data
* Configuration data for the element.
*
* @return string
* The value the expression resolves to, or the given expression if it
* cannot be resolved.
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use
* \Drupal\Core\Config\Schema\TypeResolver::resolveDynamicTypeName::resolveExpression()
* instead.
*
* @see https://www.drupal.org/node/3408266
*/
protected function replaceVariable($value, $data) {
@trigger_error(__METHOD__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Config\Schema\TypeResolver::resolveExpression() instead. See https://www.drupal.org/node/3408266', E_USER_DEPRECATED);
return TypeResolver::resolveExpression($value, $data);
}
/**
* {@inheritdoc}
*/
@ -475,48 +430,4 @@ class TypedConfigManager extends TypedDataManager implements TypedConfigManagerI
return $this->create($data_definition, $config_data, $config_name);
}
/**
* Resolves a dynamic type name.
*
* @param string $type
* Configuration type, potentially with expressions in square brackets.
* @param array $data
* Configuration data for the element.
*
* @return string
* Configuration type name with all expressions resolved.
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use
* \Drupal\Core\Config\Schema\TypeResolver::resolveDynamicTypeName()
* instead.
*
* @see https://www.drupal.org/node/3413264
*/
protected function resolveDynamicTypeName(string $type, array $data): string {
@trigger_error(__METHOD__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Config\Schema\TypeResolver::' . __FUNCTION__ . '() instead. See https://www.drupal.org/node/3413264', E_USER_DEPRECATED);
return TypeResolver::resolveDynamicTypeName($type, $data);
}
/**
* Resolves a dynamic expression.
*
* @param string $expression
* Expression to be resolved.
* @param array|\Drupal\Core\TypedData\TypedDataInterface $data
* Configuration data for the element.
*
* @return string
* The value the expression resolves to, or the given expression if it
* cannot be resolved.
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use
* \Drupal\Core\Config\Schema\TypeResolver::resolveExpression() instead.
*
* @see https://www.drupal.org/node/3413264
*/
protected function resolveExpression(string $expression, array $data): string {
@trigger_error(__METHOD__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Config\Schema\TypeResolver::' . __FUNCTION__ . '() instead. See https://www.drupal.org/node/3413264', E_USER_DEPRECATED);
return TypeResolver::resolveExpression($expression, $data);
}
}

View File

@ -30,19 +30,6 @@ final class Psr7RequestValueResolver implements ValueResolverInterface {
$this->httpMessageFactory = $http_message_factory;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:10.2.0 and is removed from drupal:11.0.0.
* There is no replacement.
*
* @see https://www.drupal.org/node/3383585
*/
public function supports(Request $request, ArgumentMetadata $argument): bool {
@trigger_error(__METHOD__ . ' is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3383585', E_USER_DEPRECATED);
return $argument->getType() == ServerRequestInterface::class;
}
/**
* {@inheritdoc}
*/

View File

@ -13,19 +13,6 @@ use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
*/
final class RouteMatchValueResolver implements ValueResolverInterface {
/**
* {@inheritdoc}
*
* @deprecated in drupal:10.2.0 and is removed from drupal:11.0.0.
* There is no replacement.
*
* @see https://www.drupal.org/node/3383585
*/
public function supports(Request $request, ArgumentMetadata $argument): bool {
@trigger_error(__METHOD__ . ' is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3383585', E_USER_DEPRECATED);
return $argument->getType() == RouteMatchInterface::class || is_subclass_of($argument->getType(), RouteMatchInterface::class);
}
/**
* {@inheritdoc}
*/

View File

@ -2,9 +2,7 @@
namespace Drupal\Core\Controller;
use Drupal\Core\DependencyInjection\ClassResolverInterface;
use Drupal\Core\Utility\CallableResolver;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
use Symfony\Component\HttpFoundation\Request;
/**
@ -22,19 +20,10 @@ class ControllerResolver implements ControllerResolverInterface {
/**
* Constructs a new ControllerResolver.
*
* @param \Drupal\Core\Utility\CallableResolver|\Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface $callableResolver
* @param \Drupal\Core\Utility\CallableResolver $callableResolver
* The callable resolver.
* @param \Drupal\Core\DependencyInjection\ClassResolverInterface|null $class_resolver
* The class resolver.
*/
public function __construct(protected CallableResolver|HttpMessageFactoryInterface $callableResolver, ClassResolverInterface $class_resolver = NULL) {
if ($callableResolver instanceof HttpMessageFactoryInterface) {
@trigger_error('Calling ' . __METHOD__ . '() with the $http_message_factory argument is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3353869', E_USER_DEPRECATED);
$this->callableResolver = \Drupal::service("callable_resolver");
}
if ($class_resolver !== NULL) {
@trigger_error('Calling ' . __METHOD__ . '() with the $class_resolver argument is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3353869', E_USER_DEPRECATED);
}
public function __construct(protected CallableResolver $callableResolver) {
}
/**

View File

@ -119,11 +119,6 @@ config_schema_test.schema_data_types:
type: sequence
sequence:
type: boolean
# @see \Drupal\Core\Config\Schema\Sequence::getElementDefinition()
sequence_bc:
type: sequence
sequence:
- type: boolean
config_schema_test_integer:
type: integer

View File

@ -402,8 +402,6 @@ class ConfigSchemaTest extends KernelTestBase {
/**
* Tests configuration value data type enforcement using schemas.
*
* @group legacy
*/
public function testConfigSaveWithSchema() {
$untyped_values = [
@ -424,10 +422,10 @@ class ConfigSchemaTest extends KernelTestBase {
'string' => 1,
],
'sequence' => [1, 0, 1],
'sequence_bc' => [1, 0, 1],
// Not in schema and therefore should be left untouched.
'not_present_in_schema' => TRUE,
];
$untyped_to_typed = $untyped_values;
$typed_values = [
@ -446,12 +444,10 @@ class ConfigSchemaTest extends KernelTestBase {
'string' => '1',
],
'sequence' => [TRUE, FALSE, TRUE],
'sequence_bc' => [TRUE, FALSE, TRUE],
'not_present_in_schema' => TRUE,
];
// Save config which has a schema that enforces types.
$this->expectDeprecation("The definition for the 'config_schema_test.schema_data_types.sequence_bc' sequence declares the type of its items in a way that is deprecated in drupal:8.0.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/2442603");
$this->config('config_schema_test.schema_data_types')
->setData($untyped_to_typed)
->save();