From 82933b5d6958193780c6ba1a96a167fc726f742d Mon Sep 17 00:00:00 2001
From: Girish <girish.guntaka@gmail.com>
Date: Thu, 20 Mar 2025 10:21:14 +0000
Subject: [PATCH] Issue #3514294: Fix issues reported by PHPCS

---
 shortcode_basic_tags/templates/shortcode-button.html.twig  | 2 +-
 shortcode_basic_tags/templates/shortcode-clear.html.twig   | 2 +-
 shortcode_basic_tags/templates/shortcode-dropcap.html.twig | 2 +-
 shortcode_basic_tags/templates/shortcode-img.html.twig     | 2 +-
 shortcode_basic_tags/templates/shortcode-item.html.twig    | 2 +-
 shortcode_basic_tags/templates/shortcode-link.html.twig    | 2 +-
 shortcode_basic_tags/templates/shortcode-quote.html.twig   | 2 +-
 src/ShortcodeService.php                                   | 6 +++---
 8 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/shortcode_basic_tags/templates/shortcode-button.html.twig b/shortcode_basic_tags/templates/shortcode-button.html.twig
index 907d9e6..1aaf8a5 100644
--- a/shortcode_basic_tags/templates/shortcode-button.html.twig
+++ b/shortcode_basic_tags/templates/shortcode-button.html.twig
@@ -9,4 +9,4 @@
  * - text: The button label.
  */
 #}
-<a{{ attributes }}><span>{{ text }}</span></a>
\ No newline at end of file
+<a{{ attributes }}><span>{{ text }}</span></a>
diff --git a/shortcode_basic_tags/templates/shortcode-clear.html.twig b/shortcode_basic_tags/templates/shortcode-clear.html.twig
index 9639b8f..9eaca14 100644
--- a/shortcode_basic_tags/templates/shortcode-clear.html.twig
+++ b/shortcode_basic_tags/templates/shortcode-clear.html.twig
@@ -9,4 +9,4 @@
  * - text: The content.
  */
 #}
-<{{ type }}{{ attributes }}>{{ text | raw }}</{{ type }}>
\ No newline at end of file
+<{{ type }}{{ attributes }}>{{ text | raw }}</{{ type }}>
diff --git a/shortcode_basic_tags/templates/shortcode-dropcap.html.twig b/shortcode_basic_tags/templates/shortcode-dropcap.html.twig
index 672d0f7..0dd582a 100644
--- a/shortcode_basic_tags/templates/shortcode-dropcap.html.twig
+++ b/shortcode_basic_tags/templates/shortcode-dropcap.html.twig
@@ -8,4 +8,4 @@
  * - text: The quoted text.
  */
 #}
-<span class="{{ class }}">{{ text }}</span>
\ No newline at end of file
+<span class="{{ class }}">{{ text }}</span>
diff --git a/shortcode_basic_tags/templates/shortcode-img.html.twig b/shortcode_basic_tags/templates/shortcode-img.html.twig
index a3cb459..c07ee06 100644
--- a/shortcode_basic_tags/templates/shortcode-img.html.twig
+++ b/shortcode_basic_tags/templates/shortcode-img.html.twig
@@ -9,4 +9,4 @@
  * - alt: The alt text.
  */
 #}
-<img src="{{ src }}" class="{{ class }}" alt="{{ alt }}">
\ No newline at end of file
+<img src="{{ src }}" class="{{ class }}" alt="{{ alt }}">
diff --git a/shortcode_basic_tags/templates/shortcode-item.html.twig b/shortcode_basic_tags/templates/shortcode-item.html.twig
index 5d9c98b..2076dbb 100644
--- a/shortcode_basic_tags/templates/shortcode-item.html.twig
+++ b/shortcode_basic_tags/templates/shortcode-item.html.twig
@@ -9,4 +9,4 @@
  * - text: The content.
  */
 #}
-<{{ type }}{{ attributes }}>{{ text | raw  }}</{{ type }}>
\ No newline at end of file
+<{{ type }}{{ attributes }}>{{ text | raw  }}</{{ type }}>
diff --git a/shortcode_basic_tags/templates/shortcode-link.html.twig b/shortcode_basic_tags/templates/shortcode-link.html.twig
index f744799..07ae180 100644
--- a/shortcode_basic_tags/templates/shortcode-link.html.twig
+++ b/shortcode_basic_tags/templates/shortcode-link.html.twig
@@ -9,4 +9,4 @@
  * - text: The link label.
  */
 #}
-<a{{ attributes }}>{{ text }}</a>
\ No newline at end of file
+<a{{ attributes }}>{{ text }}</a>
diff --git a/shortcode_basic_tags/templates/shortcode-quote.html.twig b/shortcode_basic_tags/templates/shortcode-quote.html.twig
index 62f321e..167d85d 100644
--- a/shortcode_basic_tags/templates/shortcode-quote.html.twig
+++ b/shortcode_basic_tags/templates/shortcode-quote.html.twig
@@ -15,4 +15,4 @@
     <span class="quote-author">{{ author | trans }} wrote: </span>
   {% endif %}
   {{ text | raw }}
-</span>
\ No newline at end of file
+</span>
diff --git a/src/ShortcodeService.php b/src/ShortcodeService.php
index bdeda4c..786601c 100644
--- a/src/ShortcodeService.php
+++ b/src/ShortcodeService.php
@@ -86,7 +86,7 @@ class ShortcodeService {
    * @return array
    *   Array of shortcode plugin definitions, keyed by token, not id.
    */
-  public function getShortcodePlugins(FilterInterface $filter = NULL, bool $reset = FALSE): array {
+  public function getShortcodePlugins(?FilterInterface $filter = NULL, bool $reset = FALSE): array {
     $shortcodes = &drupal_static(__FUNCTION__);
 
     // Prime plugin cache.
@@ -212,7 +212,7 @@ class ShortcodeService {
    * @return string
    *   The processed string.
    */
-  public function process($text, string $langcode = Language::LANGCODE_NOT_SPECIFIED, FilterInterface $filter = NULL): string {
+  public function process($text, string $langcode = Language::LANGCODE_NOT_SPECIFIED, ?FilterInterface $filter = NULL): string {
     $shortcodes = $this->getShortcodePlugins($filter);
 
     // Processing recursively, now embedding tags within other tags is
@@ -357,7 +357,7 @@ class ShortcodeService {
    * @return string
    *   The processed string.
    */
-  public function postprocessText($text, string $langcode, FilterInterface $filter = NULL): string {
+  public function postprocessText($text, string $langcode, ?FilterInterface $filter = NULL): string {
 
     // preg_match_all('/<p>s.*<!--.*-->.*<div/isU', $text, $r);
     // dpm($r, '$r');
-- 
GitLab