Skip to content

Commit 6730cbf

Browse files
DanielEScherzerkocsismate
authored andcommitted
gen_stub: inline single-use ::setTypes() methods
Both `ArgInfo::setTypes()` and `ReturnInfo::setTypes()` were private methods only called in the applicable class's constructor. They had no special logic that benefited from existing as a separate method, and just added a level of indirection. Inline the uses and remove the methods.
1 parent d2220a4 commit 6730cbf

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

build/gen_stub.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,8 @@ public function __construct(
811811
$this->name = $name;
812812
$this->sendBy = $sendBy;
813813
$this->isVariadic = $isVariadic;
814-
$this->setTypes($type, $phpDocType);
814+
$this->type = $type;
815+
$this->phpDocType = $phpDocType;
815816
$this->defaultValue = $defaultValue;
816817
$this->attributes = $attributes;
817818
}
@@ -876,12 +877,6 @@ public function getDefaultValueAsMethodSynopsisString(): ?string {
876877

877878
return $this->defaultValue;
878879
}
879-
880-
private function setTypes(?Type $type, ?Type $phpDocType): void
881-
{
882-
$this->type = $type;
883-
$this->phpDocType = $phpDocType;
884-
}
885880
}
886881

887882
interface VariableLikeName {
@@ -1137,7 +1132,9 @@ class ReturnInfo {
11371132

11381133
public function __construct(bool $byRef, ?Type $type, ?Type $phpDocType, bool $tentativeReturnType, ?string $refcount) {
11391134
$this->byRef = $byRef;
1140-
$this->setTypes($type, $phpDocType, $tentativeReturnType);
1135+
$this->type = $type;
1136+
$this->phpDocType = $phpDocType;
1137+
$this->tentativeReturnType = $tentativeReturnType;
11411138
$this->setRefcount($refcount);
11421139
}
11431140

@@ -1151,13 +1148,6 @@ public function getMethodSynopsisType(): ?Type {
11511148
return $this->type ?? $this->phpDocType;
11521149
}
11531150

1154-
private function setTypes(?Type $type, ?Type $phpDocType, bool $tentativeReturnType): void
1155-
{
1156-
$this->type = $type;
1157-
$this->phpDocType = $phpDocType;
1158-
$this->tentativeReturnType = $tentativeReturnType;
1159-
}
1160-
11611151
private function setRefcount(?string $refcount): void
11621152
{
11631153
$type = $this->phpDocType ?? $this->type;

0 commit comments

Comments
 (0)