From 1b608c7e7dc5277c5b77fbf0e2a6d76cd244372d Mon Sep 17 00:00:00 2001 From: Awilum Date: Thu, 17 Oct 2019 17:23:12 +0300 Subject: [PATCH] refactor(core): refactor YamlParser code --- flextype/parsers/YamlParser.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flextype/parsers/YamlParser.php b/flextype/parsers/YamlParser.php index 721cb472..082803a5 100644 --- a/flextype/parsers/YamlParser.php +++ b/flextype/parsers/YamlParser.php @@ -42,11 +42,11 @@ class YamlParser /** * Native * - * Use native parser or symfony + * Use native or symfony parser * * @var bool */ - public static $native = false; + public static $native = true; /** * Flag @@ -99,7 +99,7 @@ class YamlParser public static function decode(string $input, int $flags = 0) { // Try native PECL YAML PHP extension first if available. - if (self::$native && function_exists('yaml_parse')) { + if (\function_exists('yaml_parse') && self::$native) { // Safely decode YAML. $saved = @ini_get('yaml.decode_php'); @ini_set('yaml.decode_php', 0); @@ -112,7 +112,7 @@ class YamlParser } try { - return (array) Yaml::parse($input); + return (array) Yaml::parse($input, $flags); } catch (ParseException $e) { throw new RuntimeException('Decoding YAML failed: ' . $e->getMessage(), 0, $e); }