File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,8 @@ public function getType()
111
111
*/
112
112
public function __toString ()
113
113
{
114
- return ($ this ->type ? $ this ->type . ' ' : '' )
115
- . '$ ' . $ this ->variableName
116
- . ($ this ->description ? ' ' . $ this ->description : '' );
114
+ return ($ this ->type ? $ this ->type . ' ' : '' )
115
+ .( empty ( $ this -> variableName ) ? null : ( '$ ' . $ this ->variableName ))
116
+ . ($ this ->description ? ' ' . $ this ->description : '' );
117
117
}
118
118
}
Original file line number Diff line number Diff line change @@ -37,6 +37,17 @@ public function testIfCorrectTagNameIsReturned()
37
37
$ this ->assertSame ('var ' , $ fixture ->getName ());
38
38
}
39
39
40
+ /**
41
+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct
42
+ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
43
+ */
44
+ public function testIfVariableNameIsOmmitedIfEmpty ()
45
+ {
46
+ $ fixture = new Var_ ('' , null , null );
47
+
48
+ $ this ->assertSame ('@var ' , $ fixture ->render ());
49
+ }
50
+
40
51
/**
41
52
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct
42
53
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__toString
You can’t perform that action at this time.
0 commit comments