Skip to content

Commit d832125

Browse files
committed
Only include the default constructor for non-abstract class synopses
1 parent 018fbd0 commit d832125

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

build/gen_stub.php

+16-10
Original file line numberDiff line numberDiff line change
@@ -2756,20 +2756,26 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, itera
27562756
"&InheritedProperties;"
27572757
);
27582758

2759-
$classSynopsis->appendChild(new DOMText("\n\n "));
2760-
$classSynopsisInfo = $doc->createElement("classsynopsisinfo", "&Methods;");
2761-
$classSynopsisInfo->setAttribute("role", "comment");
2762-
$classSynopsis->appendChild($classSynopsisInfo);
2759+
$isConcreteClass = ($this->type === "class" && !($this->flags & Class_::MODIFIER_ABSTRACT));
2760+
2761+
if ($isConcreteClass || !empty($this->funcInfos)) {
2762+
$classSynopsis->appendChild(new DOMText("\n\n "));
2763+
$classSynopsisInfo = $doc->createElement("classsynopsisinfo", "&Methods;");
2764+
$classSynopsisInfo->setAttribute("role", "comment");
2765+
$classSynopsis->appendChild($classSynopsisInfo);
2766+
}
27632767

27642768
$classReference = self::getClassSynopsisReference($this->name);
27652769
$escapedName = addslashes($this->name->__toString());
27662770

2767-
$classSynopsis->appendChild(new DOMText("\n "));
2768-
$includeElement = $this->createIncludeElement(
2769-
$doc,
2770-
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='$escapedName'])"
2771-
);
2772-
$classSynopsis->appendChild($includeElement);
2771+
if ($isConcreteClass || $this->hasConstructor()) {
2772+
$classSynopsis->appendChild(new DOMText("\n "));
2773+
$includeElement = $this->createIncludeElement(
2774+
$doc,
2775+
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='$escapedName'])"
2776+
);
2777+
$classSynopsis->appendChild($includeElement);
2778+
}
27732779

27742780
if ($this->hasMethods()) {
27752781
$classSynopsis->appendChild(new DOMText("\n "));

0 commit comments

Comments
 (0)