@@ -61,7 +61,7 @@ public function __construct($offset = 0, $totalNumberOfLines = null, array $skip
6161 */
6262public function parse ($ value ,$ exceptionOnInvalidType =false ,$ objectSupport =false ,$ objectForMap =false )
6363 {
64- if (! self :: preg_match ('//u ' ,$ value )) {
64+ if (false === preg_match ('//u ' ,$ value )) {
6565throw new ParseException ('The YAML value does not appear to be valid UTF-8. ' );
6666 }
6767$ this ->currentLineNb = -1 ;
@@ -127,7 +127,6 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
127127 }elseif (self ::preg_match ('#^(?P<key> ' .Inline::REGEX_QUOTED_STRING .'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+))?$#u ' ,rtrim ($ this ->currentLine ),$ values )
128128 && (false ===strpos ($ values ['key ' ],' # ' )
129129 ||in_array ($ values ['key ' ][0 ],array ('" ' ,"' " )))) {
130-
131130if ($ context &&'sequence ' ==$ context ) {
132131throw new ParseException ('You cannot define a mapping item when in a sequence ' ,$ this ->currentLineNb +1 ,$ this ->currentLine );
133132 }
@@ -269,7 +268,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
269268return $ value ;
270269 }
271270
272- throw new ParseException (" Unable to parse " ,$ this ->getRealCurrentLineNb () +1 ,$ this ->currentLine );
271+ throw new ParseException (' Unable to parse ' ,$ this ->getRealCurrentLineNb () +1 ,$ this ->currentLine );
273272 }
274273 }
275274
@@ -794,9 +793,11 @@ private function isBlockScalarHeader()
794793 * in the YAML engine
795794 *
796795 * @throws ParseException on a PCRE internal error
796+ *
797797 * @see preg_last_error()
798+ * @internal
798799 */
799- static function preg_match ($ pattern ,$ subject , &$ matches =null ,$ flags =0 ,$ offset =0 )
800+ public static function preg_match ($ pattern ,$ subject , &$ matches =null ,$ flags =0 ,$ offset =0 )
800801 {
801802$ ret =preg_match ($ pattern ,$ subject ,$ matches ,$ flags ,$ offset );
802803if ($ ret ===false ) {
@@ -822,6 +823,7 @@ static function preg_match($pattern, $subject, &$matches = null, $flags = 0, $of
822823
823824throw new ParseException ($ error );
824825 }
826+
825827return $ ret ;
826828 }
827829}