Add explicit parentheses around mixed boolean operator

Mixing different binary boolean operators within an expression
without using parentheses to clarify precedence is not allowed (T358966)

Change-Id: I2e9e021bd10ddd7e1d951bf21c467499060bfc4a
This commit is contained in:
Umherirrender 2024-03-23 00:45:32 +01:00
parent 4d42d55ab2
commit 572abe655b
3 changed files with 4 additions and 3 deletions

View file

@ -76,7 +76,7 @@ class JsonToMathML extends Maintenance {
foreach ( $inputTexF as $entry ) {
try {
$mmlMathoid = $this->fetchMathML( $entry['tex'], $entry['type'], 'mathml' );
if ( $this->getOption( "chem-fallback", 0 ) && !( $mmlMathoid ) || $mmlMathoid == "" ) {
if ( ( $this->getOption( "chem-fallback", 0 ) && !$mmlMathoid ) || $mmlMathoid == "" ) {
$mmlMathoid = $this->fetchMathML( $entry['tex'], "chem", 'mathml' );
if ( $mmlMathoid && $mmlMathoid != "" ) {
$entry['type'] = "chem";

View file

@ -257,7 +257,8 @@ class MathMathML extends MathRenderer {
public function getPostData() {
$input = $this->getTex();
if ( $this->inputType == 'pmml' ||
$this->getMode() == MathConfig::MODE_LATEXML && $this->getMathml() ) {
( $this->getMode() == MathConfig::MODE_LATEXML && $this->getMathml() )
) {
$out = 'type=mml&q=' . rawurlencode( $this->getMathml() );
} elseif ( $this->inputType == 'ascii' ) {
$out = 'type=asciimath&q=' . rawurlencode( $input );

View file

@ -451,7 +451,7 @@ class MhchemStateMachines {
$buffer["o"] ?? "" );
$c4 = $this->mhchemParser->getPatterns()->match( '$one lowercase latin letter$ $',
$buffer["o"] ?? "" );
$hyphenFollows = $m === "-" && ( isset( $c1["remainder"] ) && $c1["remainder"] === ""
$hyphenFollows = $m === "-" && ( ( isset( $c1["remainder"] ) && $c1["remainder"] === "" )
|| isset( $c2 ) || isset( $c3 ) || isset( $c4 ) );
if ( $hyphenFollows && !isset( $buffer["a"] ) && !isset( $buffer["b"] )
&& !isset( $buffer["p"] ) && !isset( $buffer["d"] )