Problem/Motivation

The `context_ui` module's `buildForm()` methods in `ConditionDeleteForm` and `ReactionDeleteForm` have parameters that are implicitly nullable, which triggers PHP 8.4 deprecation warnings. PHP 8.4 requires explicit nullable type declarations (`?ClassName`) instead of relying on implicit nullability.

Steps to reproduce

1. Upgrade to PHP 8.4
2. Clear Drupal cache: `drush cache:rebuild`
3. Observe deprecation warnings:

```
PHP Deprecated: Drupal\context_ui\Form\ConditionDeleteForm::buildForm(): Implicitly marking parameter $context as nullable is deprecated, the explicit nullable type must be used instead in /web/modules/contrib/context/modules/context_ui/src/Form/ConditionDeleteForm.php on line 92

PHP Deprecated: Drupal\context_ui\Form\ReactionDeleteForm::buildForm(): Implicitly marking parameter $context as nullable is deprecated, the explicit nullable type must be used instead in /web/modules/contrib/context/modules/context_ui/src/Form/ReactionDeleteForm.php on line 95
```

Proposed resolution

Add explicit nullable type declarations to the `$context` parameter in both methods:

**ConditionDeleteForm.php line 92:**
```php
public function buildForm(array $form, FormStateInterface $form_state, ?ContextInterface $context = NULL): array {
```

**ReactionDeleteForm.php line 95:**
```php
public function buildForm(array $form, FormStateInterface $form_state, ?ContextInterface $context = NULL): array {
```

Issue fork context-3609880

Command icon 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

tormi created an issue. See original summary.

tormi’s picture

Status: Active » Needs review

NR