when discussing during the hackday yesterday, we discovered a conflict with Drupal which also has a ``debug`` function. Yesterday evening, I had an idea to workaround this issue (yeah, my brain keeps computing things at time I go to bed):
I suggest moving this logic to a namepsaced class with 2 static methods (it will also avoid using reflection to access the debug handler). then, the ``debug`` function defined conditionally would just be a wrapper around ``Symfony\Component\VarDebug\VarDebug::debug()`` (or whatever the class name is). This way, if you have a conflicting function in your codebase (i.e. Drupal for instance), you can still use the VarDebug component without copy-pasting the logic. You simply need to use the static method directly (or to define your own wrapper shortcut with a different name).
If we go this way, the Twig integration should call the static method directly to be compatible with cases where the shortcut wrapper is not available.
For ``set_debug_handler``, we can then either drop it entirely or build it as a wrapper around the static method.