From 561ca757d7dc366b029029746d65e8592fc90285 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Oct 2020 17:17:13 +0200 Subject: [PATCH] phpcs --- htdocs/core/lib/functions2.lib.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index d16a2b90243..94bf0dd06c4 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2387,14 +2387,15 @@ function price2fec($amount) /** * Check the syntax of some PHP code. - * @param string $code PHP code to check. - * @return boolean|array If false, then check was successful, otherwise an array(message,line) of errors is returned. + * + * @param string $code PHP code to check. + * @return boolean|array If false, then check was successful, otherwise an array(message,line) of errors is returned. */ function phpSyntaxError($code) { - if (!defined("CR")) define("CR","\r"); - if (!defined("LF")) define("LF","\n") ; - if (!defined("CRLF")) define("CRLF","\r\n") ; + if (!defined("CR")) define("CR", "\r"); + if (!defined("LF")) define("LF", "\n"); + if (!defined("CRLF")) define("CRLF", "\r\n"); $braces=0; $inString=0; @@ -2406,14 +2407,16 @@ function phpSyntaxError($code) case T_START_HEREDOC: ++$inString; break; case T_END_HEREDOC: --$inString; break; } - } else if ($inString & 1) { + } elseif ($inString & 1) { switch ($token) { - case '`': case '\'': + case '`': + case '\'': case '"': --$inString; break; } } else { switch ($token) { - case '`': case '\'': + case '`': + case '\'': case '"': ++$inString; break; case '{': ++$braces; break; case '}': @@ -2436,8 +2439,8 @@ function phpSyntaxError($code) if ($braces) { $braces = PHP_INT_MAX; } else { - false !== strpos($code,CR) && $code = strtr(str_replace(CRLF,LF,$code),CR,LF); - $braces = substr_count($code,LF); + false !== strpos($code, CR) && $code = strtr(str_replace(CRLF, LF, $code), CR, LF); + $braces = substr_count($code, LF); } $code = ob_get_clean(); $code = strip_tags($code); @@ -2455,4 +2458,3 @@ function phpSyntaxError($code) @ini_set('log_errors', $inString); return $code; } -