Skip to content

Add support for generating the namespace for the manual#21313

Open
kocsismate wants to merge 2 commits intophp:PHP-8.5from
kocsismate:gen-stub-namespace
Open

Add support for generating the namespace for the manual#21313
kocsismate wants to merge 2 commits intophp:PHP-8.5from
kocsismate:gen-stub-namespace

Conversation

@kocsismate
Copy link
Member

@kocsismate kocsismate commented Feb 27, 2026

Based on php/phd#194

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Reviewing gen_stub code is always difficult due to the lack of tests :/

Copy link
Member

@DanielEScherzer DanielEScherzer left a comment

Choose a reason for hiding this comment

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

agree that reviewing is hard, especially for patches that change the documentation generation rather than stubs - noticed one thing that might make it easier to review, but I don't think I'm qualified to actually approve this


/** @param array<string, ConstInfo> $allConstInfos */
public function getFieldSynopsisElement(DOMDocument $doc, array $allConstInfos): DOMElement
public function getFieldSynopsisElement(DOMDocument $doc, array $allConstInfos, int $indentationLevel): DOMElement
Copy link
Member

Choose a reason for hiding this comment

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

can we do the indentation changes on a separate commit, even if it is in the same PR? I assume that the initial indentation changes were meant to be no-ops, and just make things useful for indenting in a namespace later, but I can't really tell

Copy link
Member Author

Choose a reason for hiding this comment

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

If you have a look at the example generated code (https://github.com/php/doc-en/pull/5394/changes?diff=split#diff-49432cb2fae40acb9f018102542d2dd4acff194aebceec061c804fbfb8997ce9R21), you'll see why I had to change indentation all over the place: the classsynopsis element went one level inner, because it got wrapped into a packagesynopsis element.

That's why I cannot move those changed to their own commit.

}

$nameElement = $doc->createElement("{$type}name", $classInfo->name->toString());
$nameElement = $doc->createElement("{$type}name", $isMainClass ? $classInfo->getClassName() : $classInfo->name->toString());
Copy link
Member Author

Choose a reason for hiding this comment

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

probably "main class" is not the right word, but it's the class for which the class synopsis is generated: in which case, only the class name itself has to be added to the ooclass element, since the namespace shouldn't be present there anymore.

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.

3 participants