gen_stub: inline single-use VariableLike::addTypeToFieldSynopsis() method

Protected method not overridden in any subclasses, so could be made private,
but the method is short enough and simple enough that it can just be inlined.
This commit is contained in:
Daniel Scherzer 2024-10-04 18:21:37 -07:00 committed by Máté Kocsis
parent 6730cbfb25
commit a4e062600f

View file

@ -2351,16 +2351,6 @@ abstract class VariableLike
abstract public function discardInfoForOldPhpVersions(?int $minimumPhpVersionIdCompatibility): void; abstract public function discardInfoForOldPhpVersions(?int $minimumPhpVersionIdCompatibility): void;
protected function addTypeToFieldSynopsis(DOMDocument $doc, DOMElement $fieldsynopsisElement): void
{
$type = $this->phpDocType ?? $this->type;
if ($type) {
$fieldsynopsisElement->appendChild(new DOMText("\n "));
$fieldsynopsisElement->appendChild($type->getTypeForDoc($doc));
}
}
/** /**
* @return array<int, string[]> * @return array<int, string[]>
*/ */
@ -2439,7 +2429,11 @@ abstract class VariableLike
$this->addModifiersToFieldSynopsis($doc, $fieldsynopsisElement); $this->addModifiersToFieldSynopsis($doc, $fieldsynopsisElement);
$this->addTypeToFieldSynopsis($doc, $fieldsynopsisElement); $type = $this->phpDocType ?? $this->type;
if ($type) {
$fieldsynopsisElement->appendChild(new DOMText("\n "));
$fieldsynopsisElement->appendChild($type->getTypeForDoc($doc));
}
$varnameElement = $doc->createElement("varname", $this->getFieldSynopsisName()); $varnameElement = $doc->createElement("varname", $this->getFieldSynopsisName());
if ($this->link) { if ($this->link) {