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()
111111 */
112112 public function __toString ()
113113 {
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 : '' );
117117 }
118118}
Original file line number Diff line number Diff line change @@ -37,6 +37,17 @@ public function testIfCorrectTagNameIsReturned()
3737 $ this ->assertSame ('var ' , $ fixture ->getName ());
3838 }
3939
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+
4051 /**
4152 * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct
4253 * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__toString
You can’t perform that action at this time.
0 commit comments