Problem/Motivation

Method "Symfony\Component\Validator\ConstraintValidatorInterface::validate()" might add "void" as a native return type declaration in the future. Do the same in implementation "Drupal\genpass\Plugin\Validation\Constraint\GenpassModeConstraintValidator" now to avoid errors or add an explicit @return annotation to suppress this message.

The work in the constraint is done in 2 private functions. The interface defined method is missing the void.

In Drupal 12:

------ -----------------------------------------------------------------------
Line src/Plugin/Validation/Constraint/GenpassModeConstraintValidator.php
------ -----------------------------------------------------------------------
35 Return type mixed of method
Drupal\genpass\Plugin\Validation\Constraint\GenpassModeConstraintVali
dator::validate() is not covariant with return type void of method
Symfony\Component\Validator\ConstraintValidatorInterface::validate().
🪪 method.childReturnType (non-ignorable)
------ -----------------------------------------------------------------------

Steps to reproduce

Run phpunit tests with D11.3 core.

Proposed resolution

Add void return type to the parent method.

Remaining tasks

  • ✅ File an issue
  • ➖ Addition/Change/Update/Fix
  • ➖ Testing to ensure no regression
  • ➖ Automated unit testing coverage
  • ➖ Automated functional testing coverage
  • ➖ Security
  • ➖ Code review by maintainers
  • ➖ Full testing and approval
  • ➖ Credit contributors
  • ➖ Release notes snippet
  • ❌ Release

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A

Issue fork genpass-3580790

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

elc created an issue. See original summary.

elc’s picture

Issue summary: View changes
Status: Active » Needs work

In Drupal 12 it causes a hard failure.

  • elc committed 45f9e362 on 2.2.x
    chore: #3580790 Add void return type for ConstraintValidatorInterface::...
elc’s picture

Assigned: elc » Unassigned
Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • elc committed f02db66a on 2.1.x
    chore: #3580790 Add void return type for ConstraintValidatorInterface::...
elc’s picture

Version: 2.2.x-dev » 3.0.x-dev

2.2.x branch is defunct, released in 3.0.x.
@see #3581914: Release naming - Use 3.0.x for latest release

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.