Skip to content

Commit 372b230

Browse files
committed
Improve doc block checks
1 parent d3fbcc7 commit 372b230

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/Code/MethodGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private function generateAttributes(): array
257257

258258
$returnType = null;
259259

260-
if ($this->returnType) {
260+
if ($this->returnType !== null) {
261261
$returnType = $this->returnType->type();
262262
}
263263
if ($this->returnTypeDocBlockHint !== null) {

src/Code/PropertyGenerator.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -180,28 +180,22 @@ private function generateAttributes(): array
180180
if ($this->typed === false || $this->docBlockComment !== null || $this->typeDocBlockHint !== null) {
181181
$docBlockType = null;
182182

183-
if ($this->type) {
183+
if ($this->type !== null) {
184184
$docBlockType = new VarTag($this->type->types());
185185
}
186186
if ($typeHint = $this->getTypeDocBlockHint()) {
187187
$docBlockType = new VarTag($typeHint);
188188
}
189189
$docBlock = null;
190190

191-
if ($this->docBlockComment) {
191+
if ($docBlockType !== null) {
192+
$docBlock = new DocBlock($this->docBlockComment);
193+
$docBlock->addTag($docBlockType);
194+
} elseif ($this->docBlockComment !== null) {
192195
$docBlock = new DocBlock($this->docBlockComment);
193-
194-
if ($docBlockType !== null) {
195-
$docBlock->addTag($docBlockType);
196-
}
197-
}
198-
if ($this->docBlockComment === null && $docBlockType !== null) {
199-
$docBlock = new DocBlock($this->docBlockComment, $docBlockType);
200196
}
201197

202198
if ($docBlock !== null) {
203-
$docBlock = new DocBlock($this->docBlockComment, $docBlockType);
204-
205199
$attributes = ['comments' => [new Doc($docBlock->generate())]];
206200
}
207201
}

0 commit comments

Comments
 (0)