In the following code example, an anonymous function is returned, acting like a closure. However, the Printer class expects a function name.
function generateComparisonFunctionForKey($key) {
return function ($left, $right) use ($key) {
if ($left[$key] == $right[$key])
return 0;
else
return ($left[$key] < $right[$key]) ? -1 : 1;
};
}
Error:
Warning: assert(): Assertion failed in /Users/<redacted>/php-cfg/lib/PHPCfg/Printer.php on line 46