File tree 2 files changed +18
-6
lines changed
Filter options
src/Symfony/Component/Yaml
2 files changed +18
-6
lines changed
Original file line number Diff line number Diff line change @@ -33,6 +33,22 @@ class Inline
33
33
private static $ objectForMap = false ;
34
34
private static $ constantSupport = false ;
35
35
36
+ /**
37
+ * @param int $flags
38
+ * @param int|null $parsedLineNumber
39
+ */
40
+ public static function initialize ($ flags , $ parsedLineNumber = null )
41
+ {
42
+ self ::$ exceptionOnInvalidType = (bool ) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $ flags );
43
+ self ::$ objectSupport = (bool ) (Yaml::PARSE_OBJECT & $ flags );
44
+ self ::$ objectForMap = (bool ) (Yaml::PARSE_OBJECT_FOR_MAP & $ flags );
45
+ self ::$ constantSupport = (bool ) (Yaml::PARSE_CONSTANT & $ flags );
46
+
47
+ if (null !== $ parsedLineNumber ) {
48
+ self ::$ parsedLineNumber = $ parsedLineNumber ;
49
+ }
50
+ }
51
+
36
52
/**
37
53
* Converts a YAML string to a PHP value.
38
54
*
@@ -78,10 +94,7 @@ public static function parse($value, $flags = 0, $references = array())
78
94
}
79
95
}
80
96
81
- self ::$ exceptionOnInvalidType = (bool ) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $ flags );
82
- self ::$ objectSupport = (bool ) (Yaml::PARSE_OBJECT & $ flags );
83
- self ::$ objectForMap = (bool ) (Yaml::PARSE_OBJECT_FOR_MAP & $ flags );
84
- self ::$ constantSupport = (bool ) (Yaml::PARSE_CONSTANT & $ flags );
97
+ self ::initialize ($ flags );
85
98
86
99
$ value = trim ($ value );
87
100
Original file line number Diff line number Diff line change @@ -223,9 +223,8 @@ private function doParse($value, $flags)
223
223
$ context = 'mapping ' ;
224
224
225
225
// force correct settings
226
- Inline::parse ( null , $ flags , $ this ->refs );
226
+ Inline::initialize ( $ flags , $ this ->getRealCurrentLineNb () );
227
227
try {
228
- Inline::$ parsedLineNumber = $ this ->getRealCurrentLineNb ();
229
228
$ i = 0 ;
230
229
$ evaluateKey = !(Yaml::PARSE_KEYS_AS_STRINGS & $ flags );
231
230
You can’t perform that action at this time.
0 commit comments