MDL-79666 libraries: upgrade to version 1.12.1 of ScssPhp.

This commit is contained in:
Paul Holden
2024-01-24 15:23:07 +00:00
parent 810554ee83
commit b037cd5d15
7 changed files with 160 additions and 39 deletions
+14 -4
View File
@@ -33,7 +33,7 @@ use ScssPhp\ScssPhp\Util;
*
* @template-implements \ArrayAccess<int, mixed>
*/
class Number extends Node implements \ArrayAccess
class Number extends Node implements \ArrayAccess, \JsonSerializable
{
const PRECISION = 10;
@@ -131,7 +131,7 @@ class Number extends Node implements \ArrayAccess
}
/**
* @return string[]
* @return list<string>
*/
public function getNumeratorUnits()
{
@@ -139,13 +139,23 @@ class Number extends Node implements \ArrayAccess
}
/**
* @return string[]
* @return list<string>
*/
public function getDenominatorUnits()
{
return $this->denominatorUnits;
}
/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
// Passing a compiler instance makes the method output a Sass representation instead of a CSS one, supporting full units.
return $this->output(new Compiler());
}
/**
* @return bool
*/
@@ -554,7 +564,7 @@ class Number extends Node implements \ArrayAccess
try {
return $this->coerceUnits($other, function ($num1, $num2) {
return round($num1,self::PRECISION) == round($num2, self::PRECISION);
return round($num1, self::PRECISION) == round($num2, self::PRECISION);
});
} catch (SassScriptException $e) {
return false;