You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Dumper.php
-30Lines changed: 0 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -37,18 +37,6 @@ public function __construct($indentation = 4)
37
37
$this->indentation = $indentation;
38
38
}
39
39
40
-
/**
41
-
* Sets the indentation.
42
-
*
43
-
* @param int $num The amount of spaces to use for indentation of nested nodes
44
-
*/
45
-
publicfunctionsetIndentation($num)
46
-
{
47
-
@trigger_error('The '.__METHOD__.' method is deprecated since version 3.1 and will be removed in 4.0. Pass the indentation to the constructor instead.', E_USER_DEPRECATED);
48
-
49
-
$this->indentation = (int) $num;
50
-
}
51
-
52
40
/**
53
41
* Dumps a PHP value to YAML.
54
42
*
@@ -61,24 +49,6 @@ public function setIndentation($num)
@trigger_error('Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
66
-
67
-
if ($flags) {
68
-
$flags = Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE;
69
-
} else {
70
-
$flags = 0;
71
-
}
72
-
}
73
-
74
-
if (func_num_args() >= 5) {
75
-
@trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED);
@trigger_error('Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
51
-
52
-
if ($flags) {
53
-
$flags = Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE;
54
-
} else {
55
-
$flags = 0;
56
-
}
57
-
}
58
-
59
-
if (func_num_args() >= 3 && !is_array($references)) {
60
-
@trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT flag instead.', E_USER_DEPRECATED);
61
-
62
-
if ($references) {
63
-
$flags |= Yaml::PARSE_OBJECT;
64
-
}
65
-
66
-
if (func_num_args() >= 4) {
67
-
@trigger_error('Passing a boolean flag to toggle object for map support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED);
@@ -137,24 +105,6 @@ public static function parse($value, $flags = 0, $references = array())
137
105
*/
138
106
publicstaticfunctiondump($value, $flags = 0)
139
107
{
140
-
if (is_bool($flags)) {
141
-
@trigger_error('Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
142
-
143
-
if ($flags) {
144
-
$flags = Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE;
145
-
} else {
146
-
$flags = 0;
147
-
}
148
-
}
149
-
150
-
if (func_num_args() >= 3) {
151
-
@trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED);
152
-
153
-
if (func_get_arg(2)) {
154
-
$flags |= Yaml::DUMP_OBJECT;
155
-
}
156
-
}
157
-
158
108
switch (true) {
159
109
caseis_resource($value):
160
110
if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) {
@@ -330,14 +280,10 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i
330
280
}
331
281
332
282
// a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
thrownewParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]));
335
285
}
336
286
337
-
if ($output && '%' === $output[0]) {
338
-
@trigger_error(sprintf('Not quoting the scalar "%s" starting with the "%%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', $output), E_USER_DEPRECATED);
@trigger_error('Implicit casting of incompatible mapping keys to strings is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.', E_USER_DEPRECATED);
438
+
thrownewParseException('Non-string mapping keys are not supported. Pass the Yaml::PARSE_KEYS_AS_STRINGS flag to cast them to strings.', self::$parsedLineNumber + 1, $mapping);
@trigger_error('Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED);
443
+
thrownewParseException('Colons must be followed by a space or an indication character (i.e. " ", ",", "[", "]", "{", "}").', self::$parsedLineNumber + 1, $mapping);
502
444
}
503
445
504
446
while ($i < $len) {
@@ -509,7 +451,6 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
509
451
}
510
452
511
453
$tag = self::parseTag($mapping, $i, $flags);
512
-
$duplicate = false;
513
454
switch ($mapping[$i]) {
514
455
case'[':
515
456
// nested sequence
@@ -518,8 +459,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
518
459
// Parser cannot abort this mapping earlier, since lines
519
460
// are processed sequentially.
520
461
if (isset($output[$key])) {
521
-
@trigger_error(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key, self::$parsedLineNumber + 1), E_USER_DEPRECATED);
@@ -529,8 +469,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
529
469
// Parser cannot abort this mapping earlier, since lines
530
470
// are processed sequentially.
531
471
if (isset($output[$key])) {
532
-
@trigger_error(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key, self::$parsedLineNumber + 1), E_USER_DEPRECATED);
@@ -539,19 +478,17 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
539
478
// Parser cannot abort this mapping earlier, since lines
540
479
// are processed sequentially.
541
480
if (isset($output[$key])) {
542
-
@trigger_error(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key, self::$parsedLineNumber + 1), E_USER_DEPRECATED);
thrownewParseException('Object support when parsing a YAML file has been disabled.');
621
558
}
622
559
623
-
return;
624
-
case0 === strpos($scalar, '!!php/object:'):
625
-
if (self::$objectSupport) {
626
-
@trigger_error('The !!php/object tag to indicate dumped PHP objects is deprecated since version 3.1 and will be removed in 4.0. Use the !php/object tag instead.', E_USER_DEPRECATED);
627
-
628
-
returnunserialize(substr($scalar, 13));
629
-
}
630
-
631
-
if (self::$exceptionOnInvalidType) {
632
-
thrownewParseException('Object support when parsing a YAML file has been disabled.');
0 commit comments