MDL-81660 core: Bump php-css-parser to 8.7.0

This commit is contained in:
Andrew Nicols
2025-03-13 09:53:02 +08:00
parent 2f82f5fe8c
commit e60e923b83
39 changed files with 1573 additions and 156 deletions
@@ -2,6 +2,7 @@
namespace Sabberworm\CSS;
use Sabberworm\CSS\Comment\Commentable;
use Sabberworm\CSS\Parsing\OutputException;
class OutputFormatter
@@ -211,6 +212,29 @@ class OutputFormatter
return implode(';', $sString);
}
/**
*
* @param array<Commentable> $aComments
*
* @return string
*/
public function comments(Commentable $oCommentable)
{
if (!$this->oFormat->bRenderComments) {
return '';
}
$sResult = '';
$aComments = $oCommentable->getComments();
$iLastCommentIndex = count($aComments) - 1;
foreach ($aComments as $i => $oComment) {
$sResult .= $oComment->render($this->oFormat);
$sResult .= $i === $iLastCommentIndex ? $this->spaceAfterBlocks() : $this->spaceBetweenBlocks();
}
return $sResult;
}
/**
* @param string $sSpaceString
*