Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit de42e17

Browse files
Don't add unnecessary return doc block - close #79
1 parent 780e527 commit de42e17

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

‎src/Code/MethodGenerator.php

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

271271
$returnType = null;
272272

273-
if ($this->returnType !== null) {
273+
if ($this->returnType !== null && $this->typed === false) {
274274
$returnType = $this->returnType->type();
275275
}
276276
if ($this->returnTypeDocBlockHint !== null) {

‎tests/Code/MethodGeneratorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ public function it_generates_method_with_doc_block_comment(): void
144144
]
145145
);
146146
$method->setReturnType('void');
147+
$method->setReturnTypeDocBlockHint('void');
147148
$method->setDocBlockComment('Sets an awesome type');
148149
$method->setTyped(true);
149150

@@ -203,6 +204,7 @@ public function it_generates_method_with_array_type_doc_block(): void
203204
]
204205
);
205206
$method->setReturnType('void');
207+
$method->setReturnTypeDocBlockHint('void');
206208
$method->setDocBlockComment('Sets awesome items');
207209

208210
$expectedOutput = <<<'EOF'

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /