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.');
Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Parser.php
+6-47Lines changed: 6 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -33,21 +33,6 @@ class Parser
33
33
private$skippedLineNumbers = array();
34
34
private$locallySkippedLineNumbers = array();
35
35
36
-
publicfunction__construct()
37
-
{
38
-
if (func_num_args() > 0) {
39
-
@trigger_error(sprintf('The constructor arguments $offset, $totalNumberOfLines, $skippedLineNumbers of %s are deprecated and will be removed in 4.0', self::class), E_USER_DEPRECATED);
40
-
41
-
$this->offset = func_get_arg(0);
42
-
if (func_num_args() > 1) {
43
-
$this->totalNumberOfLines = func_get_arg(1);
44
-
}
45
-
if (func_num_args() > 2) {
46
-
$this->skippedLineNumbers = func_get_arg(2);
47
-
}
48
-
}
49
-
}
50
-
51
36
/**
52
37
* Parses a YAML string to a PHP value.
53
38
*
@@ -60,32 +45,6 @@ public function __construct()
60
45
*/
61
46
publicfunctionparse($value, $flags = 0)
62
47
{
63
-
if (is_bool($flags)) {
64
-
@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);
65
-
66
-
if ($flags) {
67
-
$flags = Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE;
68
-
} else {
69
-
$flags = 0;
70
-
}
71
-
}
72
-
73
-
if (func_num_args() >= 3) {
74
-
@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);
75
-
76
-
if (func_get_arg(2)) {
77
-
$flags |= Yaml::PARSE_OBJECT;
78
-
}
79
-
}
80
-
81
-
if (func_num_args() >= 4) {
82
-
@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);
83
-
84
-
if (func_get_arg(3)) {
85
-
$flags |= Yaml::PARSE_OBJECT_FOR_MAP;
86
-
}
87
-
}
88
-
89
48
if (false === preg_match('//u', $value)) {
90
49
thrownewParseException('The YAML value does not appear to be valid UTF-8.');
91
50
}
@@ -178,7 +137,7 @@ private function doParse($value, $flags)
@trigger_error('Starting an unquoted string with a question mark followed by a space is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', E_USER_DEPRECATED);
140
+
thrownewParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
182
141
}
183
142
184
143
// array
@@ -230,7 +189,7 @@ private function doParse($value, $flags)
230
189
}
231
190
232
191
if (!(Yaml::PARSE_KEYS_AS_STRINGS & $flags) && !is_string($key)) {
233
-
@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);
192
+
thrownewParseException('Non-string mapping keys are not supported. Pass the Yaml::PARSE_KEYS_AS_STRINGS flag to cast them to strings.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
234
193
}
235
194
236
195
// Convert float keys to strings, to avoid being converted to integers by PHP
@@ -304,7 +263,7 @@ private function doParse($value, $flags)
304
263
$data[$key] = null;
305
264
}
306
265
} else {
307
-
@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, $this->getRealCurrentLineNb() + 1), E_USER_DEPRECATED);
// remember the parsed line number here in case we need it to provide some contexts in error messages below
@@ -319,7 +278,7 @@ private function doParse($value, $flags)
319
278
$data[$key] = $value;
320
279
}
321
280
} else {
322
-
@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, $realCurrentLineNbKey + 1), E_USER_DEPRECATED);
@@ -329,7 +288,7 @@ private function doParse($value, $flags)
329
288
if ($allowOverwrite || !isset($data[$key])) {
330
289
$data[$key] = $value;
331
290
} else {
332
-
@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, $this->getRealCurrentLineNb() + 1), E_USER_DEPRECATED);
@trigger_error('Starting an unquoted string with a question mark followed by a space is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', E_USER_DEPRECATED);
304
+
thrownewParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
0 commit comments