### Problem
`ShortcodeService` triggers PHP deprecation notices on PHP 8.4 because several `FilterInterface` parameters default to `NULL` without being explicitly nullable.
### Steps to Reproduce
1. Install Shortcode 2.0.3 on Drupal 11.
2. Run the site with PHP 8.4 or newer and deprecation notices enabled.
3. Process text through a text format/filter that uses Shortcode.
### Actual Result
The following deprecation notices are emitted:
Deprecated: Drupal\shortcode\ShortcodeService::getShortcodePlugins(): Implicitly marking parameter $filter as nullable is deprecated, the explicit nullable type must be used instead in modules/contrib/shortcode/src/ShortcodeService.php on line 89 Deprecated: Drupal\shortcode\ShortcodeService::process(): Implicitly marking parameter $filter as nullable is deprecated, the explicit nullable type must be used instead in modules/contrib/shortcode/src/ShortcodeService.php on line 215 Deprecated: Drupal\shortcode\ShortcodeService::postprocessText(): Implicitly marking parameter $filter as nullable is deprecated, the explicit nullable type must be used instead in modules/contrib/shortcode/src/ShortcodeService.php on line 360
### Expected Result
No PHP deprecation notices should be emitted on PHP 8.4.
### Proposed Fix
Change the affected method signatures to use explicit nullable types:
public function getShortcodePlugins(?FilterInterface $filter = NULL, bool $reset = FALSE): arraypublic function process($text, string $langcode = Language::LANGCODE_NOT_SPECIFIED, ?FilterInterface $filter = NULL): stringpublic function postprocessText($text, string $langcode, ?FilterInterface $filter = NULL): string### Notes
This is a PHP 8.4 compatibility issue. The change is type-compatible with the existing default `NULL` behavior.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3605865-php-8.4-deprecations.patch | 1.44 KB | mikell |
Issue fork shortcode-3605865
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mikell commentedPushed code to branch, ready for review. Added patch file.
Comment #4
mikell commented