only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php +++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php @@ -181,7 +181,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta '#required' => TRUE, '#size' => 6, '#multiple' => TRUE, - '#element_validate' => [[static::class, 'elementValidateFilter']], + '#element_validate' => static::elementValidateFilter(...), '#ajax' => TRUE, '#limit_validation_errors' => [], ]; only in patch2: unchanged: --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php @@ -417,8 +417,8 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { $form = [ '#type' => 'container', - '#process' => [[static::class, 'fieldSettingsAjaxProcess']], - '#element_validate' => [[static::class, 'fieldSettingsFormValidate']], + '#process' => [static::fieldSettingsAjaxProcess(...)], + '#element_validate' => [static::fieldSettingsFormValidate(...)], ]; $form['handler'] = [ @@ -426,7 +426,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('Reference type'), '#open' => TRUE, '#tree' => TRUE, - '#process' => [[static::class, 'formProcessMergeParent']], + '#process' => [static::formProcessMergeParent(...)], ]; $form['handler']['handler'] = [ @@ -445,7 +445,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#attributes' => [ 'class' => ['js-hide'], ], - '#submit' => [[static::class, 'settingsAjaxSubmit']], + '#submit' => [static::formProcessMergeParent(...)], ]; $form['handler']['handler_settings'] = [ @@ -665,7 +665,7 @@ public static function fieldSettingsAjaxProcess($form, FormStateInterface $form_ public static function fieldSettingsAjaxProcessElement(&$element, $main_form) { if (!empty($element['#ajax'])) { $element['#ajax'] = [ - 'callback' => [static::class, 'settingsAjax'], + 'callback' => static::settingsAjax(...), 'wrapper' => $main_form['#id'], 'element' => $main_form['#array_parents'], ]; only in patch2: unchanged: --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php @@ -72,7 +72,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $this->has_value = isset($items[0]->{$this->column}); // Add our custom validator. - $element['#element_validate'][] = [static::class, 'validateElement']; + $element['#element_validate'][] = static::validateElement(...); $element['#key_column'] = $this->column; // The rest of the $element is built by child method implementations. only in patch2: unchanged: --- a/core/lib/Drupal/Core/Field/WidgetBase.php +++ b/core/lib/Drupal/Core/Field/WidgetBase.php @@ -123,7 +123,7 @@ public function form(FieldItemListInterface $items, array &$form, FormStateInter // Populate the 'array_parents' information in $form_state->get('field') // after the form is built, so that we catch changes in the form structure // performed in alter() hooks. - $elements['#after_build'][] = [static::class, 'afterBuild']; + $elements['#after_build'][] = static::afterBuild(...); $elements['#field_name'] = $field_name; $elements['#field_parents'] = $parents; // Enforce the structure of submitted values. @@ -260,9 +260,9 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f '#value' => t('Add another item'), '#attributes' => ['class' => ['field-add-more-submit']], '#limit_validation_errors' => [array_merge($parents, [$field_name])], - '#submit' => [[static::class, 'addMoreSubmit']], + '#submit' => [static::addMoreSubmit(...)], '#ajax' => [ - 'callback' => [static::class, 'addMoreAjax'], + 'callback' => static::addMoreAjax(...), 'wrapper' => $wrapper_id, 'effect' => 'fade', ], only in patch2: unchanged: --- a/core/lib/Drupal/Core/Mail/MailFormatHelper.php +++ b/core/lib/Drupal/Core/Mail/MailFormatHelper.php @@ -125,7 +125,7 @@ public static function htmlToText($string, $allowed_tags = NULL) { // 'See the Drupal site [1]' with the URL included as a footnote. static::htmlToMailUrls(NULL, TRUE); $pattern = '@(]+?href="([^"]*)"[^>]*?>(.+?))@i'; - $string = preg_replace_callback($pattern, [static::class, 'htmlToMailUrls'], $string); + $string = preg_replace_callback($pattern, static::htmlToMailUrls(...), $string); $urls = static::htmlToMailUrls(); $footnotes = ''; if (count($urls)) { only in patch2: unchanged: --- a/core/lib/Drupal/Core/Render/Element/FormElement.php +++ b/core/lib/Drupal/Core/Render/Element/FormElement.php @@ -119,7 +119,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form public static function processPattern(&$element, FormStateInterface $form_state, &$complete_form) { if (isset($element['#pattern']) && !isset($element['#attributes']['pattern'])) { $element['#attributes']['pattern'] = $element['#pattern']; - $element['#element_validate'][] = [static::class, 'validatePattern']; + $element['#element_validate'][] = static::validatePattern(...); } return $element; only in patch2: unchanged: --- a/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php +++ b/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php @@ -90,7 +90,7 @@ public static function processPasswordConfirm(&$element, FormStateInterface $for ], '#error_no_message' => TRUE, ]; - $element['#element_validate'] = [[static::class, 'validatePasswordConfirm']]; + $element['#element_validate'] = [static::validatePasswordConfirm(...)]; $element['#tree'] = TRUE; if (isset($element['#size'])) { only in patch2: unchanged: --- a/core/modules/config/tests/config_test/src/ConfigTestForm.php +++ b/core/modules/config/tests/config_test/src/ConfigTestForm.php @@ -83,7 +83,7 @@ public function form(array $form, FormStateInterface $form_state) { '#attributes' => [ 'class' => ['js-hide'], ], - '#submit' => [[static::class, 'changeSize']], + '#submit' => [static::changeSize(...)], ]; $form['size_wrapper']['size_value'] = [ '#type' => 'select', only in patch2: unchanged: --- a/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php +++ b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php @@ -175,7 +175,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen ], ], ]; - $element['#element_validate'][] = [static::class, 'validateElement']; + $element['#element_validate'][] = static::validateElement(...); return $element; } only in patch2: unchanged: --- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php +++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php @@ -68,7 +68,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $element += [ '#type' => 'textfield', '#default_value' => implode(', ', $values), - '#element_validate' => [[static::class, 'multipleValidate']], + '#element_validate' => [static::multipleValidate], ]; return $element; } only in patch2: unchanged: --- a/core/modules/file/src/Element/ManagedFile.php +++ b/core/modules/file/src/Element/ManagedFile.php @@ -227,7 +227,7 @@ public static function processManagedFile(&$element, FormStateInterface $form_st $ajax_wrapper_id = Html::getUniqueId('ajax-wrapper'); $ajax_settings = [ - 'callback' => [static::class, 'uploadAjaxCallback'], + 'callback' => static::uploadAjaxCallback(...), 'options' => [ 'query' => [ 'element_parents' => implode('/', $element['#array_parents']), only in patch2: unchanged: --- a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php +++ b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php @@ -157,7 +157,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('File directory'), '#default_value' => $settings['file_directory'], '#description' => $this->t('Optional subdirectory within the upload destination where files will be stored. Do not include preceding or trailing slashes.'), - '#element_validate' => [[static::class, 'validateDirectory']], + '#element_validate' => [static::validateDirectory(...)], '#weight' => 3, ]; @@ -168,7 +168,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('Allowed file extensions'), '#default_value' => $extensions, '#description' => $this->t("Separate extensions with a comma or space. Each extension can contain alphanumeric characters, '.', and '_', and should start and end with an alphanumeric character."), - '#element_validate' => [[static::class, 'validateExtensions']], + '#element_validate' => [static::validateExtensions(...)], '#weight' => 1, '#maxlength' => 256, // By making this field required, we prevent a potential security issue @@ -182,7 +182,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#default_value' => $settings['max_filesize'], '#description' => $this->t('Enter a value like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes) in order to restrict the allowed file size. If left empty the file sizes could be limited only by PHP\'s maximum post and file upload sizes (current limit %limit).', ['%limit' => format_size(Environment::getUploadMaxSize())]), '#size' => 10, - '#element_validate' => [[static::class, 'validateMaxFilesize']], + '#element_validate' => [static::validateMaxFilesize(...)], '#weight' => 5, ]; only in patch2: unchanged: --- a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php +++ b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php @@ -179,7 +179,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f $elements['#open'] = TRUE; $elements['#theme'] = 'file_widget_multiple'; $elements['#theme_wrappers'] = ['details']; - $elements['#process'] = [[static::class, 'processMultiple']]; + $elements['#process'] = [static::processMultiple(...)]; $elements['#title'] = $title; $elements['#description'] = $description; @@ -235,8 +235,8 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen '#type' => 'managed_file', '#upload_location' => $items[$delta]->getUploadLocation(), '#upload_validators' => $items[$delta]->getUploadValidators(), - '#value_callback' => [static::class, 'value'], - '#process' => array_merge($element_info['#process'], [[static::class, 'process']]), + '#value_callback' => static::value(...), + '#process' => array_merge($element_info['#process'], [static::process(...)]), '#progress_indicator' => $this->getSetting('progress_indicator'), // Allows this field to return an array instead of a single value. '#extended' => TRUE, @@ -269,7 +269,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $element['#description'] = \Drupal::service('renderer')->renderPlain($file_upload_help); $element['#multiple'] = $cardinality != 1 ? TRUE : FALSE; if ($cardinality != 1 && $cardinality != -1) { - $element['#element_validate'] = [[static::class, 'validateMultipleCount']]; + $element['#element_validate'] = [static::validateMultipleCount(...)]; } } @@ -446,7 +446,7 @@ public static function process($element, FormStateInterface $form_state, $form) // the rebuild logic in file_field_widget_form() requires the entire field, // not just the individual item, to be valid. foreach (['upload_button', 'remove_button'] as $key) { - $element[$key]['#submit'][] = [static::class, 'submit']; + $element[$key]['#submit'][] = static::submit(...); $element[$key]['#limit_validation_errors'] = [array_slice($element['#parents'], 0, -1)]; } only in patch2: unchanged: --- a/core/modules/filter/src/Element/TextFormat.php +++ b/core/modules/filter/src/Element/TextFormat.php @@ -240,7 +240,7 @@ public static function processFormat(&$element, FormStateInterface $form_state, // Prepend #pre_render callback to replace field value with user notice // prior to rendering. $element['value'] += ['#pre_render' => []]; - array_unshift($element['value']['#pre_render'], [static::class, 'accessDeniedCallback']); + array_unshift($element['value']['#pre_render'], static::accessDeniedCallback(...)); // Cosmetic adjustments. if (isset($element['value']['#rows'])) { only in patch2: unchanged: --- a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php +++ b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php @@ -201,7 +201,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { $element['max_resolution'] = [ '#type' => 'item', '#title' => $this->t('Maximum image resolution'), - '#element_validate' => [[static::class, 'validateResolution']], + '#element_validate' => [static::validateResolution(...)], '#weight' => 4.1, '#description' => $this->t('The maximum allowed image size expressed as WIDTH×HEIGHT (e.g. 640×480). Leave blank for no restriction. If a larger image is uploaded, it will be resized to reflect the given width and height. Resizing images on upload will cause the loss of EXIF data in the image.'), ]; @@ -228,7 +228,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { $element['min_resolution'] = [ '#type' => 'item', '#title' => $this->t('Minimum image resolution'), - '#element_validate' => [[static::class, 'validateResolution']], + '#element_validate' => [static::validateResolution(...)], '#weight' => 4.2, '#description' => $this->t('The minimum allowed image size expressed as WIDTH×HEIGHT (e.g. 640×480). Leave blank for no restriction. If a smaller image is uploaded, it will be rejected.'), ]; @@ -430,7 +430,7 @@ protected function defaultImageForm(array &$element, array $settings) { '#upload_location' => $settings['uri_scheme'] . '://default_images/', '#element_validate' => [ '\Drupal\file\Element\ManagedFile::validateManagedFile', - [static::class, 'validateDefaultImageForm'], + static::validateDefaultImageForm(...), ], '#upload_validators' => $this->getUploadValidators(), ];