@@ -119,7 +119,10 @@ public function testMagicMethods()
119
119
$ aspect = BarAspect::class;
120
120
121
121
AspectCollector::setAround ($ aspect , [
122
- Bar4::class . '::toRewriteMethodString ' ,
122
+ Bar4::class . '::toRewriteMethodString1 ' ,
123
+ Bar4::class . '::toRewriteMethodString2 ' ,
124
+ Bar4::class . '::toRewriteMethodString3 ' ,
125
+ Bar4::class . '::toRewriteMethodString4 ' ,
123
126
], []);
124
127
125
128
$ ast = new Ast ();
@@ -139,11 +142,47 @@ public function toMethodString() : string
139
142
{
140
143
return __METHOD__;
141
144
}
142
- public function toRewriteMethodString() : string
145
+ /**
146
+ * To test method parameters (with type declaration in use).
147
+ */
148
+ public function toRewriteMethodString1(int $count) : string
143
149
{
144
150
$__function__ = __FUNCTION__;
145
151
$__method__ = __METHOD__;
146
- return self::__proxyCall(__CLASS__, __FUNCTION__, self::__getParamsMap(__CLASS__, __FUNCTION__, func_get_args()), function () use($__function__, $__method__) {
152
+ return self::__proxyCall(__CLASS__, __FUNCTION__, self::__getParamsMap(__CLASS__, __FUNCTION__, func_get_args()), function (int $count) use($__function__, $__method__) {
153
+ return $__method__;
154
+ });
155
+ }
156
+ /**
157
+ * To test passing by references.
158
+ */
159
+ public function toRewriteMethodString2(int &$count) : string
160
+ {
161
+ $__function__ = __FUNCTION__;
162
+ $__method__ = __METHOD__;
163
+ return self::__proxyCall(__CLASS__, __FUNCTION__, self::__getParamsMap(__CLASS__, __FUNCTION__, func_get_args()), function (int &$count) use($__function__, $__method__) {
164
+ return $__method__;
165
+ });
166
+ }
167
+ /**
168
+ * To test variadic parameters (without type declaration).
169
+ */
170
+ public function toRewriteMethodString3(...$params) : string
171
+ {
172
+ $__function__ = __FUNCTION__;
173
+ $__method__ = __METHOD__;
174
+ return self::__proxyCall(__CLASS__, __FUNCTION__, self::__getParamsMap(__CLASS__, __FUNCTION__, func_get_args()), function ($params) use($__function__, $__method__) {
175
+ return $__method__;
176
+ });
177
+ }
178
+ /**
179
+ * To test variadic parameters with type declaration.
180
+ */
181
+ public function toRewriteMethodString4(int &$count, string ...$params) : string
182
+ {
183
+ $__function__ = __FUNCTION__;
184
+ $__method__ = __METHOD__;
185
+ return self::__proxyCall(__CLASS__, __FUNCTION__, self::__getParamsMap(__CLASS__, __FUNCTION__, func_get_args()), function (int &$count, $params) use($__function__, $__method__) {
147
186
return $__method__;
148
187
});
149
188
}
0 commit comments