@@ -181,7 +181,7 @@ function inPreprocessedFile($callable)
181181function connectFunction ($ function , callable $ target , ?Handle $ handle = null )
182182{
183183 $ handle = $ handle ?: new Handle ;
184- $ routes = &State::$ routes [null ][$ function ];
184+ $ routes = &State::$ routes ['' ][$ function ];
185185 $ offset = Utils \append ($ routes , [$ target , $ handle ]);
186186 $ handle ->addReference ($ routes [$ offset ]);
187187 return $ handle ;
@@ -311,6 +311,10 @@ function dispatch($class, $calledClass, $method, $frame, &$result, ?array $args
311311function relay (?array $ args = null )
312312{
313313 list ($ class , $ method , $ offset ) = end (State::$ routeStack );
314+ $ class = $ class ?? '' ;
315+ $ method = $ method ?? '' ;
316+ $ offset = $ offset ?? '' ;
317+
314318 $ route = &State::$ routes [$ class ][$ method ][$ offset ];
315319 $ backup = $ route ;
316320 $ route = ['Patchwork\fallBack ' , new Handle ];
@@ -387,6 +391,9 @@ function getHHVMExpirationHandler($function)
387391
388392function getRoutesFor ($ class , $ method )
389393{
394+ $ class = $ class ?? '' ;
395+ $ method = $ method ?? '' ;
396+
390397 if (!isset (State::$ routes [$ class ][$ method ])) {
391398 return [];
392399 }
@@ -431,7 +438,7 @@ function createStubsForInternals()
431438 '$__pwRefOffset = 0; ' ,
432439 '$__pwRefOffset = 1; ' ,
433440 \Patchwork \CodeManipulation \Actions \CallRerouting \CALL_INTERCEPTION_CODE
434- ),
441+ ),
435442 $ refs
436443 );
437444 eval (strtr (INTERNAL_STUB_CODE , [
0 commit comments