From 65df4602727de9ff1f355878535cfc4b54bfda4b Mon Sep 17 00:00:00 2001 From: Joel Steidl <20417-joelsteidl@users.noreply.drupalcode.org> Date: Wed, 26 Feb 2025 21:42:05 +0000 Subject: [PATCH] Issue #3451400: Automated Drupal 11 compatibility fixes for webform_javascript_setting --- .cspell-project-words.txt | 6 ++++ .gitlab-ci.yml | 29 +++++++++++++++++++ composer.json | 4 +-- phpstan.neon | 11 +++++++ src/Element/WebformJavaScriptSetting.php | 2 +- .../webform_javascript_setting_test.info.yml | 2 +- ...WebformJavaScriptSettingJavaScriptTest.php | 4 +-- webform_javascript_setting.info.yml | 2 +- webform_javascript_setting.module | 4 +-- 9 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 .cspell-project-words.txt create mode 100644 .gitlab-ci.yml create mode 100644 phpstan.neon diff --git a/.cspell-project-words.txt b/.cspell-project-words.txt new file mode 100644 index 0000000..d6d8b38 --- /dev/null +++ b/.cspell-project-words.txt @@ -0,0 +1,6 @@ +acquia +Acquia +perz +ptid +webform +Webform diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..af218c1 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,29 @@ +################ +# GitLabCI template for Drupal projects. +# +# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. +# It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained. +# As long as you include the project, ref and three files below, any future updates added by the Drupal Association will be used in your +# pipelines automatically. However, you can modify this template if you have additional needs for your project. +# The full documentation is on https://project.pages.drupalcode.org/gitlab_templates/ +################ + +# For information on alternative values for 'ref' see https://project.pages.drupalcode.org/gitlab_templates/info/templates-version/ +# To test a Drupal 7 project, change the first include filename from .main.yml to .main-d7.yml +include: + - project: $_GITLAB_TEMPLATES_REPO + ref: $_GITLAB_TEMPLATES_REF + file: + - '/includes/include.drupalci.main.yml' + - '/includes/include.drupalci.variables.yml' + - '/includes/include.drupalci.workflows.yml' +# +################ +# Pipeline configuration variables are defined with default values and descriptions in the file +# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml +# Uncomment the lines below if you want to override any of the variables. The following is just an example. +################ +variables: + OPT_IN_TEST_CURRENT: '1' + OPT_IN_TEST_PREVIOUS_MAJOR: '1' + SKIP_ESLINT: '1' diff --git a/composer.json b/composer.json index d4e3af8..4ec0eef 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "source": "https://git.drupalcode.org/project/webform_javascript_setting" }, "require": { - "drupal/core": "^9.4 || ^10", - "drupal/webform": "^6.2" + "drupal/webform": "^6.2", + "drupal/core": "^9.4 || ^10 || ^11" } } diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..a6b23f2 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,11 @@ +includes: + - phar://phpstan.phar/conf/bleedingEdge.neon + +parameters: + level: 5 + paths: + - . + reportUnmatchedIgnoredErrors: false + ignoreErrors: + # Required static call in /src/Plugin/WebformElement/WebformJavaScriptSetting.php + - "#Drupal calls should be avoided in classes, use dependency injection instead#" diff --git a/src/Element/WebformJavaScriptSetting.php b/src/Element/WebformJavaScriptSetting.php index b450e9a..6ea4aad 100644 --- a/src/Element/WebformJavaScriptSetting.php +++ b/src/Element/WebformJavaScriptSetting.php @@ -5,7 +5,7 @@ namespace Drupal\webform_javascript_setting\Element; use Drupal\Core\Render\Element\Hidden; /** - * Provides a webform element that stores a JavaScript setting in a hidden input. + * Adds a Webform element to store a JavaScript setting in a hidden input. * * @FormElement("webform_javascript_setting") */ diff --git a/tests/modules/webform_javascript_setting_test/webform_javascript_setting_test.info.yml b/tests/modules/webform_javascript_setting_test/webform_javascript_setting_test.info.yml index fd2415c..3f5dd21 100644 --- a/tests/modules/webform_javascript_setting_test/webform_javascript_setting_test.info.yml +++ b/tests/modules/webform_javascript_setting_test/webform_javascript_setting_test.info.yml @@ -2,6 +2,6 @@ name: 'Webform JavaScript Settings Element test' type: module description: 'Support module for Webform JavaScript Settings Element testing.' package: 'Webform Testing' -core_version_requirement: ^9.4 +core_version_requirement: ^9.4 || ^10.1 || ^11 dependencies: - 'webform_javascript_setting:webform_javascript_setting' diff --git a/tests/src/FunctionalJavascript/WebformJavaScriptSettingJavaScriptTest.php b/tests/src/FunctionalJavascript/WebformJavaScriptSettingJavaScriptTest.php index 2593b6e..073a6ac 100644 --- a/tests/src/FunctionalJavascript/WebformJavaScriptSettingJavaScriptTest.php +++ b/tests/src/FunctionalJavascript/WebformJavaScriptSettingJavaScriptTest.php @@ -1,6 +1,6 @@ <?php -declare(strict_types = 1); +declare(strict_types=1); namespace Drupal\Tests\webform_setting_javascript\FunctionalJavascript; @@ -23,7 +23,7 @@ class WebformJavaScriptSettingJavaScriptTest extends WebDriverTestBase { /** * Modules to enable. * - * @var array + * @var array<string> */ protected static $modules = ['webform_javascript_setting_test']; diff --git a/webform_javascript_setting.info.yml b/webform_javascript_setting.info.yml index 4976b5b..f5c0341 100644 --- a/webform_javascript_setting.info.yml +++ b/webform_javascript_setting.info.yml @@ -2,6 +2,6 @@ name: 'Webform JavaScript Setting Element' description: 'Provides a webform element that pulls a JavaScript object''s setting/property into a hidden field.' package: Webform type: module -core_version_requirement: ^9.4 || ^10 +core_version_requirement: ^9.4 || ^10 || ^11 dependencies: - webform:webform diff --git a/webform_javascript_setting.module b/webform_javascript_setting.module index 1d2b771..cfe5dbe 100644 --- a/webform_javascript_setting.module +++ b/webform_javascript_setting.module @@ -2,10 +2,10 @@ /** * @file - * Provides an element that pulls a JavaScript object''s setting into a hidden field. + * Adds a Webform element to store a JavaScript setting in a hidden input. */ -declare(strict_types = 1); +declare(strict_types=1); use Drupal\Core\Form\FormStateInterface; -- GitLab