diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 5d4424a..c727d20 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -174,7 +174,7 @@ function config_get_config_directory($type = CONFIG_ACTIVE_DIRECTORY) { if (!empty($config_directories[$type])) { return $config_directories[$type]; } - throw new \Exception(format_string('The configuration directory type %type does not exist.', array('%type' => $type))); + throw new \Exception("The configuration directory type '$type' does not exist"); } /** diff --git a/core/lib/Drupal/Core/Config/InstallStorage.php b/core/lib/Drupal/Core/Config/InstallStorage.php index f3a3298..5c1d65a 100644 --- a/core/lib/Drupal/Core/Config/InstallStorage.php +++ b/core/lib/Drupal/Core/Config/InstallStorage.php @@ -91,9 +91,7 @@ public function getFilePath($name) { } // If any code in the early installer requests a configuration object that // does not exist anywhere as default config, then that must be mistake. - throw new StorageException(format_string('Missing configuration file: @name', array( - '@name' => $name, - ))); + throw new StorageException("Missing configuration file: $name"); } /** diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php index 98f4f84..e1a976a 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php @@ -215,7 +215,7 @@ public function addField($field, $type, $langcode) { $index_prefix .= "$next_index_prefix."; } else { - throw new QueryException(format_string('Invalid specifier @next.', array('@next' => $relationship_specifier))); + throw new QueryException("Invalid specifier '$relationship_specifier'"); } } } @@ -247,7 +247,7 @@ protected function ensureEntityTable($index_prefix, $property, $type, $langcode, return $this->entityTables[$index_prefix . $table]; } } - throw new QueryException(format_string('@property not found', array('@property' => $property))); + throw new QueryException("'$property' not found"); } /** diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index 7422669..8a96e51 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -1429,7 +1429,7 @@ protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $st // Check that the schema does not include forbidden column names. if (array_intersect(array_keys($field_schema['columns']), $this->storage->getTableMapping()->getReservedColumns())) { - throw new FieldException(format_string('Illegal field column names on @field_name', array('@field_name' => $storage_definition->getName()))); + throw new FieldException("Illegal field column names on {$storage_definition->getName()}"); } $field_name = $storage_definition->getName(); @@ -1651,7 +1651,7 @@ protected function getDedicatedTableSchema(FieldStorageDefinitionInterface $stor $properties = $storage_definition->getPropertyDefinitions(); $table_mapping = $this->storage->getTableMapping(); if (array_intersect(array_keys($schema['columns']), $table_mapping->getReservedColumns())) { - throw new FieldException(format_string('Illegal field column names on @field_name', array('@field_name' => $storage_definition->getName()))); + throw new FieldException("Illegal field column names on {$storage_definition->getName()}"); } // Add field columns. diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index 47e0657..41e698c 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -138,10 +138,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) { if (!$enabled) { // Throw an exception if the module name is too long. if (strlen($module) > DRUPAL_EXTENSION_NAME_MAX_LENGTH) { - throw new ExtensionNameLengthException(format_string('Module name %name is over the maximum allowed length of @max characters.', array( - '%name' => $module, - '@max' => DRUPAL_EXTENSION_NAME_MAX_LENGTH, - ))); + throw new ExtensionNameLengthException("Module name '$module' is over the maximum allowed length of " . DRUPAL_EXTENSION_NAME_MAX_LENGTH . ' characters'); } // Check the validity of the default configuration. This will throw @@ -322,9 +319,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { foreach ($reasons as $reason) { $reason_message[] = implode(', ', $reason); } - throw new ModuleUninstallValidatorException(format_string('The following reasons prevents the modules from being uninstalled: @reasons', array( - '@reasons' => implode('; ', $reason_message), - ))); + throw new ModuleUninstallValidatorException('The following reasons prevents the modules from being uninstalled: ' . implode('; ', $reason_message)); } // Set the actual module weights. $module_list = array_map(function ($module) use ($module_data) { diff --git a/core/lib/Drupal/Core/TypedData/ListDataDefinition.php b/core/lib/Drupal/Core/TypedData/ListDataDefinition.php index b710a75..e0fd530 100644 --- a/core/lib/Drupal/Core/TypedData/ListDataDefinition.php +++ b/core/lib/Drupal/Core/TypedData/ListDataDefinition.php @@ -87,7 +87,7 @@ public function getClass() { $item_type_definition = \Drupal::typedDataManager() ->getDefinition($this->getItemDefinition()->getDataType()); if (!$item_type_definition) { - throw new \LogicException(format_string('An invalid data type @plugin_id has been specified for list items.', array('@plugin_id' => $this->getItemDefinition()->getDataType()))); + throw new \LogicException("An invalid data type '{$this->getItemDefinition()->getDataType()}' has been specified for list items"); } return $item_type_definition['list_class']; } diff --git a/core/lib/Drupal/Core/TypedData/TypedDataManager.php b/core/lib/Drupal/Core/TypedData/TypedDataManager.php index bf41850..858d13d 100644 --- a/core/lib/Drupal/Core/TypedData/TypedDataManager.php +++ b/core/lib/Drupal/Core/TypedData/TypedDataManager.php @@ -98,7 +98,7 @@ public function createInstance($data_type, array $configuration = array()) { $type_definition = $this->getDefinition($data_type); if (!isset($type_definition)) { - throw new \InvalidArgumentException(format_string('Invalid data type %plugin_id has been given.', array('%plugin_id' => $data_type))); + throw new \InvalidArgumentException("Invalid data type '$data_type' has been given"); } // Allow per-data definition overrides of the used classes, i.e. take over @@ -178,7 +178,7 @@ public function create(DataDefinitionInterface $definition, $value = NULL, $name public function createDataDefinition($data_type) { $type_definition = $this->getDefinition($data_type); if (!isset($type_definition)) { - throw new \InvalidArgumentException(format_string('Invalid data type %plugin_id has been given.', array('%plugin_id' => $data_type))); + throw new \InvalidArgumentException("Invalid data type '$data_type' has been given"); } $class = $type_definition['definition_class']; return $class::createFromDataType($data_type); @@ -198,7 +198,7 @@ public function createDataDefinition($data_type) { public function createListDataDefinition($item_type) { $type_definition = $this->getDefinition($item_type); if (!isset($type_definition)) { - throw new \InvalidArgumentException(format_string('Invalid data type %plugin_id has been given.', array('%plugin_id' => $item_type))); + throw new \InvalidArgumentException("Invalid data type '$item_type' has been given"); } $class = $type_definition['list_definition_class']; return $class::createFromItemType($item_type); diff --git a/core/modules/locale/src/StringDatabaseStorage.php b/core/modules/locale/src/StringDatabaseStorage.php index 06f9f97..de62484 100644 --- a/core/modules/locale/src/StringDatabaseStorage.php +++ b/core/modules/locale/src/StringDatabaseStorage.php @@ -199,9 +199,7 @@ public function delete($string) { } } else { - throw new StringStorageException(format_string('The string cannot be deleted because it lacks some key fields: @string', array( - '@string' => $string->getString(), - ))); + throw new StringStorageException('The string cannot be deleted because it lacks some key fields: ' . $string->getString()); } return $this; } @@ -483,9 +481,7 @@ protected function dbStringInsert($string) { ->execute(); } else { - throw new StringStorageException(format_string('The string cannot be saved: @string', array( - '@string' => $string->getString(), - ))); + throw new StringStorageException('The string cannot be saved: ' . $string->getString()); } } @@ -516,9 +512,7 @@ protected function dbStringUpdate($string) { ->execute(); } else { - throw new StringStorageException(format_string('The string cannot be updated: @string', array( - '@string' => $string->getString(), - ))); + throw new StringStorageException('The string cannot be updated: ' . $string->getString()); } } diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php index 481b031..ba8622b 100644 --- a/core/modules/simpletest/src/KernelTestBase.php +++ b/core/modules/simpletest/src/KernelTestBase.php @@ -381,9 +381,7 @@ protected function defaultLanguageData() { protected function installConfig(array $modules) { foreach ($modules as $module) { if (!$this->container->get('module_handler')->moduleExists($module)) { - throw new \RuntimeException(format_string("'@module' module is not enabled.", array( - '@module' => $module, - ))); + throw new \RuntimeException("'$module' module is not enabled"); } \Drupal::service('config.installer')->installDefaultConfig('module', $module); } @@ -411,18 +409,13 @@ protected function installSchema($module, $tables) { // behavior and non-reproducible test failures, we only allow the schema of // explicitly loaded/enabled modules to be installed. if (!$this->container->get('module_handler')->moduleExists($module)) { - throw new \RuntimeException(format_string("'@module' module is not enabled.", array( - '@module' => $module, - ))); + throw new \RuntimeException("'$module' module is not enabled"); } $tables = (array) $tables; foreach ($tables as $table) { $schema = drupal_get_module_schema($module, $table); if (empty($schema)) { - throw new \RuntimeException(format_string("Unknown '@table' table schema in '@module' module.", array( - '@module' => $module, - '@table' => $table, - ))); + throw new \RuntimeException("Unknown '$table' table schema in '$module' module."); } $this->container->get('database')->schema()->createTable($table, $schema); } diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php index a61b850..7ee7316 100644 --- a/core/modules/views/src/Plugin/views/query/Sql.php +++ b/core/modules/views/src/Plugin/views/query/Sql.php @@ -1454,7 +1454,7 @@ function execute(ViewExecutable $view) { drupal_set_message($e->getMessage(), 'error'); } else { - throw new DatabaseExceptionWrapper(format_string('Exception in @label[@view_name]: @message', array('@label' => $view->storage->label(), '@view_name' => $view->storage->id(), '@message' => $e->getMessage()))); + throw new DatabaseExceptionWrapper("Exception in {$view->storage->label()}[$view->storage->id()]: {$e->getMessage()}"); } }