@@ -2937,6 +2937,51 @@ public function testClosureUse()
29372937    }//end testClosureUse() 
29382938
29392939
2940+     /** 
2941+      * Verify handling of a closure T_USE token with variables imported by reference. 
2942+      * 
2943+      * @return void 
2944+      */ 
2945+     public  function  testClosureUseWithReference ()
2946+     {
2947+         // Offsets are relative to the T_USE token. 
2948+         $ expected
2949+         $ expected0 ] = [
2950+             'token '                => 4 ,
2951+             'name '                 => '$foo ' ,
2952+             'content '              => '&$foo ' ,
2953+             'has_attributes '       => false ,
2954+             'pass_by_reference '    => true ,
2955+             'reference_token '      => 3 ,
2956+             'variable_length '      => false ,
2957+             'variadic_token '       => false ,
2958+             'type_hint '            => '' ,
2959+             'type_hint_token '      => false ,
2960+             'type_hint_end_token '  => false ,
2961+             'nullable_type '        => false ,
2962+             'comma_token '          => 5 ,
2963+         ];
2964+         $ expected1 ] = [
2965+             'token '                => 8 ,
2966+             'name '                 => '$bar ' ,
2967+             'content '              => '&$bar ' ,
2968+             'has_attributes '       => false ,
2969+             'pass_by_reference '    => true ,
2970+             'reference_token '      => 7 ,
2971+             'variable_length '      => false ,
2972+             'variadic_token '       => false ,
2973+             'type_hint '            => '' ,
2974+             'type_hint_token '      => false ,
2975+             'type_hint_end_token '  => false ,
2976+             'nullable_type '        => false ,
2977+             'comma_token '          => false ,
2978+         ];
2979+ 
2980+         $ this getMethodParametersTestHelper ('/*  ' .__FUNCTION__ .' */ ' , $ expectedT_USE ]);
2981+ 
2982+     }//end testClosureUseWithReference() 
2983+ 
2984+ 
29402985    /** 
29412986     * Verify function declarations with trailing commas are handled correctly. 
29422987     * 
0 commit comments