-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Problem
In Symfony this need is very common: "given an arbitrary variable, return its best possible representation as a string".
Today we solve this problem at least in 6 different ways across different bundles and components:
- ValueExporter class (in
Symfony\Component\HttpKernel\DataCollector\Util
) used mostly in DataCollectors. - sanitizeContext() method in LoggerDataCollector (
Symfony\Component\HttpKernel\DataCollector
) - getStringRepresentation() method in DebugAccessDecisionManager class.
- getListenerInfo() in
TraceableEventDispatcher
- formatValue(), formatParameter and formatCallable in FrameworkBundle's Console descriptors.
- formatValue() method in OptionsResolver component.
- varToString() method in FileLoaderLoadException class (
Symfony/Component/Config/Exception
)
We "can't" use VarDumper because we need a pure value exporter which doesn't add CSS/JS code or other advanced stuff.
Solution
Improve VarDumper to export variables in the simplest way possible so we can replace the existing code and get the exact same results.
lyrixx, linaori, hason, theofidry and Koc