Fix a bug in PhpFile::encodeArray() and improve output when saving YAML files