@@ -31,13 +31,15 @@ class Escaper
31
31
"\x08" , "\x09" , "\x0a" , "\x0b" , "\x0c" , "\x0d" , "\x0e" , "\x0f" ,
32
32
"\x10" , "\x11" , "\x12" , "\x13" , "\x14" , "\x15" , "\x16" , "\x17" ,
33
33
"\x18" , "\x19" , "\x1a" , "\x1b" , "\x1c" , "\x1d" , "\x1e" , "\x1f" ,
34
- "\xc2\x85" , "\xc2\xa0" , "\xe2\x80\xa8" , "\xe2\x80\xa9" );
34
+ "\xc2\x85" , "\xc2\xa0" , "\xe2\x80\xa8" , "\xe2\x80\xa9" ,
35
+ );
35
36
private static $ escaped = array ('\\\\' , '\\" ' , '\\\\' , '\\" ' ,
36
37
'\\0 ' , '\\x01 ' , '\\x02 ' , '\\x03 ' , '\\x04 ' , '\\x05 ' , '\\x06 ' , '\\a ' ,
37
38
'\\b ' , '\\t ' , '\\n ' , '\\v ' , '\\f ' , '\\r ' , '\\x0e ' , '\\x0f ' ,
38
39
'\\x10 ' , '\\x11 ' , '\\x12 ' , '\\x13 ' , '\\x14 ' , '\\x15 ' , '\\x16 ' , '\\x17 ' ,
39
40
'\\x18 ' , '\\x19 ' , '\\x1a ' , '\\e ' , '\\x1c ' , '\\x1d ' , '\\x1e ' , '\\x1f ' ,
40
- '\\N ' , '\\_ ' , '\\L ' , '\\P ' );
41
+ '\\N ' , '\\_ ' , '\\L ' , '\\P ' ,
42
+ );
41
43
42
44
/**
43
45
* Determines if a PHP value would require double quoting in YAML.
@@ -48,7 +50,7 @@ class Escaper
48
50
*/
49
51
public static function requiresDoubleQuoting ($ value )
50
52
{
51
- return preg_match ('/ ' .self ::REGEX_CHARACTER_TO_ESCAPE .'/u ' , $ value );
53
+ return 0 < preg_match ('/ ' .self ::REGEX_CHARACTER_TO_ESCAPE .'/u ' , $ value );
52
54
}
53
55
54
56
/**
@@ -80,7 +82,7 @@ public static function requiresSingleQuoting($value)
80
82
81
83
// Determines if the PHP value contains any single characters that would
82
84
// cause it to require single quoting in YAML.
83
- return preg_match ('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x ' , $ value );
85
+ return 0 < preg_match ('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x ' , $ value );
84
86
}
85
87
86
88
/**
0 commit comments