@@ -61,7 +61,7 @@ public function __construct($offset = 0, $totalNumberOfLines = null, array $skip
61
61
*/
62
62
public function parse ($ value , $ exceptionOnInvalidType = false , $ objectSupport = false , $ objectForMap = false )
63
63
{
64
- if (! self :: preg_match ('//u ' , $ value )) {
64
+ if (false === preg_match ('//u ' , $ value )) {
65
65
throw new ParseException ('The YAML value does not appear to be valid UTF-8. ' );
66
66
}
67
67
$ this ->currentLineNb = -1 ;
@@ -127,7 +127,6 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
127
127
} elseif (self ::preg_match ('#^(?P<key> ' .Inline::REGEX_QUOTED_STRING .'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+))?$#u ' , rtrim ($ this ->currentLine ), $ values )
128
128
&& (false === strpos ($ values ['key ' ], ' # ' )
129
129
|| in_array ($ values ['key ' ][0 ], array ('" ' , "' " )))) {
130
-
131
130
if ($ context && 'sequence ' == $ context ) {
132
131
throw new ParseException ('You cannot define a mapping item when in a sequence ' , $ this ->currentLineNb + 1 , $ this ->currentLine );
133
132
}
@@ -269,7 +268,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
269
268
return $ value ;
270
269
}
271
270
272
- throw new ParseException (" Unable to parse " , $ this ->getRealCurrentLineNb () + 1 , $ this ->currentLine );
271
+ throw new ParseException (' Unable to parse ' , $ this ->getRealCurrentLineNb () + 1 , $ this ->currentLine );
273
272
}
274
273
}
275
274
@@ -794,9 +793,12 @@ private function isBlockScalarHeader()
794
793
* in the YAML engine
795
794
*
796
795
* @throws ParseException on a PCRE internal error
796
+ *
797
797
* @see preg_last_error()
798
+ *
799
+ * @internal
798
800
*/
799
- static function preg_match ($ pattern , $ subject , &$ matches = null , $ flags = 0 , $ offset = 0 )
801
+ public static function preg_match ($ pattern , $ subject , &$ matches = null , $ flags = 0 , $ offset = 0 )
800
802
{
801
803
$ ret = preg_match ($ pattern , $ subject , $ matches , $ flags , $ offset );
802
804
if ($ ret === false ) {
@@ -822,6 +824,7 @@ static function preg_match($pattern, $subject, &$matches = null, $flags = 0, $of
822
824
823
825
throw new ParseException ($ error );
824
826
}
827
+
825
828
return $ ret ;
826
829
}
827
830
}
0 commit comments