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