From 8a577b165fff4a80e01e508c70ea362d0ce79e50 Mon Sep 17 00:00:00 2001 From: sylus Date: Wed, 1 Nov 2023 23:22:12 -0400 Subject: [PATCH] feat(phpcs): Correct all phpcs issues --- .../custom/wxt_core/src/CountriesManager.php | 24 ++++++++----------- modules/custom/wxt_core/wxt_core.install | 4 ++-- .../wxt_ext_webform/wxt_ext_webform.module | 10 ++++---- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/modules/custom/wxt_core/src/CountriesManager.php b/modules/custom/wxt_core/src/CountriesManager.php index 08eda314..ac605a34 100644 --- a/modules/custom/wxt_core/src/CountriesManager.php +++ b/modules/custom/wxt_core/src/CountriesManager.php @@ -9,7 +9,7 @@ use Drupal\Core\Locale\CountryManagerInterface; /** - * + * Countries Manager. */ class CountriesManager { /** @@ -41,20 +41,16 @@ class CountriesManager { protected $moduleHandler; /** - * UpdateCommand constructor. + * CountriesManager constructor. * - * @param \Traversable $namespaces - * The namespaces to scan for updates. - * @param \Drupal\Core\DependencyInjection\ClassResolverInterface $class_resolver - * The class resolver service. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory service. * @param \Drupal\Core\Extension\ModuleExtensionList $module_extension_list * The module extension list. - * @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface $discovery - * (optional) The update discovery handler. - * @param \phpDocumentor\Reflection\DocBlockFactoryInterface $doc_block_factory - * (optional) The doc block factory. + * @param \Drupal\Core\Locale\CountryManagerInterface $country_manager + * The module handler + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler */ public function __construct(ConfigFactoryInterface $config_factory, ModuleExtensionList $module_extension_list, CountryManagerInterface $country_manager, ModuleHandlerInterface $module_handler) { $this->configFactory = $config_factory; @@ -64,7 +60,7 @@ public function __construct(ConfigFactoryInterface $config_factory, ModuleExtens } /** - * Get all data (from yml) expect for this issue[#3111375] from original online PDF. + * Get all data (from yml) expect for this issue[#3111375] from original online PDF. */ public function getCountryData($column = 'Alpha-2', $row = 'Code') { $module_path = $this->moduleHandler->getModule('wxt_core')->getPath(); @@ -74,7 +70,7 @@ public function getCountryData($column = 'Alpha-2', $row = 'Code') { } $country_names = []; - foreach ($country_data as $key => $data) { + foreach ($country_data as $data) { $country_names[$data[$column]] = $data[$row]; } return $country_names; @@ -114,10 +110,10 @@ public function whitelistedOptions() { public function whitelistedOptionsSorted() { $config = $this->configFactory->get('wxt_core_countries.settings'); $whitelist = $this->whitelistedOptions(); - switch ($config->get('whitelist-sort')){ + switch ($config->get('whitelist-sort')) { case 'alpha': \ksort($whitelist); - break; + break; } return $whitelist; } diff --git a/modules/custom/wxt_core/wxt_core.install b/modules/custom/wxt_core/wxt_core.install index 3cb5befb..8c919c32 100644 --- a/modules/custom/wxt_core/wxt_core.install +++ b/modules/custom/wxt_core/wxt_core.install @@ -672,13 +672,13 @@ function wxt_core_update_8500() { } /** - * Setup CountryManager lists [#3111375] + * Setup CountryManager lists [#3111375]. */ function wxt_core_update_8501() { $config_namespace = 'wxt_core_countries.settings'; $module_handler = \Drupal::service('module_handler'); $module_path = $module_handler->getModule('wxt_core')->getPath(); - $path = DRUPAL_ROOT . '/' . $module_path . '/config/install/'. $config_namespace . '.yml'; + $path = DRUPAL_ROOT . '/' . $module_path . '/config/install/' . $config_namespace . '.yml'; $country_data = Yaml::parse(\file_get_contents($path)); // Get the configuration factory service. diff --git a/modules/custom/wxt_ext/wxt_ext_webform/wxt_ext_webform.module b/modules/custom/wxt_ext/wxt_ext_webform/wxt_ext_webform.module index dc6c9585..21d9f50c 100644 --- a/modules/custom/wxt_ext/wxt_ext_webform/wxt_ext_webform.module +++ b/modules/custom/wxt_ext/wxt_ext_webform/wxt_ext_webform.module @@ -126,22 +126,22 @@ function _gcweb_did_you_find_form_ajax_submit($form, $form_state) { */ function wxt_ext_webform_webform_options_country_names_alter(array &$options, array $element = []) { $config = \Drupal::configFactory()->get('wxt_core_countries.settings'); - if ($config->get('webform-override')==1){ + if ($config->get('webform-override') == 1) { $countryManager = \Drupal::service('wxt.country_whitelist'); $options = $countryManager->whitelistedOptionsSorted(); } } /** - * Implements hook_form_BASE_FORM_ID_form_alter() WXT Country related additions. + * Implements hook_form_BASE_FORM_ID_form_alter() for WXT Country related additions. */ -function wxt_ext_webform_form_wxt_core_countries_settings_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { +function wxt_ext_webform_form_wxt_core_countries_settings_form_alter(&$form, FormStateInterface $form_state, $form_id) { $form['webform-box'] = [ '#weight' => -1, '#type' => 'fieldset', '#title' => t('WxT Extend Webform'), ]; - $link = Link::createFromRoute(t('Webform Country Name Options'),'entity.webform_options.edit_form', ['webform_options'=>'country_names']); + $link = Link::createFromRoute(t('Webform Country Name Options'), 'entity.webform_options.edit_form', ['webform_options' => 'country_names']); $form['webform-box']['webform-override'] = [ '#type' => 'checkbox', '#title' => t('Override Webform Options for Country Names'), @@ -154,7 +154,7 @@ function wxt_ext_webform_form_wxt_core_countries_settings_form_alter(&$form, \Dr /** * Process new field added to form. */ -function wxt_ext_webform_form_wxt_core_countries_submit(&$form, \Drupal\Core\Form\FormStateInterface $form_state) { +function wxt_ext_webform_form_wxt_core_countries_submit(&$form, FormStateInterface $form_state) { \Drupal::configFactory() ->getEditable('wxt_core_countries.settings') ->set('webform-override', $form_state->getValue('webform-override'))