Issue #3106216 by Spokje, longwave, alexpott, apaderno, Hardik_Patel_12, daffie: Remove unused variables from core

merge-requests/1634/head
Alex Pott 2022-01-10 12:07:03 +00:00
parent a0b2090aac
commit 2f1c716625
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
74 changed files with 100 additions and 91 deletions

View File

@ -516,7 +516,7 @@ function drupal_flush_all_caches($kernel = NULL) {
$module_handler = \Drupal::moduleHandler(); $module_handler = \Drupal::moduleHandler();
// Flush all persistent caches. // Flush all persistent caches.
$module_handler->invokeAll('cache_flush'); $module_handler->invokeAll('cache_flush');
foreach (Cache::getBins() as $service_id => $cache_backend) { foreach (Cache::getBins() as $cache_backend) {
$cache_backend->deleteAll(); $cache_backend->deleteAll();
} }

View File

@ -1173,7 +1173,7 @@ function install_verify_database_ready() {
$table = key($system_schema); $table = key($system_schema);
$existing_install = FALSE; $existing_install = FALSE;
if ($database = Database::getConnectionInfo()) { if (Database::getConnectionInfo()) {
try { try {
$existing_install = Database::getConnection()->schema()->tableExists($table); $existing_install = Database::getConnection()->schema()->tableExists($table);
} }
@ -2424,7 +2424,6 @@ function install_config_revert_install_changes() {
$config_importer->import(); $config_importer->import();
} }
catch (ConfigImporterException $e) { catch (ConfigImporterException $e) {
global $install_state;
$messenger = \Drupal::messenger(); $messenger = \Drupal::messenger();
// There are validation errors. // There are validation errors.
$messenger->addError(t('The configuration synchronization failed validation.')); $messenger->addError(t('The configuration synchronization failed validation.'));

View File

@ -250,8 +250,8 @@ class OptimizedPhpArrayDumper extends Dumper {
$service['shared'] = $definition->isShared(); $service['shared'] = $definition->isShared();
} }
if (($decorated = $definition->getDecoratedService()) !== NULL) { if ($definition->getDecoratedService() !== NULL) {
throw new InvalidArgumentException("The 'decorated' definition is not supported by the Drupal 8 run-time container. The Container Builder should have resolved that during the DecoratorServicePass compiler pass."); throw new InvalidArgumentException("The 'decorated' definition is not supported by the Drupal run-time container. The Container Builder should have resolved that during the DecoratorServicePass compiler pass.");
} }
if ($callable = $definition->getFactory()) { if ($callable = $definition->getFactory()) {

View File

@ -130,8 +130,8 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
} }
// Invoke listeners and resolve callables if necessary. // Invoke listeners and resolve callables if necessary.
foreach ($this->listeners[$event_name] as $priority => &$definitions) { foreach ($this->listeners[$event_name] as &$definitions) {
foreach ($definitions as $key => &$definition) { foreach ($definitions as &$definition) {
if (!isset($definition['callable'])) { if (!isset($definition['callable'])) {
$definition['callable'] = [$this->container->get($definition['service'][0]), $definition['service'][1]]; $definition['callable'] = [$this->container->get($definition['service'][0]), $definition['service'][1]];
} }
@ -173,8 +173,8 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
} }
// Collect listeners and resolve callables if necessary. // Collect listeners and resolve callables if necessary.
foreach ($this->listeners[$event_name] as $priority => &$definitions) { foreach ($this->listeners[$event_name] as &$definitions) {
foreach ($definitions as $key => &$definition) { foreach ($definitions as &$definition) {
if (!isset($definition['callable'])) { if (!isset($definition['callable'])) {
$definition['callable'] = [$this->container->get($definition['service'][0]), $definition['service'][1]]; $definition['callable'] = [$this->container->get($definition['service'][0]), $definition['service'][1]];
} }
@ -202,7 +202,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
} }
// Resolve service definitions if the listener has not been found so far. // Resolve service definitions if the listener has not been found so far.
foreach ($this->listeners[$event_name] as $priority => &$definitions) { foreach ($this->listeners[$event_name] as $priority => &$definitions) {
foreach ($definitions as $key => &$definition) { foreach ($definitions as &$definition) {
if (!isset($definition['callable'])) { if (!isset($definition['callable'])) {
// Once the callable is retrieved we keep it for subsequent method // Once the callable is retrieved we keep it for subsequent method
// invocations on this class. // invocations on this class.

View File

@ -79,7 +79,7 @@ EOS;
// In order to avoid that, check for each interface, whether one of its // In order to avoid that, check for each interface, whether one of its
// parents is also in the list and exclude it. // parents is also in the list and exclude it.
if ($interfaces = $reflection->getInterfaces()) { if ($interfaces = $reflection->getInterfaces()) {
foreach ($interfaces as $interface_name => $interface) { foreach ($interfaces as $interface) {
// Exclude all parents from the list of implemented interfaces of the // Exclude all parents from the list of implemented interfaces of the
// class. // class.
if ($parent_interfaces = $interface->getInterfaceNames()) { if ($parent_interfaces = $interface->getInterfaceNames()) {

View File

@ -143,7 +143,7 @@ abstract class AccessResult implements AccessResultInterface, RefinableCacheable
if ($conjunction == 'AND' && !empty($permissions)) { if ($conjunction == 'AND' && !empty($permissions)) {
$access = TRUE; $access = TRUE;
foreach ($permissions as $permission) { foreach ($permissions as $permission) {
if (!$permission_access = $account->hasPermission($permission)) { if (!$account->hasPermission($permission)) {
$access = FALSE; $access = FALSE;
break; break;
} }
@ -151,7 +151,7 @@ abstract class AccessResult implements AccessResultInterface, RefinableCacheable
} }
else { else {
foreach ($permissions as $permission) { foreach ($permissions as $permission) {
if ($permission_access = $account->hasPermission($permission)) { if ($account->hasPermission($permission)) {
$access = TRUE; $access = TRUE;
break; break;
} }

View File

@ -544,7 +544,7 @@ class LibraryDiscoveryParser {
return 2; return 2;
} }
$categories[] = $category; $categories[] = $category;
foreach ($files as $source => $options) { foreach ($files as $options) {
if (!is_array($options)) { if (!is_array($options)) {
return 1; return 1;
} }

View File

@ -398,7 +398,7 @@ abstract class Database {
throw new ConnectionNotDefinedException('The specified database connection is not defined: ' . $key); throw new ConnectionNotDefinedException('The specified database connection is not defined: ' . $key);
} }
if (!$driver = self::$databaseInfo[$key][$target]['driver']) { if (!self::$databaseInfo[$key][$target]['driver']) {
throw new DriverNotSpecifiedException('Driver not specified for this database connection: ' . $key); throw new DriverNotSpecifiedException('Driver not specified for this database connection: ' . $key);
} }

View File

@ -769,7 +769,7 @@ abstract class ContentEntityBase extends EntityBase implements \IteratorAggregat
* Updates language for already instantiated fields. * Updates language for already instantiated fields.
*/ */
protected function updateFieldLangcodes($langcode) { protected function updateFieldLangcodes($langcode) {
foreach ($this->fields as $name => $items) { foreach ($this->fields as $items) {
if (!empty($items[LanguageInterface::LANGCODE_DEFAULT])) { if (!empty($items[LanguageInterface::LANGCODE_DEFAULT])) {
$items[LanguageInterface::LANGCODE_DEFAULT]->setLangcode($langcode); $items[LanguageInterface::LANGCODE_DEFAULT]->setLangcode($langcode);
} }

View File

@ -106,7 +106,7 @@ class EntityConstraintViolationList extends ConstraintViolationList implements E
public function getByFields(array $field_names) { public function getByFields(array $field_names) {
$this->groupViolationOffsets(); $this->groupViolationOffsets();
$violations = []; $violations = [];
foreach (array_intersect_key($this->violationOffsetsByField, array_flip($field_names)) as $field_name => $offsets) { foreach (array_intersect_key($this->violationOffsetsByField, array_flip($field_names)) as $offsets) {
foreach ($offsets as $offset) { foreach ($offsets as $offset) {
$violations[] = $this->get($offset); $violations[] = $this->get($offset);
} }

View File

@ -276,7 +276,7 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl
if (\Drupal::moduleHandler()->moduleExists('field')) { if (\Drupal::moduleHandler()->moduleExists('field')) {
$components = $this->content + $this->hidden; $components = $this->content + $this->hidden;
$field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions($this->targetEntityType, $this->bundle); $field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions($this->targetEntityType, $this->bundle);
foreach (array_intersect_key($field_definitions, $components) as $field_name => $field_definition) { foreach (array_intersect_key($field_definitions, $components) as $field_definition) {
if ($field_definition instanceof ConfigEntityInterface && $field_definition->getEntityTypeId() == 'field_config') { if ($field_definition instanceof ConfigEntityInterface && $field_definition->getEntityTypeId() == 'field_config') {
$this->addDependency('config', $field_definition->getConfigDependencyName()); $this->addDependency('config', $field_definition->getConfigDependencyName());
} }

View File

@ -229,7 +229,7 @@ abstract class EntityStorageBase extends EntityHandlerBase implements EntityStor
*/ */
protected function setStaticCache(array $entities) { protected function setStaticCache(array $entities) {
if ($this->entityType->isStaticallyCacheable()) { if ($this->entityType->isStaticallyCacheable()) {
foreach ($entities as $id => $entity) { foreach ($entities as $entity) {
$this->memoryCache->set($this->buildCacheId($entity->id()), $entity, MemoryCacheInterface::CACHE_PERMANENT, [$this->memoryCacheTag]); $this->memoryCache->set($this->buildCacheId($entity->id()), $entity, MemoryCacheInterface::CACHE_PERMANENT, [$this->memoryCacheTag]);
} }
} }

View File

@ -279,7 +279,7 @@ class ExtensionDiscovery {
return TRUE; return TRUE;
} }
foreach ($this->profileDirectories as $weight => $profile_path) { foreach ($this->profileDirectories as $profile_path) {
if (strpos($file->getPath(), $profile_path) === 0) { if (strpos($file->getPath(), $profile_path) === 0) {
// Parent profile found. // Parent profile found.
return TRUE; return TRUE;

View File

@ -312,7 +312,7 @@ abstract class ExtensionList {
$extensions = $this->doScanExtensions(); $extensions = $this->doScanExtensions();
// Read info files for each extension. // Read info files for each extension.
foreach ($extensions as $extension_name => $extension) { foreach ($extensions as $extension) {
$extension->info = $this->createExtensionInfo($extension); $extension->info = $this->createExtensionInfo($extension);
// Invoke hook_system_info_alter() to give installed modules a chance to // Invoke hook_system_info_alter() to give installed modules a chance to

View File

@ -88,7 +88,7 @@ class ModuleExtensionList extends ExtensionList {
protected function getExtensionDiscovery() { protected function getExtensionDiscovery() {
$discovery = parent::getExtensionDiscovery(); $discovery = parent::getExtensionDiscovery();
if ($active_profile = $this->getActiveProfile()) { if ($this->getActiveProfile()) {
$discovery->setProfileDirectories($this->getProfileDirectories($discovery)); $discovery->setProfileDirectories($this->getProfileDirectories($discovery));
} }

View File

@ -561,7 +561,7 @@ class ModuleInstaller implements ModuleInstallerInterface {
// Any cache entry might implicitly depend on the uninstalled modules, // Any cache entry might implicitly depend on the uninstalled modules,
// so clear all of them explicitly. // so clear all of them explicitly.
$this->moduleHandler->invokeAll('cache_flush'); $this->moduleHandler->invokeAll('cache_flush');
foreach (Cache::getBins() as $service_id => $cache_backend) { foreach (Cache::getBins() as $cache_backend) {
$cache_backend->deleteAll(); $cache_backend->deleteAll();
} }

View File

@ -142,7 +142,7 @@ class ThemeExtensionList extends ExtensionList {
// sub-themes. // sub-themes.
$this->fillInSubThemeData($themes, $sub_themes); $this->fillInSubThemeData($themes, $sub_themes);
foreach ($themes as $key => $theme) { foreach ($themes as $theme) {
// After $theme is processed by buildModuleDependencies(), there can be a // After $theme is processed by buildModuleDependencies(), there can be a
// `$theme->requires` array containing both module and base theme // `$theme->requires` array containing both module and base theme
// dependencies. The module dependencies are copied to their own property // dependencies. The module dependencies are copied to their own property

View File

@ -345,7 +345,7 @@ class EntityReferenceItem extends FieldItemBase implements OptionsProviderInterf
* Either the bundle string, or NULL if there is no bundle. * Either the bundle string, or NULL if there is no bundle.
*/ */
protected static function getRandomBundle(EntityTypeInterface $entity_type, array $selection_settings) { protected static function getRandomBundle(EntityTypeInterface $entity_type, array $selection_settings) {
if ($bundle_key = $entity_type->getKey('bundle')) { if ($entity_type->getKey('bundle')) {
if (!empty($selection_settings['target_bundles'])) { if (!empty($selection_settings['target_bundles'])) {
$bundle_ids = $selection_settings['target_bundles']; $bundle_ids = $selection_settings['target_bundles'];
} }

View File

@ -135,7 +135,7 @@ class DatabaseBackend implements FloodInterface {
*/ */
public function garbageCollection() { public function garbageCollection() {
try { try {
$return = $this->connection->delete(static::TABLE_NAME) $this->connection->delete(static::TABLE_NAME)
->condition('expiration', REQUEST_TIME, '<') ->condition('expiration', REQUEST_TIME, '<')
->execute(); ->execute();
} }

View File

@ -18,7 +18,7 @@ class FormErrorHandler implements FormErrorHandlerInterface {
*/ */
public function handleFormErrors(array &$form, FormStateInterface $form_state) { public function handleFormErrors(array &$form, FormStateInterface $form_state) {
// After validation check if there are errors. // After validation check if there are errors.
if ($errors = $form_state->getErrors()) { if ($form_state->getErrors()) {
// Display error messages for each element. // Display error messages for each element.
$this->displayErrorMessages($form, $form_state); $this->displayErrorMessages($form, $form_state);
@ -110,6 +110,7 @@ class FormErrorHandler implements FormErrorHandlerInterface {
// modify the original form. When processing grouped elements a reference to // modify the original form. When processing grouped elements a reference to
// the complete form is needed. // the complete form is needed.
if (empty($elements)) { if (empty($elements)) {
// phpcs:ignore DrupalPractice.CodeAnalysis.VariableAnalysis.VariableRedeclaration
$elements = &$form; $elements = &$form;
} }

View File

@ -88,7 +88,7 @@ class MenuParentFormSelector implements MenuParentFormSelectorInterface {
if (!isset($options[$menu_parent])) { if (!isset($options[$menu_parent])) {
// The requested menu parent cannot be found in the menu anymore. Try // The requested menu parent cannot be found in the menu anymore. Try
// setting it to the top level in the current menu. // setting it to the top level in the current menu.
[$menu_name, $parent] = explode(':', $menu_parent, 2); [$menu_name] = explode(':', $menu_parent, 2);
$menu_parent = $menu_name . ':'; $menu_parent = $menu_name . ':';
} }
if (isset($options[$menu_parent])) { if (isset($options[$menu_parent])) {

View File

@ -320,7 +320,7 @@ class Attribute implements \ArrayAccess, \IteratorAggregate, MarkupInterface {
public function __toString() { public function __toString() {
$return = ''; $return = '';
/** @var \Drupal\Core\Template\AttributeValueBase $value */ /** @var \Drupal\Core\Template\AttributeValueBase $value */
foreach ($this->storage as $name => $value) { foreach ($this->storage as $value) {
$rendered = $value->render(); $rendered = $value->render();
if ($rendered) { if ($rendered) {
$return .= ' ' . $rendered; $return .= ' ' . $rendered;

View File

@ -29,7 +29,7 @@ class TestHttpClientMiddleware {
$request = $request->withHeader('User-Agent', drupal_generate_test_ua($test_prefix)); $request = $request->withHeader('User-Agent', drupal_generate_test_ua($test_prefix));
} }
return $handler($request, $options) return $handler($request, $options)
->then(function (ResponseInterface $response) use ($request) { ->then(function (ResponseInterface $response) {
if (!drupal_valid_test_ua()) { if (!drupal_valid_test_ua()) {
return $response; return $response;
} }

View File

@ -155,7 +155,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface {
// entity, since we should determine whether the entity matches the // entity, since we should determine whether the entity matches the
// constraints and not whether the entity validates. // constraints and not whether the entity validates.
if (($data instanceof ListInterface || $data instanceof ComplexDataInterface) && !$data->isEmpty() && !($data instanceof EntityAdapter && $constraints_given)) { if (($data instanceof ListInterface || $data instanceof ComplexDataInterface) && !$data->isEmpty() && !($data instanceof EntityAdapter && $constraints_given)) {
foreach ($data as $name => $property) { foreach ($data as $property) {
$this->validateNode($property); $this->validateNode($property);
} }
} }

View File

@ -1118,6 +1118,7 @@ realword
rebuilder rebuilder
reclosed reclosed
recolorable recolorable
redeclaration
redirections redirections
redstrawberryhiddenfield redstrawberryhiddenfield
refactorings refactorings

View File

@ -76,7 +76,7 @@ class BlockPluginId extends ProcessPluginBase implements ContainerFactoryPluginI
[$module, $delta] = $value; [$module, $delta] = $value;
switch ($module) { switch ($module) {
case 'aggregator': case 'aggregator':
[$type, $id] = explode('-', $delta); [$type] = explode('-', $delta);
if ($type == 'feed') { if ($type == 'feed') {
return 'aggregator_feed_block'; return 'aggregator_feed_block';
} }

View File

@ -82,7 +82,7 @@ class SourceEditingRedundantTagsConstraintValidator extends ConstraintValidator
private function pluginsSupplyingTagsMessage(array $tags, array $plugin_definitions): string { private function pluginsSupplyingTagsMessage(array $tags, array $plugin_definitions): string {
$message_array = []; $message_array = [];
$message_string = ''; $message_string = '';
foreach ($plugin_definitions as $plugin_id => $definition) { foreach ($plugin_definitions as $definition) {
if ($definition->hasElements()) { if ($definition->hasElements()) {
$elements_array = HTMLRestrictionsUtilities::allowedElementsStringToHtmlFilterArray(implode('', $definition->getElements())); $elements_array = HTMLRestrictionsUtilities::allowedElementsStringToHtmlFilterArray(implode('', $definition->getElements()));
foreach ($elements_array as $tag_name => $tag_config) { foreach ($elements_array as $tag_name => $tag_config) {

View File

@ -712,7 +712,7 @@ function comment_entity_view_display_presave(EntityViewDisplayInterface $display
} }
// Disable the comment field formatter when the used view display is disabled. // Disable the comment field formatter when the used view display is disabled.
foreach ($storage->loadMultiple() as $id => $view_display) { foreach ($storage->loadMultiple() as $view_display) {
$changed = FALSE; $changed = FALSE;
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */ /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */
foreach ($view_display->getComponents() as $field => $component) { foreach ($view_display->getComponents() as $field => $component) {

View File

@ -193,7 +193,7 @@ class Comment extends ContentEntityBase implements CommentInterface {
$comments = $comment_storage->loadMultiple($child_cids); $comments = $comment_storage->loadMultiple($child_cids);
$comment_storage->delete($comments); $comment_storage->delete($comments);
foreach ($entities as $id => $entity) { foreach ($entities as $entity) {
\Drupal::service('comment.statistics')->update($entity); \Drupal::service('comment.statistics')->update($entity);
} }
} }

View File

@ -24,7 +24,7 @@ class Permissions {
public function transitionPermissions() { public function transitionPermissions() {
$permissions = []; $permissions = [];
/** @var \Drupal\workflows\WorkflowInterface $workflow */ /** @var \Drupal\workflows\WorkflowInterface $workflow */
foreach (Workflow::loadMultipleByType('content_moderation') as $id => $workflow) { foreach (Workflow::loadMultipleByType('content_moderation') as $workflow) {
foreach ($workflow->getTypePlugin()->getTransitions() as $transition) { foreach ($workflow->getTypePlugin()->getTransitions() as $transition) {
$permissions['use ' . $workflow->id() . ' transition ' . $transition->id()] = [ $permissions['use ' . $workflow->id() . ' transition ' . $transition->id()] = [
'title' => $this->t('%workflow workflow: Use %transition transition.', [ 'title' => $this->t('%workflow workflow: Use %transition transition.', [

View File

@ -55,7 +55,7 @@ class ViewsData {
return $this->moderationInformation->isModeratedEntityType($type); return $this->moderationInformation->isModeratedEntityType($type);
}); });
foreach ($entity_types_with_moderation as $entity_type_id => $entity_type) { foreach ($entity_types_with_moderation as $entity_type) {
$table = $entity_type->getDataTable() ?: $entity_type->getBaseTable(); $table = $entity_type->getDataTable() ?: $entity_type->getBaseTable();
$data[$table]['moderation_state'] = [ $data[$table]['moderation_state'] = [

View File

@ -369,7 +369,7 @@ function editor_entity_insert(EntityInterface $entity) {
return; return;
} }
$referenced_files_by_field = _editor_get_file_uuids_by_field($entity); $referenced_files_by_field = _editor_get_file_uuids_by_field($entity);
foreach ($referenced_files_by_field as $field => $uuids) { foreach ($referenced_files_by_field as $uuids) {
_editor_record_file_usage($uuids, $entity); _editor_record_file_usage($uuids, $entity);
} }
} }
@ -387,7 +387,7 @@ function editor_entity_update(EntityInterface $entity) {
// deletion of previous file usages are necessary. // deletion of previous file usages are necessary.
if (!empty($entity->original) && $entity->getRevisionId() != $entity->original->getRevisionId()) { if (!empty($entity->original) && $entity->getRevisionId() != $entity->original->getRevisionId()) {
$referenced_files_by_field = _editor_get_file_uuids_by_field($entity); $referenced_files_by_field = _editor_get_file_uuids_by_field($entity);
foreach ($referenced_files_by_field as $field => $uuids) { foreach ($referenced_files_by_field as $uuids) {
_editor_record_file_usage($uuids, $entity); _editor_record_file_usage($uuids, $entity);
} }
} }
@ -427,7 +427,7 @@ function editor_entity_delete(EntityInterface $entity) {
return; return;
} }
$referenced_files_by_field = _editor_get_file_uuids_by_field($entity); $referenced_files_by_field = _editor_get_file_uuids_by_field($entity);
foreach ($referenced_files_by_field as $field => $uuids) { foreach ($referenced_files_by_field as $uuids) {
_editor_delete_file_usage($uuids, $entity, 0); _editor_delete_file_usage($uuids, $entity, 0);
} }
} }
@ -441,7 +441,7 @@ function editor_entity_revision_delete(EntityInterface $entity) {
return; return;
} }
$referenced_files_by_field = _editor_get_file_uuids_by_field($entity); $referenced_files_by_field = _editor_get_file_uuids_by_field($entity);
foreach ($referenced_files_by_field as $field => $uuids) { foreach ($referenced_files_by_field as $uuids) {
_editor_delete_file_usage($uuids, $entity, 1); _editor_delete_file_usage($uuids, $entity, 1);
} }
} }

View File

@ -77,7 +77,6 @@ function field_purge_batch($batch_size, $field_storage_unique_id = NULL) {
$fields = $deleted_fields_repository->getFieldDefinitions($field_storage_unique_id); $fields = $deleted_fields_repository->getFieldDefinitions($field_storage_unique_id);
$info = \Drupal::entityTypeManager()->getDefinitions();
foreach ($fields as $field) { foreach ($fields as $field) {
$entity_type = $field->getTargetEntityTypeId(); $entity_type = $field->getTargetEntityTypeId();

View File

@ -70,6 +70,7 @@ class FieldUiTable extends Table {
$region_name = call_user_func_array($row['#region_callback'], [&$row]); $region_name = call_user_func_array($row['#region_callback'], [&$row]);
// Add the element in the tree. // Add the element in the tree.
// phpcs:ignore DrupalPractice.CodeAnalysis.VariableAnalysis.UnusedVariable
$target = &$trees[$region_name]['']; $target = &$trees[$region_name][''];
foreach ($parents[$name] as $key) { foreach ($parents[$name] as $key) {
$target = &$target['children'][$key]; $target = &$target['children'][$key];

View File

@ -31,7 +31,7 @@ class FileAccessControlHandler extends EntityAccessControlHandler {
} }
elseif ($references = $this->getFileReferences($entity)) { elseif ($references = $this->getFileReferences($entity)) {
foreach ($references as $field_name => $entity_map) { foreach ($references as $field_name => $entity_map) {
foreach ($entity_map as $referencing_entity_type => $referencing_entities) { foreach ($entity_map as $referencing_entities) {
/** @var \Drupal\Core\Entity\EntityInterface $referencing_entity */ /** @var \Drupal\Core\Entity\EntityInterface $referencing_entity */
foreach ($referencing_entities as $referencing_entity) { foreach ($referencing_entities as $referencing_entity) {
$entity_and_field_access = $referencing_entity->access('view', $account, TRUE)->andIf($referencing_entity->$field_name->access('view', $account, TRUE)); $entity_and_field_access = $referencing_entity->access('view', $account, TRUE)->andIf($referencing_entity->$field_name->access('view', $account, TRUE));

View File

@ -24,7 +24,7 @@ class RSSEnclosureFormatter extends FileFormatterBase {
$entity = $items->getEntity(); $entity = $items->getEntity();
// Add the first file as an enclosure to the RSS item. RSS allows only one // Add the first file as an enclosure to the RSS item. RSS allows only one
// enclosure per item. See: http://wikipedia.org/wiki/RSS_enclosure // enclosure per item. See: http://wikipedia.org/wiki/RSS_enclosure
foreach ($this->getEntitiesToView($items, $langcode) as $delta => $file) { foreach ($this->getEntitiesToView($items, $langcode) as $file) {
/** @var \Drupal\file\FileInterface $file */ /** @var \Drupal\file\FileInterface $file */
$entity->rss_elements[] = [ $entity->rss_elements[] = [
'key' => 'enclosure', 'key' => 'enclosure',

View File

@ -26,7 +26,7 @@ class TableFormatter extends DescriptionAwareFileFormatterBase {
if ($files = $this->getEntitiesToView($items, $langcode)) { if ($files = $this->getEntitiesToView($items, $langcode)) {
$header = [t('Attachment'), t('Size')]; $header = [t('Attachment'), t('Size')];
$rows = []; $rows = [];
foreach ($files as $delta => $file) { foreach ($files as $file) {
$item = $file->_referringItem; $item = $file->_referringItem;
$rows[] = [ $rows[] = [
[ [

View File

@ -285,7 +285,7 @@ class FilterHtml extends FilterBase {
// allowed attribute values with a wildcard. A wildcard by itself // allowed attribute values with a wildcard. A wildcard by itself
// would mean allowing all possible attribute values. But in that // would mean allowing all possible attribute values. But in that
// case, one would not specify an attribute value at all. // case, one would not specify an attribute value at all.
$allowed_attribute_values = array_filter($allowed_attribute_values, function ($value) use ($star_protector) { $allowed_attribute_values = array_filter($allowed_attribute_values, function ($value) {
return $value !== '*'; return $value !== '*';
}); });

View File

@ -77,9 +77,6 @@ class ResourceIdentifierNormalizer extends NormalizerBase implements Denormalize
} }
/** @var \Drupal\field\Entity\FieldConfig $field_definition */ /** @var \Drupal\field\Entity\FieldConfig $field_definition */
$field_definition = $field_definitions[$context['related']]; $field_definition = $field_definitions[$context['related']];
// This is typically 'target_id'.
$item_definition = $field_definition->getItemDefinition();
$property_key = $item_definition->getMainPropertyName();
$target_resource_types = $resource_type->getRelatableResourceTypesByField($resource_type->getPublicName($context['related'])); $target_resource_types = $resource_type->getRelatableResourceTypesByField($resource_type->getPublicName($context['related']));
$target_resource_type_names = array_map(function (ResourceType $resource_type) { $target_resource_type_names = array_map(function (ResourceType $resource_type) {
return $resource_type->getTypeName(); return $resource_type->getTypeName();
@ -87,7 +84,7 @@ class ResourceIdentifierNormalizer extends NormalizerBase implements Denormalize
$is_multiple = $field_definition->getFieldStorageDefinition()->isMultiple(); $is_multiple = $field_definition->getFieldStorageDefinition()->isMultiple();
$data = $this->massageRelationshipInput($data, $is_multiple); $data = $this->massageRelationshipInput($data, $is_multiple);
$resource_identifiers = array_map(function ($value) use ($property_key, $target_resource_type_names) { $resource_identifiers = array_map(function ($value) use ($target_resource_type_names) {
// Make sure that the provided type is compatible with the targeted // Make sure that the provided type is compatible with the targeted
// resource. // resource.
if (!in_array($value['type'], $target_resource_type_names)) { if (!in_array($value['type'], $target_resource_type_names)) {

View File

@ -360,9 +360,9 @@ class LayoutBuilderEntityViewDisplay extends BaseEntityViewDisplay implements La
public function calculateDependencies() { public function calculateDependencies() {
parent::calculateDependencies(); parent::calculateDependencies();
foreach ($this->getSections() as $delta => $section) { foreach ($this->getSections() as $section) {
$this->calculatePluginDependencies($section->getLayout()); $this->calculatePluginDependencies($section->getLayout());
foreach ($section->getComponents() as $uuid => $component) { foreach ($section->getComponents() as $component) {
$this->calculatePluginDependencies($component->getPlugin()); $this->calculatePluginDependencies($component->getPlugin());
} }
} }

View File

@ -32,7 +32,7 @@ class LayoutBuilderEntityViewDisplayStorage extends ConfigEntityStorage {
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function mapFromStorageRecords(array $records) { protected function mapFromStorageRecords(array $records) {
foreach ($records as $id => &$record) { foreach ($records as &$record) {
if (!empty($record['third_party_settings']['layout_builder']['sections'])) { if (!empty($record['third_party_settings']['layout_builder']['sections'])) {
$sections = &$record['third_party_settings']['layout_builder']['sections']; $sections = &$record['third_party_settings']['layout_builder']['sections'];
$sections = array_map([Section::class, 'fromArray'], $sections); $sections = array_map([Section::class, 'fromArray'], $sections);

View File

@ -73,7 +73,7 @@ class LayoutSectionItemList extends FieldItemList implements SectionListInterfac
parent::preSave(); parent::preSave();
// Loop through each section and reconstruct it to ensure that all default // Loop through each section and reconstruct it to ensure that all default
// values are present. // values are present.
foreach ($this->list as $delta => $item) { foreach ($this->list as $item) {
$item->section = Section::fromArray($item->section->toArray()); $item->section = Section::fromArray($item->section->toArray());
} }
} }

View File

@ -195,7 +195,7 @@ class TranslationStatusForm extends FormBase {
$this->moduleHandler->loadInclude('locale', 'compare.inc'); $this->moduleHandler->loadInclude('locale', 'compare.inc');
$project_data = locale_translation_build_projects(); $project_data = locale_translation_build_projects();
foreach ($status as $project_id => $project) { foreach ($status as $project) {
foreach ($project as $langcode => $project_info) { foreach ($project as $langcode => $project_info) {
// No translation file found for this project-language combination. // No translation file found for this project-language combination.
if (empty($project_info->type)) { if (empty($project_info->type)) {

View File

@ -171,7 +171,7 @@ class OEmbedIframeController implements ContainerInjectionInterface {
'#placeholder_token' => $placeholder_token, '#placeholder_token' => $placeholder_token,
]; ];
$context = new RenderContext(); $context = new RenderContext();
$content = $this->renderer->executeInRenderContext($context, function () use ($resource, $element) { $content = $this->renderer->executeInRenderContext($context, function () use ($element) {
return $this->renderer->render($element); return $this->renderer->render($element);
}); });
$response $response

View File

@ -130,7 +130,7 @@ class UrlResolver implements UrlResolverInterface {
public function getProviderByUrl($url) { public function getProviderByUrl($url) {
// Check the URL against every scheme of every endpoint of every provider // Check the URL against every scheme of every endpoint of every provider
// until we find a match. // until we find a match.
foreach ($this->providers->getAll() as $provider_name => $provider_info) { foreach ($this->providers->getAll() as $provider_info) {
foreach ($provider_info->getEndpoints() as $endpoint) { foreach ($provider_info->getEndpoints() as $endpoint) {
if ($endpoint->matchUrl($url)) { if ($endpoint->matchUrl($url)) {
return $provider_info; return $provider_info;

View File

@ -82,7 +82,7 @@ class ArrayBuild extends ProcessPluginBase {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$new_value = []; $new_value = [];
foreach ((array) $value as $old_key => $old_value) { foreach ((array) $value as $old_value) {
// Checks that $old_value is an array. // Checks that $old_value is an array.
if (!is_array($old_value)) { if (!is_array($old_value)) {
throw new MigrateException("The input should be an array of arrays"); throw new MigrateException("The input should be an array of arrays");

View File

@ -266,9 +266,6 @@ abstract class SqlBase extends SourcePluginBase implements ContainerFactoryPlugi
if ($this->batch == 0) { if ($this->batch == 0) {
$this->prepareQuery(); $this->prepareQuery();
// Get the key values, for potential use in joining to the map table.
$keys = [];
// The rules for determining what conditions to add to the query are as // The rules for determining what conditions to add to the query are as
// follows (applying first applicable rule): // follows (applying first applicable rule):
// 1. If the map is joinable, join it. We will want to accept all rows // 1. If the map is joinable, join it. We will want to accept all rows

View File

@ -382,7 +382,7 @@ class MigrationState {
$state_by_source = []; $state_by_source = [];
$dest_by_source = []; $dest_by_source = [];
$states = [static::FINISHED, static::NOT_FINISHED]; $states = [static::FINISHED, static::NOT_FINISHED];
foreach ($migration_states as $module => $info) { foreach ($migration_states as $info) {
foreach ($states as $state) { foreach ($states as $state) {
if (isset($info[$state][$version])) { if (isset($info[$state][$version])) {
foreach ($info[$state][$version] as $source => $destination) { foreach ($info[$state][$version] as $source => $destination) {

View File

@ -141,7 +141,7 @@ class NodeAccessControlHandler extends EntityAccessControlHandler implements Nod
return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->addCacheableDependency($node); return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
} }
[$revision_permission_operation, $entity_operation] = static::REVISION_OPERATION_MAP[$operation] ?? [ [$revision_permission_operation] = static::REVISION_OPERATION_MAP[$operation] ?? [
NULL, NULL,
NULL, NULL,
]; ];

View File

@ -358,9 +358,7 @@ function rdf_preprocess_node(&$variables) {
$fields = array_keys(\Drupal::service('comment.manager')->getFields('node')); $fields = array_keys(\Drupal::service('comment.manager')->getFields('node'));
$definitions = array_keys($variables['node']->getFieldDefinitions()); $definitions = array_keys($variables['node']->getFieldDefinitions());
$valid_fields = array_intersect($fields, $definitions); $valid_fields = array_intersect($fields, $definitions);
$count = 0;
foreach ($valid_fields as $field_name) { foreach ($valid_fields as $field_name) {
$count += $variables['node']->get($field_name)->comment_count;
// Adds RDFa markup for the comment count near the node title as // Adds RDFa markup for the comment count near the node title as
// metadata. // metadata.
$comment_count_attributes = rdf_rdfa_attributes($comment_count_mapping, $variables['node']->get($field_name)->comment_count); $comment_count_attributes = rdf_rdfa_attributes($comment_count_mapping, $variables['node']->get($field_name)->comment_count);

View File

@ -25,7 +25,7 @@ trait EntityResourceAccessTrait {
// Only check 'edit' permissions for fields that were actually submitted by // Only check 'edit' permissions for fields that were actually submitted by
// the user. Field access makes no difference between 'create' and 'update', // the user. Field access makes no difference between 'create' and 'update',
// so the 'edit' operation is used here. // so the 'edit' operation is used here.
foreach ($entity->_restSubmittedFields as $key => $field_name) { foreach ($entity->_restSubmittedFields as $field_name) {
if (!$entity->get($field_name)->access('edit')) { if (!$entity->get($field_name)->access('edit')) {
throw new AccessDeniedHttpException("Access denied on creating field '$field_name'."); throw new AccessDeniedHttpException("Access denied on creating field '$field_name'.");
} }

View File

@ -100,7 +100,7 @@ function system_post_update_entity_revision_metadata_bc_cleanup() {
}); });
// Remove the '$requiredRevisionMetadataKeys' property for these entity types. // Remove the '$requiredRevisionMetadataKeys' property for these entity types.
foreach ($last_installed_definitions as $entity_type_id => $entity_type) { foreach ($last_installed_definitions as $entity_type) {
$closure = function (ContentEntityTypeInterface $entity_type) { $closure = function (ContentEntityTypeInterface $entity_type) {
return get_object_vars($entity_type); return get_object_vars($entity_type);
}; };

View File

@ -161,6 +161,7 @@ class OverviewTerms extends FormBase {
$term_deltas = []; $term_deltas = [];
$tree = $this->storageController->loadTree($taxonomy_vocabulary->id(), 0, NULL, TRUE); $tree = $this->storageController->loadTree($taxonomy_vocabulary->id(), 0, NULL, TRUE);
$tree_index = 0; $tree_index = 0;
$complete_tree = NULL;
do { do {
// In case this tree is completely empty. // In case this tree is completely empty.
if (empty($tree[$tree_index])) { if (empty($tree[$tree_index])) {

View File

@ -89,7 +89,7 @@ class TermSelection extends DefaultSelection {
$total = 0; $total = 0;
$referenceable_entities = $this->getReferenceableEntities($match, $match_operator, 0); $referenceable_entities = $this->getReferenceableEntities($match, $match_operator, 0);
foreach ($referenceable_entities as $bundle => $entities) { foreach ($referenceable_entities as $entities) {
$total += count($entities); $total += count($entities);
} }
return $total; return $total;

View File

@ -28,7 +28,7 @@ class EntityReferenceTaxonomyTermRssFormatter extends EntityReferenceFormatterBa
$parent_entity = $items->getEntity(); $parent_entity = $items->getEntity();
$elements = []; $elements = [];
foreach ($this->getEntitiesToView($items, $langcode) as $delta => $entity) { foreach ($this->getEntitiesToView($items, $langcode) as $entity) {
$parent_entity->rss_elements[] = [ $parent_entity->rss_elements[] = [
'key' => 'category', 'key' => 'category',
'value' => $entity->label(), 'value' => $entity->label(),

View File

@ -21,7 +21,7 @@ class ToolbarController extends ControllerBase implements TrustedCallbackInterfa
* @return \Drupal\Core\Ajax\AjaxResponse * @return \Drupal\Core\Ajax\AjaxResponse
*/ */
public function subtreesAjax() { public function subtreesAjax() {
[$subtrees, $cacheability] = toolbar_get_rendered_subtrees(); [$subtrees] = toolbar_get_rendered_subtrees();
$response = new AjaxResponse(); $response = new AjaxResponse();
$response->addCommand(new SetSubtreesCommand($subtrees)); $response->addCommand(new SetSubtreesCommand($subtrees));

View File

@ -29,7 +29,7 @@ class ProfileFieldOptionTranslation extends ProcessPluginBase {
$list = array_map('trim', $list); $list = array_map('trim', $list);
$list = array_filter($list, 'strlen'); $list = array_filter($list, 'strlen');
if ($field_type === 'list_string') { if ($field_type === 'list_string') {
foreach ($list as $key => $value) { foreach ($list as $value) {
$allowed_values[] = ['label' => $value]; $allowed_values[] = ['label' => $value];
} }
} }

View File

@ -15,7 +15,6 @@ class RegisterForm extends AccountForm {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function form(array $form, FormStateInterface $form_state) { public function form(array $form, FormStateInterface $form_state) {
$user = $this->currentUser();
/** @var \Drupal\user\UserInterface $account */ /** @var \Drupal\user\UserInterface $account */
$account = $this->entity; $account = $this->entity;

View File

@ -246,7 +246,7 @@ class ViewsEntitySchemaSubscriber implements EntityTypeListenerInterface, EventS
$all_views = $this->entityTypeManager->getStorage('view')->loadMultiple(NULL); $all_views = $this->entityTypeManager->getStorage('view')->loadMultiple(NULL);
/** @var \Drupal\views\Entity\View $view */ /** @var \Drupal\views\Entity\View $view */
foreach ($all_views as $id => $view) { foreach ($all_views as $view) {
// First check just the base table. // First check just the base table.
if (in_array($view->get('base_table'), $tables)) { if (in_array($view->get('base_table'), $tables)) {

View File

@ -243,7 +243,7 @@ abstract class CachePluginBase extends PluginBase {
if (!empty($entity_information)) { if (!empty($entity_information)) {
// Add the list cache tags for each entity type used by this view. // Add the list cache tags for each entity type used by this view.
foreach ($entity_information as $table => $metadata) { foreach ($entity_information as $metadata) {
$tags = Cache::mergeTags($tags, \Drupal::entityTypeManager()->getDefinition($metadata['entity_type'])->getListCacheTags()); $tags = Cache::mergeTags($tags, \Drupal::entityTypeManager()->getDefinition($metadata['entity_type'])->getListCacheTags());
} }
} }

View File

@ -2520,7 +2520,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
// Check for missing relationships. // Check for missing relationships.
$relationships = array_keys($this->getHandlers('relationship')); $relationships = array_keys($this->getHandlers('relationship'));
foreach (ViewExecutable::getHandlerTypes() as $type => $handler_type_info) { foreach (ViewExecutable::getHandlerTypes() as $type => $handler_type_info) {
foreach ($this->getHandlers($type) as $handler_id => $handler) { foreach ($this->getHandlers($type) as $handler) {
if (!empty($handler->options['relationship']) && $handler->options['relationship'] != 'none' && !in_array($handler->options['relationship'], $relationships)) { if (!empty($handler->options['relationship']) && $handler->options['relationship'] != 'none' && !in_array($handler->options['relationship'], $relationships)) {
$errors[] = $this->t('The %handler_type %handler uses a relationship that has been removed.', ['%handler_type' => $handler_type_info['lstitle'], '%handler' => $handler->adminLabel()]); $errors[] = $this->t('The %handler_type %handler uses a relationship that has been removed.', ['%handler_type' => $handler_type_info['lstitle'], '%handler' => $handler->adminLabel()]);
} }

View File

@ -338,13 +338,10 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
// Replace % with %views_arg for menu autoloading and add to the // Replace % with %views_arg for menu autoloading and add to the
// page arguments so the argument actually comes through. // page arguments so the argument actually comes through.
foreach ($bits as $pos => $bit) { if (in_array('%', $bits, TRUE)) {
if ($bit == '%') {
// If a view requires any arguments we cannot create a static menu link. // If a view requires any arguments we cannot create a static menu link.
return []; return [];
} }
}
$path = implode('/', $bits); $path = implode('/', $bits);
$view_id = $this->view->storage->id(); $view_id = $this->view->storage->id();
$display_id = $this->display['id']; $display_id = $this->display['id'];

View File

@ -158,7 +158,7 @@ abstract class ExposedFormPluginBase extends PluginBase implements CacheableDepe
// Make sure the original order of sorts is preserved // Make sure the original order of sorts is preserved
// (e.g. a sticky sort is often first) // (e.g. a sticky sort is often first)
$view->query->orderby = []; $view->query->orderby = [];
foreach ($view->sort as $key => $sort) { foreach ($view->sort as $sort) {
if (!$sort->isExposed()) { if (!$sort->isExposed()) {
$sort->query(); $sort->query();
} }

View File

@ -119,7 +119,7 @@ abstract class QueryPluginBase extends PluginBase implements CacheableDependency
public function calculateDependencies() { public function calculateDependencies() {
$dependencies = []; $dependencies = [];
foreach ($this->getEntityTableInfo() as $entity_type => $info) { foreach ($this->getEntityTableInfo() as $info) {
if (!empty($info['provider'])) { if (!empty($info['provider'])) {
$dependencies['module'][] = $info['provider']; $dependencies['module'][] = $info['provider'];
} }

View File

@ -1357,7 +1357,7 @@ class Sql extends QueryPluginBase {
]; ];
} }
foreach ($entity_information as $entity_type_id => $info) { foreach ($entity_information as $info) {
$entity_type = \Drupal::entityTypeManager()->getDefinition($info['entity_type']); $entity_type = \Drupal::entityTypeManager()->getDefinition($info['entity_type']);
$base_field = !$info['revision'] ? $entity_type->getKey('id') : $entity_type->getKey('revision'); $base_field = !$info['revision'] ? $entity_type->getKey('id') : $entity_type->getKey('revision');
$this->addField($info['alias'], $base_field, '', $params); $this->addField($info['alias'], $base_field, '', $params);

View File

@ -433,7 +433,7 @@ class Table extends StylePluginBase implements CacheableDependencyInterface {
public function getCacheContexts() { public function getCacheContexts() {
$contexts = []; $contexts = [];
foreach ($this->options['info'] as $field_id => $info) { foreach ($this->options['info'] as $info) {
if (!empty($info['sortable'])) { if (!empty($info['sortable'])) {
// The rendered link needs to play well with any other query parameter // The rendered link needs to play well with any other query parameter
// used on the page, like pager and exposed filter. // used on the page, like pager and exposed filter.

View File

@ -121,7 +121,7 @@ class ViewsUIController extends ControllerBase {
foreach ($rows as &$row) { foreach ($rows as &$row) {
$views = []; $views = [];
// Link each view name to the view itself. // Link each view name to the view itself.
foreach ($row['views'] as $row_name => $view) { foreach ($row['views'] as $view) {
$views[] = Link::fromTextAndUrl($view, new Url('entity.view.edit_form', ['view' => $view]))->toString(); $views[] = Link::fromTextAndUrl($view, new Url('entity.view.edit_form', ['view' => $view]))->toString();
} }
unset($row['views']); unset($row['views']);

View File

@ -83,7 +83,7 @@ class EntityTypeInfo implements ContainerInjectionInterface {
* @see hook_entity_type_alter() * @see hook_entity_type_alter()
*/ */
public function entityTypeAlter(array &$entity_types) { public function entityTypeAlter(array &$entity_types) {
foreach ($entity_types as $entity_type_id => $entity_type) { foreach ($entity_types as $entity_type) {
// Non-default workspaces display the active revision on the canonical // Non-default workspaces display the active revision on the canonical
// route of an entity, so the latest version route is no longer needed. // route of an entity, so the latest version route is no longer needed.
$link_templates = $entity_type->get('links'); $link_templates = $entity_type->get('links');

View File

@ -34,7 +34,7 @@ class WorkspacesServiceProvider extends ServiceProviderBase {
// Ensure that there's no active workspace while running database updates by // Ensure that there's no active workspace while running database updates by
// removing the relevant tag from all workspace negotiator services. // removing the relevant tag from all workspace negotiator services.
if ($container->get('kernel') instanceof UpdateKernel) { if ($container->get('kernel') instanceof UpdateKernel) {
foreach ($container->getDefinitions() as $id => $definition) { foreach ($container->getDefinitions() as $definition) {
if ($definition->hasTag('workspace_negotiator')) { if ($definition->hasTag('workspace_negotiator')) {
$definition->clearTag('workspace_negotiator'); $definition->clearTag('workspace_negotiator');
} }

View File

@ -145,6 +145,24 @@
<rule ref="DrupalPractice.Commenting.ExpectedException"/> <rule ref="DrupalPractice.Commenting.ExpectedException"/>
<rule ref="DrupalPractice.General.ExceptionT"/> <rule ref="DrupalPractice.General.ExceptionT"/>
<rule ref="DrupalPractice.InfoFiles.NamespacedDependency"/> <rule ref="DrupalPractice.InfoFiles.NamespacedDependency"/>
<rule ref="DrupalPractice.CodeAnalysis.VariableAnalysis">
<!-- @todo exclude tests -->
<exclude-pattern>*/tests/*</exclude-pattern>
<!-- Do not run this sniff on API files or transliteration data. -->
<exclude-pattern>*.api.php</exclude-pattern>
<exclude-pattern>core/lib/Drupal/Component/Transliteration/data/*.php</exclude-pattern>
<properties>
<property name="allowUnusedFunctionParameters" value="true"/>
</properties>
</rule>
<rule ref="DrupalPractice.CodeAnalysis.VariableAnalysis.UndefinedVariable">
<!-- Setting severity to 0 to completely disable an error message in this sniff, without excluding the whole sniff -->
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#changing-the-default-severity-levels -->
<severity>0</severity>
</rule>
<rule ref="DrupalPractice.CodeAnalysis.VariableAnalysis.UndefinedUnsetVariable">
<severity>0</severity>
</rule>
<!-- Generic sniffs --> <!-- Generic sniffs -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/> <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>

View File

@ -19,7 +19,7 @@ if (PHP_SAPI !== 'cli') {
$autoloader = require __DIR__ . '/../../autoload.php'; $autoloader = require __DIR__ . '/../../autoload.php';
$request = Request::createFromGlobals(); $request = Request::createFromGlobals();
Settings::initialize(dirname(__DIR__, 2), DrupalKernel::findSitePath($request), $autoloader); Settings::initialize(dirname(__DIR__, 2), DrupalKernel::findSitePath($request), $autoloader);
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot(); DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot();
// Run the database dump command. // Run the database dump command.
$application = new DbToolsApplication(); $application = new DbToolsApplication();

View File

@ -19,7 +19,7 @@ if (PHP_SAPI !== 'cli') {
$autoloader = require __DIR__ . '/../../autoload.php'; $autoloader = require __DIR__ . '/../../autoload.php';
$request = Request::createFromGlobals(); $request = Request::createFromGlobals();
Settings::initialize(dirname(__DIR__, 2), DrupalKernel::findSitePath($request), $autoloader); Settings::initialize(dirname(__DIR__, 2), DrupalKernel::findSitePath($request), $autoloader);
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot(); DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot();
// Run the database dump command. // Run the database dump command.
$application = new DbDumpApplication(); $application = new DbDumpApplication();

View File

@ -20,7 +20,7 @@ if (PHP_SAPI !== 'cli') {
$autoloader = require __DIR__ . '/../../autoload.php'; $autoloader = require __DIR__ . '/../../autoload.php';
$request = Request::createFromGlobals(); $request = Request::createFromGlobals();
Settings::initialize(dirname(__DIR__, 2), DrupalKernel::findSitePath($request), $autoloader); Settings::initialize(dirname(__DIR__, 2), DrupalKernel::findSitePath($request), $autoloader);
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot(); DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot();
// Run the database dump command. // Run the database dump command.
$application = new GenerateProxyClassApplication(new ProxyBuilder()); $application = new GenerateProxyClassApplication(new ProxyBuilder());

View File

@ -5,6 +5,7 @@
* Lists available colors and color schemes for the Bartik theme. * Lists available colors and color schemes for the Bartik theme.
*/ */
// phpcs:ignore DrupalPractice.CodeAnalysis.VariableAnalysis.UnusedVariable
$info = [ $info = [
// Available colors and color labels used in theme. // Available colors and color labels used in theme.
'fields' => [ 'fields' => [