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
140
140
*/
141
141
public function __toString () : string
142
142
{
143
- return ($ this ->type ? $ this ->type . ' ' : '' )
143
+ return ($ this ->type ? $ this ->type . ( $ this -> variableName ? ' ' : '' ) : '' )
144
144
. ($ this ->isReference () ? '& ' : '' )
145
145
. ($ this ->isVariadic () ? '... ' : '' )
146
146
. ($ this ->variableName ? '$ ' . $ this ->variableName : '' )
147
- . ($ this -> description ? ( $ this ->variableName ? ' ' : '' ) . $ this ->description : '' );
147
+ . (( '' . $ this ->description ) ? ' ' . $ this ->description : '' );
148
148
}
149
149
150
150
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
98
98
*/
99
99
public function __toString () : string
100
100
{
101
- return ($ this ->type ? $ this ->type . ' ' : '' )
101
+ return ($ this ->type ? $ this ->type . ( $ this -> variableName ? ' ' : '' ) : '' )
102
102
. ($ this ->variableName ? '$ ' . $ this ->variableName : '' )
103
- . ($ this -> description ? ( $ this ->variableName ? ' ' : '' ) . $ this ->description : '' );
103
+ . (( '' . $ this ->description ) ? ' ' . $ this ->description : '' );
104
104
}
105
105
}
Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ public function getVariableName() : ?string
98
98
*/
99
99
public function __toString () : string
100
100
{
101
- return ($ this ->type ? $ this ->type . ' ' : '' )
101
+ return ($ this ->type ? $ this ->type . ( $ this -> variableName ? ' ' : '' ) : '' )
102
102
. ($ this ->variableName ? '$ ' . $ this ->variableName : '' )
103
- . ($ this -> description ? ( $ this ->variableName ? ' ' : '' ) . $ this ->description : '' );
103
+ . (( '' . $ this ->description ) ? ' ' . $ this ->description : '' );
104
104
}
105
105
}
Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ public function getVariableName() : ?string
98
98
*/
99
99
public function __toString () : string
100
100
{
101
- return ($ this ->type ? $ this ->type . ' ' : '' )
101
+ return ($ this ->type ? $ this ->type . ( $ this -> variableName ? ' ' : '' ) : '' )
102
102
. ($ this ->variableName ? '$ ' . $ this ->variableName : '' )
103
- . ($ this -> description ? ( $ this ->variableName ? ' ' : '' ) . $ this ->description : '' );
103
+ . (( '' . $ this ->description ) ? ' ' . $ this ->description : '' );
104
104
}
105
105
}
Original file line number Diff line number Diff line change @@ -99,8 +99,8 @@ public function getVariableName() : ?string
99
99
*/
100
100
public function __toString () : string
101
101
{
102
- return ($ this ->type ? $ this ->type . ' ' : '' )
102
+ return ($ this ->type ? $ this ->type . ( $ this -> variableName ? ' ' : '' ) : '' )
103
103
. ($ this ->variableName ? '$ ' . $ this ->variableName : '' )
104
- . ($ this -> description ? ( $ this ->variableName ? ' ' : '' ) . $ this ->description : '' );
104
+ . (( '' . $ this ->description ) ? ' ' . $ this ->description : '' );
105
105
}
106
106
}
Original file line number Diff line number Diff line change @@ -237,6 +237,35 @@ public function testFactoryMethodWithType() : void
237
237
$ this ->assertSame ('My Description ' , $ fixture ->getDescription () . '' );
238
238
}
239
239
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
+
240
269
/**
241
270
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::<public>
242
271
* @uses \phpDocumentor\Reflection\TypeResolver
You can’t perform that action at this time.
0 commit comments