Skip to content

Commit ca4c9ed

Browse files
committed
Don't include descriptions in the generated DocBlocks
These mostly just duplicate the PHP documenation. Developers are unlikely to refer to these for the PHP documentation, and they can still inspect the return type to confirm that, e.g., `false` will not be returned. Instead, only include the type information. This reduces the size of the generated code from 6.27Mb to 2.79Mb. Part of #706.
1 parent 98d020e commit ca4c9ed

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

generator/src/XmlDocParser/Method.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,9 @@ public function getPhpDoc(): string
126126

127127
private function getDocBlock(): string
128128
{
129-
$str = $this->stripReturnFalseText($this->getStringForXPath("//docbook:refsect1[@role='description']/docbook:para"));
130-
$str .= "\n\n";
131-
132-
$i=1;
129+
$str = '';
133130
foreach ($this->getParams() as $parameter) {
134-
$str .= '@param '.$parameter->getDocBlockType().' $'.$parameter->getParameterName().' ';
135-
$str .= $this->getStringForXPath("(//docbook:refsect1[@role='parameters']//docbook:varlistentry)[$i]//docbook:para")."\n";
136-
$i++;
131+
$str .= '@param '.$parameter->getDocBlockType().' $'.$parameter->getParameterName()."\n";
137132
}
138133

139134
$str .= $this->getReturnDocBlock();
@@ -147,12 +142,9 @@ private function getDocBlock(): string
147142

148143
public function getReturnDocBlock(): string
149144
{
150-
$returnDoc = $this->getStringForXPath("//docbook:refsect1[@role='returnvalues']/docbook:para");
151-
$returnDoc = $this->stripReturnFalseText($returnDoc);
152-
153145
$bestReturnType = $this->getDocBlockReturnType();
154146
if ($bestReturnType !== 'void') {
155-
return '@return '.$bestReturnType. ' ' .$returnDoc."\n";
147+
return '@return '.$bestReturnType."\n";
156148
}
157149
return '';
158150
}

0 commit comments

Comments
 (0)