File tree Expand file tree Collapse file tree 6 files changed +39
-10
lines changed
Expand file tree Collapse file tree 6 files changed +39
-10
lines changed Original file line number Diff line number Diff line change @@ -140,11 +140,11 @@ public function isReference() : bool
140140 */
141141 public function __toString () : string
142142 {
143- return ($ this ->type ? $ this ->type . ' ' : '' )
143+ return ($ this ->type ? $ this ->type . ( $ this -> variableName ? ' ' : '' ) : '' )
144144 . ($ this ->isReference () ? '& ' : '' )
145145 . ($ this ->isVariadic () ? '... ' : '' )
146146 . ($ this ->variableName ? '$ ' . $ this ->variableName : '' )
147- . ($ this -> description ? ( $ this ->variableName ? ' ' : '' ) . $ this ->description : '' );
147+ . (( '' . $ this ->description ) ? ' ' . $ this ->description : '' );
148148 }
149149
150150 private static function strStartsWithVariable (string $ str ) : bool
Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ public function getVariableName() : ?string
9898 */
9999 public function __toString () : string
100100 {
101- return ($ this ->type ? $ this ->type . ' ' : '' )
101+ return ($ this ->type ? $ this ->type . ( $ this -> variableName ? ' ' : '' ) : '' )
102102 . ($ this ->variableName ? '$ ' . $ this ->variableName : '' )
103- . ($ this -> description ? ( $ this ->variableName ? ' ' : '' ) . $ this ->description : '' );
103+ . (( '' . $ this ->description ) ? ' ' . $ this ->description : '' );
104104 }
105105}
Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ public function getVariableName() : ?string
9898 */
9999 public function __toString () : string
100100 {
101- return ($ this ->type ? $ this ->type . ' ' : '' )
101+ return ($ this ->type ? $ this ->type . ( $ this -> variableName ? ' ' : '' ) : '' )
102102 . ($ this ->variableName ? '$ ' . $ this ->variableName : '' )
103- . ($ this -> description ? ( $ this ->variableName ? ' ' : '' ) . $ this ->description : '' );
103+ . (( '' . $ this ->description ) ? ' ' . $ this ->description : '' );
104104 }
105105}
Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ public function getVariableName() : ?string
9898 */
9999 public function __toString () : string
100100 {
101- return ($ this ->type ? $ this ->type . ' ' : '' )
101+ return ($ this ->type ? $ this ->type . ( $ this -> variableName ? ' ' : '' ) : '' )
102102 . ($ this ->variableName ? '$ ' . $ this ->variableName : '' )
103- . ($ this -> description ? ( $ this ->variableName ? ' ' : '' ) . $ this ->description : '' );
103+ . (( '' . $ this ->description ) ? ' ' . $ this ->description : '' );
104104 }
105105}
Original file line number Diff line number Diff line change @@ -99,8 +99,8 @@ public function getVariableName() : ?string
9999 */
100100 public function __toString () : string
101101 {
102- return ($ this ->type ? $ this ->type . ' ' : '' )
102+ return ($ this ->type ? $ this ->type . ( $ this -> variableName ? ' ' : '' ) : '' )
103103 . ($ this ->variableName ? '$ ' . $ this ->variableName : '' )
104- . ($ this -> description ? ( $ this ->variableName ? ' ' : '' ) . $ this ->description : '' );
104+ . (( '' . $ this ->description ) ? ' ' . $ this ->description : '' );
105105 }
106106}
Original file line number Diff line number Diff line change @@ -237,6 +237,35 @@ public function testFactoryMethodWithType() : void
237237 $ this ->assertSame ('My Description ' , $ fixture ->getDescription () . '' );
238238 }
239239
240+ /**
241+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::<public>
242+ * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
243+ * @uses \phpDocumentor\Reflection\DocBlock\Description
244+ * @uses \phpDocumentor\Reflection\Types\Context
245+ *
246+ * @covers ::create
247+ */
248+ public function testFactoryMethodWithTypeWithoutComment () : void
249+ {
250+ $ typeResolver = new TypeResolver ();
251+ $ fqsenResolver = new FqsenResolver ();
252+ $ tagFactory = new StandardTagFactory ($ fqsenResolver );
253+ $ descriptionFactory = new DescriptionFactory ($ tagFactory );
254+ $ context = new Context ('' );
255+
256+ $ fixture = Var_::create (
257+ 'int ' ,
258+ $ typeResolver ,
259+ $ descriptionFactory ,
260+ $ context
261+ );
262+
263+ $ this ->assertSame ('int ' , (string ) $ fixture );
264+ $ this ->assertSame ('' , $ fixture ->getVariableName ());
265+ $ this ->assertInstanceOf (Integer::class, $ fixture ->getType ());
266+ $ this ->assertSame ('' , $ fixture ->getDescription () . '' );
267+ }
268+
240269 /**
241270 * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::<public>
242271 * @uses \phpDocumentor\Reflection\TypeResolver
You can’t perform that action at this time.
0 commit comments