Fix deprecated code in less compiler

This commit is contained in:
Kijin Sung 2023-01-16 23:05:21 +09:00
parent e0a041bb3d
commit 60433f93d2

View file

@ -37,6 +37,7 @@
* The `lessc_formatter` takes a CSS tree, and dumps it to a formatted string,
* handling things like indentation.
*/
#[AllowDynamicProperties]
class lessc {
static public $VERSION = "v0.5.0";
@ -1363,7 +1364,7 @@ class lessc {
$name = $name . ": ";
}
$this->throwError("${name}expecting $expectedArgs arguments, got $numValues");
$this->throwError("{$name}expecting $expectedArgs arguments, got $numValues");
}
return $values;
@ -1745,7 +1746,7 @@ class lessc {
}
// type based operators
$fname = "op_${ltype}_${rtype}";
$fname = "op_{$ltype}_{$rtype}";
if (is_callable(array($this, $fname))) {
$out = $this->$fname($op, $left, $right);
if (!is_null($out)) return $out;
@ -2377,6 +2378,7 @@ class lessc {
// responsible for taking a string of LESS code and converting it into a
// syntax tree
#[AllowDynamicProperties]
class lessc_parser {
static protected $nextBlockId = 0; // used to uniquely identify blocks
@ -3605,7 +3607,7 @@ class lessc_parser {
if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault;
$r = '/'.$regex.($eatWhitespace && !$this->writeComments ? '\s*' : '').'/Ais';
if (preg_match($r, $this->buffer, $out, null, $this->count)) {
if (preg_match($r, $this->buffer, $out, 0, $this->count)) {
$this->count += strlen($out[0]);
if ($eatWhitespace && $this->writeComments) $this->whitespace();
return true;
@ -3636,7 +3638,7 @@ class lessc_parser {
protected function peek($regex, &$out = null, $from=null) {
if (is_null($from)) $from = $this->count;
$r = '/'.$regex.'/Ais';
$result = preg_match($r, $this->buffer, $out, null, $from);
$result = preg_match($r, $this->buffer, $out, 0, $from);
return $result;
}
@ -3764,6 +3766,7 @@ class lessc_parser {
}
#[AllowDynamicProperties]
class lessc_formatter_classic {
public $indentChar = " ";