Skip to content

Add support for generating enum pages for the manual#21469

Open
kocsismate wants to merge 1 commit intophp:PHP-8.5from
kocsismate:enum-manual
Open

Add support for generating enum pages for the manual#21469
kocsismate wants to merge 1 commit intophp:PHP-8.5from
kocsismate:enum-manual

Conversation

@kocsismate
Copy link
Member

@kocsismate kocsismate commented Mar 18, 2026

I intentionally omit the usage of the enumitemdescription element, and I generate links instead based on php/phd#180 (comment).

@DanielEScherzer
Copy link
Member

I'm not sure I'm qualified to review the doc-generation parts of the gen_stub script, deferring to @Girgias for that
But, should this be targeting master instead of 8.5?

@kocsismate
Copy link
Member Author

but, should this be targeting master instead of 8.5?

No, I intentionally targeted 8.5 because that's the version which is being synchronized with the manual.

Comment on lines +948 to +957
class EnumCaseName {
public /* readonly */ Name $enum;
public /* readonly */ string $case;

public function __construct(Name $enum, string $case)
{
$this->enum = $enum;
$this->case = $case;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this? I don't understand why the enum case needs to know about the name of the enum it's part of?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All VariableLike classes do the same (check ClassConstName and PropertyName) because the class/enum name is needed in multiple places:

  • ClassConstName and PropertyName have a __toString() method where the classname is needed
  • The class/enum name is needed for all these classes to be able to generate the linkend attribute (check the ClassConstName::getFieldSynopsisDefaultLinkend() and the EnumCaseName::getEnumSynopsisLinkend() methods)

That said, the enum name could be stored in the EnumCaseInfo directly instead of EnumCaseName, but I figured it's a good idea to follow the other name classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants