@@ -33,7 +33,6 @@ class Inline
33
33
private static $ objectSupport = false ;
34
34
private static $ objectForMap = false ;
35
35
private static $ constantSupport = false ;
36
- private static $ nullAsTilde = false ;
37
36
38
37
/**
39
38
* @param int $flags
@@ -46,7 +45,6 @@ public static function initialize($flags, $parsedLineNumber = null, $parsedFilen
46
45
self ::$ objectSupport = (bool ) (Yaml::PARSE_OBJECT & $ flags );
47
46
self ::$ objectForMap = (bool ) (Yaml::PARSE_OBJECT_FOR_MAP & $ flags );
48
47
self ::$ constantSupport = (bool ) (Yaml::PARSE_CONSTANT & $ flags );
49
- self ::$ nullAsTilde = (bool ) (Yaml::DUMP_NULL_AS_TILDE & $ flags );
50
48
self ::$ parsedFilename = $ parsedFilename ;
51
49
52
50
if (null !== $ parsedLineNumber ) {
@@ -131,7 +129,7 @@ public static function dump($value, int $flags = 0): string
131
129
throw new DumpException (sprintf ('Unable to dump PHP resources in a YAML file ("%s"). ' , get_resource_type ($ value )));
132
130
}
133
131
134
- return self ::dumpNull ();
132
+ return self ::dumpNull ($ flags );
135
133
case $ value instanceof \DateTimeInterface:
136
134
return $ value ->format ('c ' );
137
135
case \is_object ($ value ):
@@ -157,11 +155,11 @@ public static function dump($value, int $flags = 0): string
157
155
throw new DumpException ('Object support when dumping a YAML file has been disabled. ' );
158
156
}
159
157
160
- return self ::dumpNull ();
158
+ return self ::dumpNull ($ flags );
161
159
case \is_array ($ value ):
162
160
return self ::dumpArray ($ value , $ flags );
163
161
case null === $ value :
164
- return self ::dumpNull ();
162
+ return self ::dumpNull ($ flags );
165
163
case true === $ value :
166
164
return 'true ' ;
167
165
case false === $ value :
@@ -258,9 +256,9 @@ private static function dumpArray(array $value, int $flags): string
258
256
return sprintf ('{ %s } ' , implode (', ' , $ output ));
259
257
}
260
258
261
- private static function dumpNull (): string
259
+ private static function dumpNull (int $ flags ): string
262
260
{
263
- if (self :: $ nullAsTilde ) {
261
+ if (Yaml:: DUMP_NULL_AS_TILDE & $ flags ) {
264
262
return '~ ' ;
265
263
}
266
264
0 commit comments