Incorrect documentation / return value for WebformElementInterface::hasMultipleValues()

Created on 6 February 2025, about 1 month ago

Problem/Motivation

The documentation for WebformElementInterface::hasMultipleValues() declares that this method returns a boolean, but this is not the full picture.

The method can return these values:

  1. TRUE if there are unlimited values.
  2. FALSE if only a single value is allowed
  3. An integer in case a limited number of values are allowed. For example if 2 values are allowed it will return 2

The method is not well named, and there is overlap between this and ::supportsMultipleValues() as well as ::hasMultipleWrapper(). It is also confusing that FALSE equates to 1 allowed element. However changing method names and/or return values would be a B/C break.

Proposed resolution

The simplest solution would be to update the documentation to match the reality.

🐛 Bug report
Status

Active

Version

6.3

Component

Documentation

Created by

🇧🇬Bulgaria pfrenssen Sofia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @pfrenssen
  • Pipeline finished with Success
    about 1 month ago
    Total: 889s
    #417008
  • 🇮🇳India vinodhini.e chennai

    Hi Pfrenssen,

    Updated the inline documentation for WebformElementInterface::hasMultipleValues() to provide a more precise and detailed explanation of its return values. The updated comments clarify that the method can return TRUE for unlimited values, FALSE when only a single value is allowed, and an integer when a limited number of values are permitted. This ensures better understanding and alignment with the actual functionality of the method.

    Thanks .

  • 🇮🇳India vinayakmk47

    Hi @pfrenssen, Thank you for updating the documentation for WebformElementInterface::hasMultipleValues(). I have reviewed the changes, and the updated docblock now accurately reflects the method's behavior, including its return types and their meaning. This will provide much-needed clarity for developers.

    The inclusion of detailed explanations for TRUE, FALSE, and integer return values ensures that the method's usage is well understood. Marking this issue as Reviewed and Tested by the Community. 🎉

Production build 0.71.5 2024