@@ -553,7 +553,31 @@ public function testTernary()
553
553
554
554
555
555
/**
556
- * Test that anonymous class tokens without parenthesis do not get assigned a parenthesis owner.
556
+ * Test that the backfill presumes T_FN during live coding, but doesn't set the additional index keys.
557
+ *
558
+ * @covers PHP_CodeSniffer\Tokenizers\PHP::processAdditional
559
+ *
560
+ * @return void
561
+ */
562
+ public function testLiveCoding ()
563
+ {
564
+ $ tokens = self ::$ phpcsFile ->getTokens ();
565
+
566
+ $ token = $ this ->getTargetToken ('/* testLiveCoding */ ' , [T_STRING , T_FN ]);
567
+ $ this ->assertSame ($ tokens [$ token ]['code ' ], T_FN , 'Token not tokenized as T_FN ' );
568
+
569
+ $ this ->assertArrayNotHasKey ('scope_condition ' , $ tokens [$ token ], 'Scope condition is set ' );
570
+ $ this ->assertArrayNotHasKey ('scope_opener ' , $ tokens [$ token ], 'Scope opener is set ' );
571
+ $ this ->assertArrayNotHasKey ('scope_closer ' , $ tokens [$ token ], 'Scope closer is set ' );
572
+ $ this ->assertArrayNotHasKey ('parenthesis_owner ' , $ tokens [$ token ], 'Parenthesis owner is set ' );
573
+ $ this ->assertArrayNotHasKey ('parenthesis_opener ' , $ tokens [$ token ], 'Parenthesis opener is set ' );
574
+ $ this ->assertArrayNotHasKey ('parenthesis_closer ' , $ tokens [$ token ], 'Parenthesis closer is set ' );
575
+
576
+ }//end testLiveCoding()
577
+
578
+
579
+ /**
580
+ * Helper function to check that all token keys are correctly set for T_FN tokens.
557
581
*
558
582
* @param string $token The T_FN token to check.
559
583
*
0 commit comments