File tree 2 files changed +63
-0
lines changed
2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,9 @@ private function parseOptionalVariableName(TokenIterator $tokens): string
358
358
if ($ tokens ->isCurrentTokenType (Lexer::TOKEN_VARIABLE )) {
359
359
$ parameterName = $ tokens ->currentTokenValue ();
360
360
$ tokens ->next ();
361
+ } elseif ($ tokens ->isCurrentTokenType (Lexer::TOKEN_THIS_VARIABLE )) {
362
+ $ parameterName = '$this ' ;
363
+ $ tokens ->next ();
361
364
362
365
} else {
363
366
$ parameterName = '' ;
Original file line number Diff line number Diff line change @@ -417,6 +417,66 @@ public function provideVarTagsData(): \Iterator
417
417
]),
418
418
];
419
419
420
+ yield [
421
+ 'OK without description with variable $this ' ,
422
+ '/** @var Foo $this */ ' ,
423
+ new PhpDocNode ([
424
+ new PhpDocTagNode (
425
+ '@var ' ,
426
+ new VarTagValueNode (
427
+ new IdentifierTypeNode ('Foo ' ),
428
+ '$this ' ,
429
+ ''
430
+ )
431
+ ),
432
+ ]),
433
+ ];
434
+
435
+ yield [
436
+ 'OK without description and with no space between type and variable name with variable $this ' ,
437
+ '/** @var Foo$this */ ' ,
438
+ new PhpDocNode ([
439
+ new PhpDocTagNode (
440
+ '@var ' ,
441
+ new VarTagValueNode (
442
+ new IdentifierTypeNode ('Foo ' ),
443
+ '$this ' ,
444
+ ''
445
+ )
446
+ ),
447
+ ]),
448
+ ];
449
+
450
+ yield [
451
+ 'OK with description with variable $this ' ,
452
+ '/** @var Foo $this Testing */ ' ,
453
+ new PhpDocNode ([
454
+ new PhpDocTagNode (
455
+ '@var ' ,
456
+ new VarTagValueNode (
457
+ new IdentifierTypeNode ('Foo ' ),
458
+ '$this ' ,
459
+ 'Testing '
460
+ )
461
+ ),
462
+ ]),
463
+ ];
464
+
465
+ yield [
466
+ 'OK with description and with no space between type and variable name with variable $this ' ,
467
+ '/** @var Foo$this Testing */ ' ,
468
+ new PhpDocNode ([
469
+ new PhpDocTagNode (
470
+ '@var ' ,
471
+ new VarTagValueNode (
472
+ new IdentifierTypeNode ('Foo ' ),
473
+ '$this ' ,
474
+ 'Testing '
475
+ )
476
+ ),
477
+ ]),
478
+ ];
479
+
420
480
yield [
421
481
'OK with variable name and description and without all optional spaces ' ,
422
482
'/** @var(Foo)$foo#desc*/ ' ,
You can’t perform that action at this time.
0 commit comments