diff --git a/src/Writer/PhpArray.php b/src/Writer/PhpArray.php index 0eed213..ee9c724 100644 --- a/src/Writer/PhpArray.php +++ b/src/Writer/PhpArray.php @@ -82,6 +82,8 @@ protected function processIndented(array $config, array $arraySyntax, &$indentLe $arrayString .= ($value ? 'true' : 'false') . ",\n"; } elseif (is_string($value)) { $arrayString .= "'" . addslashes($value) . "',\n"; + } elseif ($value === null) { + $arrayString .= "null,\n"; } else { $arrayString .= $value . ",\n"; } diff --git a/test/Writer/PhpArrayTest.php b/test/Writer/PhpArrayTest.php index 0a00e47..9ed3e05 100644 --- a/test/Writer/PhpArrayTest.php +++ b/test/Writer/PhpArrayTest.php @@ -38,6 +38,7 @@ public function testRender() 'object' => (object) array('foo' => 'bar'), 'integer' => 123, 'boolean' => false, + 'null' => null, )); $configString = $this->writer->toString($config); @@ -56,6 +57,7 @@ public function testRender() $expected .= ")),\n"; $expected .= " 'integer' => 123,\n"; $expected .= " 'boolean' => false,\n"; + $expected .= " 'null' => null,\n"; $expected .= ");\n"; $this->assertEquals($expected, $configString);