@@ -579,38 +579,38 @@ public function testInMatchValue($testMarker, $openerOffset, $closerOffset, $exp
579
579
*
580
580
* @see testInMatchValue()
581
581
*
582
- * @return array
582
+ * @return array<string, array<string, string|int>>
583
583
*/
584
584
public static function dataInMatchValue ()
585
585
{
586
586
return [
587
587
'not_last_value ' => [
588
- '/* testInMatchNotLastValue */ ' ,
589
- 5 ,
590
- 11 ,
591
- 'T_COMMA ' ,
592
- 'comma ' ,
588
+ 'testMarker ' => ' /* testInMatchNotLastValue */ ' ,
589
+ ' openerOffset ' => 5 ,
590
+ ' closerOffset ' => 11 ,
591
+ 'expectedCloserType ' => ' T_COMMA ' ,
592
+ 'expectedCloserFriendlyName ' => ' comma ' ,
593
593
],
594
594
'last_value_with_trailing_comma ' => [
595
- '/* testInMatchLastValueWithTrailingComma */ ' ,
596
- 5 ,
597
- 11 ,
598
- 'T_COMMA ' ,
599
- 'comma ' ,
595
+ 'testMarker ' => ' /* testInMatchLastValueWithTrailingComma */ ' ,
596
+ ' openerOffset ' => 5 ,
597
+ ' closerOffset ' => 11 ,
598
+ 'expectedCloserType ' => ' T_COMMA ' ,
599
+ 'expectedCloserFriendlyName ' => ' comma ' ,
600
600
],
601
601
'last_value_without_trailing_comma_1 ' => [
602
- '/* testInMatchLastValueNoTrailingComma1 */ ' ,
603
- 5 ,
604
- 10 ,
605
- 'T_CLOSE_PARENTHESIS ' ,
606
- 'close parenthesis ' ,
602
+ 'testMarker ' => ' /* testInMatchLastValueNoTrailingComma1 */ ' ,
603
+ ' openerOffset ' => 5 ,
604
+ ' closerOffset ' => 10 ,
605
+ 'expectedCloserType ' => ' T_CLOSE_PARENTHESIS ' ,
606
+ 'expectedCloserFriendlyName ' => ' close parenthesis ' ,
607
607
],
608
608
'last_value_without_trailing_comma_2 ' => [
609
- '/* testInMatchLastValueNoTrailingComma2 */ ' ,
610
- 5 ,
611
- 11 ,
612
- 'T_VARIABLE ' ,
613
- '$y variable ' ,
609
+ 'testMarker ' => ' /* testInMatchLastValueNoTrailingComma2 */ ' ,
610
+ ' openerOffset ' => 5 ,
611
+ ' closerOffset ' => 11 ,
612
+ 'expectedCloserType ' => ' T_VARIABLE ' ,
613
+ 'expectedCloserFriendlyName ' => ' $y variable ' ,
614
614
],
615
615
];
616
616
@@ -669,47 +669,63 @@ public function testNotAnArrowFunction($testMarker, $testContent='fn')
669
669
*
670
670
* @see testNotAnArrowFunction()
671
671
*
672
- * @return array
672
+ * @return array<string, array<string, string>>
673
673
*/
674
674
public static function dataNotAnArrowFunction ()
675
675
{
676
676
return [
677
- ['/* testFunctionName */ ' ],
678
- [
679
- '/* testConstantDeclaration */ ' ,
680
- 'FN ' ,
677
+ 'name of a function, context: declaration ' => [
678
+ 'testMarker ' => '/* testFunctionName */ ' ,
681
679
],
682
- [
683
- '/* testConstantDeclarationLower */ ' ,
684
- 'fn ' ,
680
+ ' name of a constant, context: declaration using "const" keyword - uppercase ' => [
681
+ 'testMarker ' => ' /* testConstantDeclaration */ ' ,
682
+ 'testContent ' => ' FN ' ,
685
683
],
686
- ['/* testStaticMethodName */ ' ],
687
- ['/* testPropertyAssignment */ ' ],
688
- [
689
- '/* testAnonClassMethodName */ ' ,
690
- 'fN ' ,
684
+ 'name of a constant, context: declaration using "const" keyword - lowercase ' => [
685
+ 'testMarker ' => '/* testConstantDeclarationLower */ ' ,
686
+ 'testContent ' => 'fn ' ,
691
687
],
692
- ['/* testNonArrowStaticMethodCall */ ' ],
693
- [
694
- '/* testNonArrowConstantAccess */ ' ,
695
- 'FN ' ,
688
+ 'name of a (static) method, context: declaration ' => [
689
+ 'testMarker ' => '/* testStaticMethodName */ ' ,
696
690
],
697
- [
698
- '/* testNonArrowConstantAccessMixed */ ' ,
699
- 'Fn ' ,
691
+ 'name of a property, context: property access ' => [
692
+ 'testMarker ' => '/* testPropertyAssignment */ ' ,
700
693
],
701
- ['/* testNonArrowObjectMethodCall */ ' ],
702
- [
703
- '/* testNonArrowObjectMethodCallUpper */ ' ,
704
- 'FN ' ,
694
+ 'name of a method, context: declaration in an anon class - mixed case ' => [
695
+ 'testMarker ' => '/* testAnonClassMethodName */ ' ,
696
+ 'testContent ' => 'fN ' ,
705
697
],
706
- [
707
- '/* testNonArrowNamespacedFunctionCall */ ' ,
708
- 'Fn ' ,
698
+ 'name of a method, context: static method call ' => [
699
+ 'testMarker ' => '/* testNonArrowStaticMethodCall */ ' ,
700
+ ],
701
+ 'name of a constant, context: constant access - uppercase ' => [
702
+ 'testMarker ' => '/* testNonArrowConstantAccess */ ' ,
703
+ 'testContent ' => 'FN ' ,
704
+ ],
705
+ 'name of a constant, context: constant access - mixed case ' => [
706
+ 'testMarker ' => '/* testNonArrowConstantAccessMixed */ ' ,
707
+ 'testContent ' => 'Fn ' ,
708
+ ],
709
+ 'name of a method, context: method call on object - lowercase ' => [
710
+ 'testMarker ' => '/* testNonArrowObjectMethodCall */ ' ,
711
+ ],
712
+ 'name of a method, context: method call on object - uppercase ' => [
713
+ 'testMarker ' => '/* testNonArrowObjectMethodCallUpper */ ' ,
714
+ 'testContent ' => 'FN ' ,
715
+ ],
716
+ 'name of a (namespaced) function, context: partially qualified function call ' => [
717
+ 'testMarker ' => '/* testNonArrowNamespacedFunctionCall */ ' ,
718
+ 'testContent ' => 'Fn ' ,
719
+ ],
720
+ 'name of a (namespaced) function, context: namespace relative function call ' => [
721
+ 'testMarker ' => '/* testNonArrowNamespaceOperatorFunctionCall */ ' ,
722
+ ],
723
+ 'name of a function, context: declaration with union types for param and return ' => [
724
+ 'testMarker ' => '/* testNonArrowFunctionNameWithUnionTypes */ ' ,
725
+ ],
726
+ 'unknown - live coding/parse error ' => [
727
+ 'testMarker ' => '/* testLiveCoding */ ' ,
709
728
],
710
- ['/* testNonArrowNamespaceOperatorFunctionCall */ ' ],
711
- ['/* testNonArrowFunctionNameWithUnionTypes */ ' ],
712
- ['/* testLiveCoding */ ' ],
713
729
];
714
730
715
731
}//end dataNotAnArrowFunction()
0 commit comments