mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-20 11:49:56 +09:00
Fix #1927 string * float error in leafo/lessphp
- dev-master 태그로 업데이트
- PHP 8.0 이상 버전에서 오류를 일으키는 {0} 문법 4군데 재수정
This commit is contained in:
parent
e258cf7525
commit
1f9056fc08
31 changed files with 4558 additions and 4326 deletions
59
vendor/leafo/lessphp/tests/sort.php
vendored
59
vendor/leafo/lessphp/tests/sort.php
vendored
|
|
@ -1,57 +1,56 @@
|
|||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require realpath(dirname(__FILE__)).'/../lessc.inc.php';
|
||||
require realpath(dirname(__FILE__)) . '/../lessc.inc.php';
|
||||
|
||||
// sorts the selectors in stylesheet in order to normalize it for comparison
|
||||
|
||||
$exe = array_shift($argv); // remove filename
|
||||
|
||||
if (!$fname = array_shift($argv)) {
|
||||
$fname = "php://stdin";
|
||||
$fname = "php://stdin";
|
||||
}
|
||||
|
||||
class lesscNormalized extends lessc {
|
||||
public $numberPrecision = 3;
|
||||
public $numberPrecision = 3;
|
||||
|
||||
public function compileValue($value) {
|
||||
if ($value[0] == "raw_color") {
|
||||
$value = $this->coerceColor($value);
|
||||
}
|
||||
public function compileValue($value) {
|
||||
if ($value[0] === "raw_color") {
|
||||
$value = $this->coerceColor($value);
|
||||
}
|
||||
|
||||
return parent::compileValue($value);
|
||||
}
|
||||
return parent::compileValue($value);
|
||||
}
|
||||
}
|
||||
|
||||
class SortingFormatter extends lessc_formatter_lessjs {
|
||||
function sortKey($block) {
|
||||
if (!isset($block->sortKey)) {
|
||||
sort($block->selectors, SORT_STRING);
|
||||
$block->sortKey = implode(",", $block->selectors);
|
||||
}
|
||||
public function sortKey($block) {
|
||||
if (!isset($block->sortKey)) {
|
||||
sort($block->selectors, SORT_STRING);
|
||||
$block->sortKey = implode(",", $block->selectors);
|
||||
}
|
||||
|
||||
return $block->sortKey;
|
||||
}
|
||||
return $block->sortKey;
|
||||
}
|
||||
|
||||
function sortBlock($block) {
|
||||
usort($block->children, function($a, $b) {
|
||||
$sort = strcmp($this->sortKey($a), $this->sortKey($b));
|
||||
if ($sort == 0) {
|
||||
// TODO
|
||||
}
|
||||
return $sort;
|
||||
});
|
||||
public function sortBlock($block) {
|
||||
usort($block->children, function($a, $b) {
|
||||
$sort = strcmp($this->sortKey($a), $this->sortKey($b));
|
||||
if ($sort == 0) {
|
||||
// TODO
|
||||
}
|
||||
return $sort;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function block($block) {
|
||||
$this->sortBlock($block);
|
||||
return parent::block($block);
|
||||
}
|
||||
public function block($block) {
|
||||
$this->sortBlock($block);
|
||||
return parent::block($block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$less = new lesscNormalized();
|
||||
$less->setFormatter(new SortingFormatter);
|
||||
echo $less->parse(file_get_contents($fname));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue