[FrameworkBundle] changed JSON descriptors to be more readable on PHP 5.4+

This commit is contained in:
Fabien Potencier 2013-10-02 16:08:45 +02:00
parent 1d210f86a6
commit bd16157e98

View File

@ -2,6 +2,10 @@
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
if (!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
}
use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Definition;
@ -131,7 +135,7 @@ class JsonDescriptor extends Descriptor
*/ */
private function writeData(array $data, array $options) private function writeData(array $data, array $options)
{ {
$this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0)); $this->write(json_encode($data, (isset($options['json_encoding']) ? $options['json_encoding'] : 0) | JSON_PRETTY_PRINT)."\n");
} }
/** /**