mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-23 23:25:02 +00:00
Merge "Use string as return type of MMLutil::addPreOperator"
This commit is contained in:
commit
293d0914b1
|
@ -95,14 +95,14 @@ class MMLutil {
|
|||
* em or other dimensional unit gets multiplied by pre-operator.
|
||||
* @param string $size input size i.e-123em
|
||||
* @param string $operator "plus (+) or minus (-)
|
||||
* @return string|void ++ => + , -- => +, -+ => -
|
||||
* @return string ++ => + , -- => +, -+ => -
|
||||
*/
|
||||
public static function addPreOperator( string $size, string $operator ) {
|
||||
public static function addPreOperator( string $size, string $operator ): string {
|
||||
$emtr = trim( $size );
|
||||
|
||||
$ok = preg_match( "/^(\+|\-)$/", $operator );
|
||||
$ok = preg_match( "/^([+\-])$/", $operator );
|
||||
if ( !$ok ) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
switch ( $emtr[0] ) {
|
||||
case "-":
|
||||
|
|
Loading…
Reference in a new issue