Skip to content

Commit c62b313

Browse files
authored
fix: static analysis errors (#89)
* fix: static analysis errors * fix: coding standards * fix: static analysis errors * fix: static analysis errors * fix: static analysis errors * fix: coding standards * fix: coding standards * fix: static analysis errors
1 parent 51c7307 commit c62b313

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

localgov_forms.tokens.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
declare(strict_types=1);
99

10+
use Drupal\Core\Datetime\Entity\DateFormat;
1011
use Drupal\Core\Render\BubbleableMetadata;
1112
use Drupal\webform\Utility\WebformDateHelper;
1213

modules/localgov_forms_example_liberty_create_integration/localgov_forms_example_liberty_create_integration.module

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use Drupal\webform\WebformSubmissionInterface;
2222
*/
2323
function localgov_forms_example_liberty_create_integration_modules_installed($modules, $is_syncing) {
2424

25-
if (!$is_syncing && in_array('token_environment', $modules)) {
25+
if (!$is_syncing && in_array('token_environment', $modules, TRUE)) {
2626
$token_env_config = Drupal::service('config.factory')->getEditable('token_environment.settings');
2727
$allowed_env_vars = $token_env_config->get('allowed_env_variables') ?? [];
2828
$allowed_env_vars[] = 'DRUPAL_LIBERTY_CREATE_API_AUTH_KEY';
@@ -124,7 +124,7 @@ function localgov_forms_example_liberty_create_integration_webform_handler_invok
124124
function _localgov_forms_example_liberty_create_integration_manage_remote_post_custom_data(WebformHandlerInterface $handler) {
125125

126126
$webform_submission = $handler->getWebformSubmission();
127-
if (empty($webform_submission)) {
127+
if (!$webform_submission instanceof WebformSubmissionInterface) {
128128
return;
129129
}
130130

src/AddressLookup.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,18 @@ public static function reformat(Location $addr) :array {
102102
}
103103

104104
$address = [
105-
'name' => $unique_id ?? '',
106-
'uprn' => $uprn ?? '',
107-
'display' => $display_name ?? '',
105+
'name' => $unique_id,
106+
'uprn' => $uprn,
107+
'display' => $display_name,
108108
'street' => implode(' ', array_filter([
109109
$street_number, $street_name,
110110
])),
111-
'flat' => $flat ?? '',
111+
'flat' => $flat,
112112
'house' => implode(', ', array_filter([$org, $house_name])),
113113
'town' => $locality ?? '',
114114
'postcode' => $postcode ?? '',
115-
'lat' => $latitude ?? '',
116-
'lng' => $longitude ?? '',
115+
'lat' => $latitude ?: '',
116+
'lng' => $longitude ?: '',
117117
'country' => $country_name ?? '',
118118
'country_code' => $country_code ?? '',
119119
'line1' => '',

src/Element/AddressLookupElement.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public static function processAddressLookupElement(&$element, FormStateInterface
198198
$element['address_select']['address_select_list']['#disabled'] = FALSE;
199199
$options = array_keys($element['address_select']['address_select_list']['#options']);
200200
$selected = $parent_container_values['address_select']['address_select_list'] ?? 0;
201-
if (!in_array($selected, $options)) {
201+
if (!in_array($selected, $options, TRUE)) {
202202
$element['address_select']['address_select_list']['#value'] = NULL;
203203
}
204204
}
@@ -267,6 +267,13 @@ public static function valueCallback(&$element, $input, FormStateInterface $form
267267
if (empty($input['address_search']['address_searchstring'])) {
268268
return NULL;
269269
}
270+
271+
// FIXME: Call to method valueCallback() of deprecated class
272+
// Drupal\Core\Render\Element\FormElement: in drupal:10.3.0 and
273+
// is removed from drupal:12.0.0.
274+
// use \Drupal\Core\Render\Element\FormElementBase instead.
275+
// @phpstan-ignore-next-line
276+
return parent::valueCallback($element, $input, $form_state);
270277
}
271278

272279
/**

0 commit comments

Comments
 (0)