Skip to content

[Bug] The synopsis of enum cases is quite confusing #4513

@stof

Description

@stof

Affected page

https://www.php.net/manual/en/enum.roundingmode.php (I haven't checked whether other enums have the same issue)

Issue description

The synopsis displays enum cases using the PHP syntax used to define them. The description of each case is rendered as a doc comment. But that doc comment is misplaced as it is rendered after the case.
In actual PHP code, this would associate the doc comment to the following case instead). This causes descriptions to be associated to the wrong case (and so all descriptions being wrong, as they are understood by readers)

Steps to reproduce

  1. Go to https://www.php.net/manual/en/enum.roundingmode.php
  2. Look at the enum synopsis

Suggested fix

the source code properly associate the description and the identifier in each item in

<enumsynopsis>
<enumname>RoundingMode</enumname>
<enumitem>
<enumidentifier>HalfAwayFromZero</enumidentifier>
<enumitemdescription>
Round to the nearest integer.
If the decimal part is <literal>5</literal>,
round to the integer with the larger absolute value.
</enumitemdescription>
</enumitem>
<enumitem>
<enumidentifier>HalfTowardsZero</enumidentifier>
<enumitemdescription>
Round to the nearest integer.
If the decimal part is <literal>5</literal>,
round to the integer with the smaller absolute value.
</enumitemdescription>
</enumitem>
so this looks like a rendering issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDocumentation contains incorrect information

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions