Skip to content

Fix class synopsis generation #7891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

kocsismate
Copy link
Member

@kocsismate kocsismate commented Jan 6, 2022

These are a few fixes which were necessary for me to do when syncing stubs with the docs.

@kocsismate kocsismate requested review from nikic and cmb69 January 6, 2022 08:08
@@ -1558,14 +1558,14 @@ public function getFieldSynopsisElement(DOMDocument $doc): DOMElement
}

private function getFieldSynopsisType(): Type {
if ($this->type) {
Copy link
Member Author

Choose a reason for hiding this comment

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

We have a readonly mixed property which is indeed a resource. On the contrary, the real type is displayed for params and returns because their PHPDoc type hint is usually invalid (e.g. true, false|null etc.)

@@ -2019,10 +2019,6 @@ public static function getClassSynopsisReference(Name $name): string {
*/
private function collectInheritedMembers(array &$parentsWithInheritedProperties, array &$parentsWithInheritedMethods, array $classMap): void
{
if ($this->type !== "class") {
Copy link
Member Author

Choose a reason for hiding this comment

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

usually, inherited members of interfaces are also displayed in the manual

@@ -2033,7 +2029,7 @@ private function collectInheritedMembers(array &$parentsWithInheritedProperties,
$parentsWithInheritedProperties[$parent->toString()] = $parent;
}

if (!empty($parentInfo->funcInfos) && !isset($parentsWithInheritedMethods[$parent->toString()])) {
if (!isset($parentsWithInheritedMethods[$parent->toString()]) && $parentInfo->hasMethods()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

on the other hand, constructors are usually not displayed as inherited members.

@kocsismate kocsismate changed the base branch from master to PHP-8.1 January 6, 2022 08:13
Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@kocsismate kocsismate closed this in 0462719 Jan 6, 2022
@kocsismate kocsismate deleted the fix-gen-stub branch January 6, 2022 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants