mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 19:48:49 +02:00
Re-dump autoloader and composer.lock
This commit is contained in:
@@ -50,6 +50,8 @@ class AtRuleBlockList extends CSSBlockList implements AtRule
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
@@ -57,17 +59,20 @@ class AtRuleBlockList extends CSSBlockList implements AtRule
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OutputFormat|null $oOutputFormat
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render(OutputFormat $oOutputFormat)
|
||||
public function render($oOutputFormat)
|
||||
{
|
||||
$sResult = $oOutputFormat->comments($this);
|
||||
$sResult .= $oOutputFormat->sBeforeAtRuleBlock;
|
||||
$sArgs = $this->sArgs;
|
||||
if ($sArgs) {
|
||||
$sArgs = ' ' . $sArgs;
|
||||
}
|
||||
$sResult = $oOutputFormat->sBeforeAtRuleBlock;
|
||||
$sResult .= "@{$this->sType}$sArgs{$oOutputFormat->spaceBeforeOpeningBrace()}{";
|
||||
$sResult .= parent::render($oOutputFormat);
|
||||
$sResult .= $this->renderListContents($oOutputFormat);
|
||||
$sResult .= '}';
|
||||
$sResult .= $oOutputFormat->sAfterAtRuleBlock;
|
||||
return $sResult;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Sabberworm\CSS\CSSList;
|
||||
|
||||
use Sabberworm\CSS\CSSElement;
|
||||
use Sabberworm\CSS\Property\Selector;
|
||||
use Sabberworm\CSS\Rule\Rule;
|
||||
use Sabberworm\CSS\RuleSet\DeclarationBlock;
|
||||
@@ -59,7 +60,53 @@ abstract class CSSBlockList extends CSSList
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CSSList|Rule|RuleSet|Value $oElement
|
||||
* Returns all `Value` objects found recursively in `Rule`s in the tree.
|
||||
*
|
||||
* @param CSSElement|string|null $element
|
||||
* This is the `CSSList` or `RuleSet` to start the search from (defaults to the whole document).
|
||||
* If a string is given, it is used as a rule name filter.
|
||||
* Passing a string for this parameter is deprecated in version 8.9.0, and will not work from v9.0;
|
||||
* use the following parameter to pass a rule name filter instead.
|
||||
* @param string|bool|null $ruleSearchPatternOrSearchInFunctionArguments
|
||||
* This allows filtering rules by property name
|
||||
* (e.g. if "color" is passed, only `Value`s from `color` properties will be returned,
|
||||
* or if "font-" is provided, `Value`s from all font rules, like `font-size`, and including `font` itself,
|
||||
* will be returned).
|
||||
* If a Boolean is provided, it is treated as the `$searchInFunctionArguments` argument.
|
||||
* Passing a Boolean for this parameter is deprecated in version 8.9.0, and will not work from v9.0;
|
||||
* use the `$searchInFunctionArguments` parameter instead.
|
||||
* @param bool $searchInFunctionArguments whether to also return Value objects used as Function arguments.
|
||||
*
|
||||
* @return array<int, Value>
|
||||
*
|
||||
* @see RuleSet->getRules()
|
||||
*/
|
||||
public function getAllValues(
|
||||
$element = null,
|
||||
$ruleSearchPatternOrSearchInFunctionArguments = null,
|
||||
$searchInFunctionArguments = false
|
||||
) {
|
||||
if (\is_bool($ruleSearchPatternOrSearchInFunctionArguments)) {
|
||||
$searchInFunctionArguments = $ruleSearchPatternOrSearchInFunctionArguments;
|
||||
$searchString = null;
|
||||
} else {
|
||||
$searchString = $ruleSearchPatternOrSearchInFunctionArguments;
|
||||
}
|
||||
|
||||
if ($element === null) {
|
||||
$element = $this;
|
||||
} elseif (\is_string($element)) {
|
||||
$searchString = $element;
|
||||
$element = $this;
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$this->allValues($element, $result, $searchString, $searchInFunctionArguments);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CSSElement|string $oElement
|
||||
* @param array<int, Value> $aResult
|
||||
* @param string|null $sSearchString
|
||||
* @param bool $bSearchInFunctionArguments
|
||||
|
||||
@@ -4,11 +4,14 @@ namespace Sabberworm\CSS\CSSList;
|
||||
|
||||
use Sabberworm\CSS\Comment\Comment;
|
||||
use Sabberworm\CSS\Comment\Commentable;
|
||||
use Sabberworm\CSS\CSSElement;
|
||||
use Sabberworm\CSS\OutputFormat;
|
||||
use Sabberworm\CSS\Parsing\ParserState;
|
||||
use Sabberworm\CSS\Parsing\SourceException;
|
||||
use Sabberworm\CSS\Parsing\UnexpectedEOFException;
|
||||
use Sabberworm\CSS\Parsing\UnexpectedTokenException;
|
||||
use Sabberworm\CSS\Position\Position;
|
||||
use Sabberworm\CSS\Position\Positionable;
|
||||
use Sabberworm\CSS\Property\AtRule;
|
||||
use Sabberworm\CSS\Property\Charset;
|
||||
use Sabberworm\CSS\Property\CSSNamespace;
|
||||
@@ -24,28 +27,29 @@ use Sabberworm\CSS\Value\URL;
|
||||
use Sabberworm\CSS\Value\Value;
|
||||
|
||||
/**
|
||||
* A `CSSList` is the most generic container available. Its contents include `RuleSet` as well as other `CSSList`
|
||||
* objects.
|
||||
* This is the most generic container available. It can contain `DeclarationBlock`s (rule sets with a selector),
|
||||
* `RuleSet`s as well as other `CSSList` objects.
|
||||
*
|
||||
* Also, it may contain `Import` and `Charset` objects stemming from at-rules.
|
||||
* It can also contain `Import` and `Charset` objects stemming from at-rules.
|
||||
*/
|
||||
abstract class CSSList implements Renderable, Commentable
|
||||
abstract class CSSList implements Commentable, CSSElement, Positionable
|
||||
{
|
||||
use Position;
|
||||
|
||||
/**
|
||||
* @var array<array-key, Comment>
|
||||
*
|
||||
* @internal since 8.8.0
|
||||
*/
|
||||
protected $aComments;
|
||||
|
||||
/**
|
||||
* @var array<int, RuleSet|CSSList|Import|Charset>
|
||||
*
|
||||
* @internal since 8.8.0
|
||||
*/
|
||||
protected $aContents;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $iLineNo;
|
||||
|
||||
/**
|
||||
* @param int $iLineNo
|
||||
*/
|
||||
@@ -53,7 +57,7 @@ abstract class CSSList implements Renderable, Commentable
|
||||
{
|
||||
$this->aComments = [];
|
||||
$this->aContents = [];
|
||||
$this->iLineNo = $iLineNo;
|
||||
$this->setPosition($iLineNo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,6 +65,8 @@ abstract class CSSList implements Renderable, Commentable
|
||||
*
|
||||
* @throws UnexpectedTokenException
|
||||
* @throws SourceException
|
||||
*
|
||||
* @internal since V8.8.0
|
||||
*/
|
||||
public static function parseList(ParserState $oParserState, CSSList $oList)
|
||||
{
|
||||
@@ -69,8 +75,9 @@ abstract class CSSList implements Renderable, Commentable
|
||||
$oParserState = new ParserState($oParserState, Settings::create());
|
||||
}
|
||||
$bLenientParsing = $oParserState->getSettings()->bLenientParsing;
|
||||
$aComments = [];
|
||||
while (!$oParserState->isEnd()) {
|
||||
$comments = $oParserState->consumeWhiteSpace();
|
||||
$aComments = array_merge($aComments, $oParserState->consumeWhiteSpace());
|
||||
$oListItem = null;
|
||||
if ($bLenientParsing) {
|
||||
try {
|
||||
@@ -86,11 +93,12 @@ abstract class CSSList implements Renderable, Commentable
|
||||
return;
|
||||
}
|
||||
if ($oListItem) {
|
||||
$oListItem->setComments($comments);
|
||||
$oListItem->addComments($aComments);
|
||||
$oList->append($oListItem);
|
||||
}
|
||||
$oParserState->consumeWhiteSpace();
|
||||
$aComments = $oParserState->consumeWhiteSpace();
|
||||
}
|
||||
$oList->addComments($aComments);
|
||||
if (!$bIsRoot && !$bLenientParsing) {
|
||||
throw new SourceException("Unexpected end of document", $oParserState->currentLine());
|
||||
}
|
||||
@@ -125,22 +133,19 @@ abstract class CSSList implements Renderable, Commentable
|
||||
$oParserState->currentLine()
|
||||
);
|
||||
}
|
||||
$oParserState->setCharset($oAtRule->getCharset()->getString());
|
||||
$oParserState->setCharset($oAtRule->getCharset());
|
||||
}
|
||||
return $oAtRule;
|
||||
} elseif ($oParserState->comes('}')) {
|
||||
if (!$oParserState->getSettings()->bLenientParsing) {
|
||||
throw new UnexpectedTokenException('CSS selector', '}', 'identifier', $oParserState->currentLine());
|
||||
} else {
|
||||
if ($bIsRoot) {
|
||||
if ($oParserState->getSettings()->bLenientParsing) {
|
||||
return DeclarationBlock::parse($oParserState);
|
||||
} else {
|
||||
throw new SourceException("Unopened {", $oParserState->currentLine());
|
||||
}
|
||||
if ($bIsRoot) {
|
||||
if ($oParserState->getSettings()->bLenientParsing) {
|
||||
return DeclarationBlock::parse($oParserState);
|
||||
} else {
|
||||
return null;
|
||||
throw new SourceException("Unopened {", $oParserState->currentLine());
|
||||
}
|
||||
} else {
|
||||
// End of list
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return DeclarationBlock::parse($oParserState, $oList);
|
||||
@@ -172,10 +177,10 @@ abstract class CSSList implements Renderable, Commentable
|
||||
$oParserState->consumeUntil([';', ParserState::EOF], true, true);
|
||||
return new Import($oLocation, $sMediaQuery ?: null, $iIdentifierLineNum);
|
||||
} elseif ($sIdentifier === 'charset') {
|
||||
$sCharset = CSSString::parse($oParserState);
|
||||
$oCharsetString = CSSString::parse($oParserState);
|
||||
$oParserState->consumeWhiteSpace();
|
||||
$oParserState->consumeUntil([';', ParserState::EOF], true, true);
|
||||
return new Charset($sCharset, $iIdentifierLineNum);
|
||||
return new Charset($oCharsetString, $iIdentifierLineNum);
|
||||
} elseif (self::identifierIs($sIdentifier, 'keyframes')) {
|
||||
$oResult = new KeyFrame($iIdentifierLineNum);
|
||||
$oResult->setVendorKeyFrame($sIdentifier);
|
||||
@@ -251,14 +256,6 @@ abstract class CSSList implements Renderable, Commentable
|
||||
?: preg_match("/^(-\\w+-)?$sMatch$/i", $sIdentifier) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLineNo()
|
||||
{
|
||||
return $this->iLineNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepends an item to the list of contents.
|
||||
*
|
||||
@@ -272,7 +269,7 @@ abstract class CSSList implements Renderable, Commentable
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an item to tje list of contents.
|
||||
* Appends an item to the list of contents.
|
||||
*
|
||||
* @param RuleSet|CSSList|Import|Charset $oItem
|
||||
*
|
||||
@@ -297,6 +294,22 @@ abstract class CSSList implements Renderable, Commentable
|
||||
array_splice($this->aContents, $iOffset, $iLength, $mReplacement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an item in the CSS list before its sibling. If the desired sibling cannot be found,
|
||||
* the item is appended at the end.
|
||||
*
|
||||
* @param RuleSet|CSSList|Import|Charset $item
|
||||
* @param RuleSet|CSSList|Import|Charset $sibling
|
||||
*/
|
||||
public function insertBefore($item, $sibling)
|
||||
{
|
||||
if (in_array($sibling, $this->aContents, true)) {
|
||||
$this->replace($sibling, [$item, $sibling]);
|
||||
} else {
|
||||
$this->append($item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an item from the CSS list.
|
||||
*
|
||||
@@ -393,6 +406,8 @@ abstract class CSSList implements Renderable, Commentable
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
@@ -402,7 +417,7 @@ abstract class CSSList implements Renderable, Commentable
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render(OutputFormat $oOutputFormat)
|
||||
protected function renderListContents(OutputFormat $oOutputFormat)
|
||||
{
|
||||
$sResult = '';
|
||||
$bIsFirst = true;
|
||||
@@ -442,6 +457,8 @@ abstract class CSSList implements Renderable, Commentable
|
||||
abstract public function isRootList();
|
||||
|
||||
/**
|
||||
* Returns the stored items.
|
||||
*
|
||||
* @return array<int, RuleSet|Import|Charset|CSSList>
|
||||
*/
|
||||
public function getContents()
|
||||
|
||||
@@ -8,11 +8,10 @@ use Sabberworm\CSS\Parsing\SourceException;
|
||||
use Sabberworm\CSS\Property\Selector;
|
||||
use Sabberworm\CSS\RuleSet\DeclarationBlock;
|
||||
use Sabberworm\CSS\RuleSet\RuleSet;
|
||||
use Sabberworm\CSS\Value\Value;
|
||||
|
||||
/**
|
||||
* The root `CSSList` of a parsed file. Contains all top-level CSS contents, mostly declaration blocks,
|
||||
* but also any at-rules encountered.
|
||||
* This class represents the root of a parsed CSS file. It contains all top-level CSS contents: mostly declaration
|
||||
* blocks, but also any at-rules encountered (`Import` and `Charset`).
|
||||
*/
|
||||
class Document extends CSSBlockList
|
||||
{
|
||||
@@ -28,6 +27,8 @@ class Document extends CSSBlockList
|
||||
* @return Document
|
||||
*
|
||||
* @throws SourceException
|
||||
*
|
||||
* @internal since V8.8.0
|
||||
*/
|
||||
public static function parse(ParserState $oParserState)
|
||||
{
|
||||
@@ -37,7 +38,8 @@ class Document extends CSSBlockList
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all `DeclarationBlock` objects recursively.
|
||||
* Gets all `DeclarationBlock` objects recursively, no matter how deeply nested the selectors are.
|
||||
* Aliased as `getAllSelectors()`.
|
||||
*
|
||||
* @return array<int, DeclarationBlock>
|
||||
*/
|
||||
@@ -62,7 +64,7 @@ class Document extends CSSBlockList
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all `RuleSet` objects found recursively in the tree.
|
||||
* Returns all `RuleSet` objects recursively found in the tree, no matter how deeply nested the rule sets are.
|
||||
*
|
||||
* @return array<int, RuleSet>
|
||||
*/
|
||||
@@ -75,34 +77,7 @@ class Document extends CSSBlockList
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all `Value` objects found recursively in the tree.
|
||||
*
|
||||
* @param CSSList|RuleSet|string $mElement
|
||||
* the `CSSList` or `RuleSet` to start the search from (defaults to the whole document).
|
||||
* If a string is given, it is used as rule name filter.
|
||||
* @param bool $bSearchInFunctionArguments whether to also return Value objects used as Function arguments.
|
||||
*
|
||||
* @return array<int, Value>
|
||||
*
|
||||
* @see RuleSet->getRules()
|
||||
*/
|
||||
public function getAllValues($mElement = null, $bSearchInFunctionArguments = false)
|
||||
{
|
||||
$sSearchString = null;
|
||||
if ($mElement === null) {
|
||||
$mElement = $this;
|
||||
} elseif (is_string($mElement)) {
|
||||
$sSearchString = $mElement;
|
||||
$mElement = $this;
|
||||
}
|
||||
/** @var array<int, Value> $aResult */
|
||||
$aResult = [];
|
||||
$this->allValues($mElement, $aResult, $sSearchString, $bSearchInFunctionArguments);
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all `Selector` objects found recursively in the tree.
|
||||
* Returns all `Selector` objects with the requested specificity found recursively in the tree.
|
||||
*
|
||||
* Note that this does not yield the full `DeclarationBlock` that the selector belongs to
|
||||
* (and, currently, there is no way to get to that).
|
||||
@@ -127,6 +102,8 @@ class Document extends CSSBlockList
|
||||
* Expands all shorthand properties to their long value.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511
|
||||
*/
|
||||
public function expandShorthands()
|
||||
{
|
||||
@@ -139,6 +116,8 @@ class Document extends CSSBlockList
|
||||
* Create shorthands properties whenever possible.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511
|
||||
*/
|
||||
public function createShorthands()
|
||||
{
|
||||
@@ -154,12 +133,12 @@ class Document extends CSSBlockList
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render(OutputFormat $oOutputFormat = null)
|
||||
public function render($oOutputFormat = null)
|
||||
{
|
||||
if ($oOutputFormat === null) {
|
||||
$oOutputFormat = new OutputFormat();
|
||||
}
|
||||
return parent::render($oOutputFormat);
|
||||
return $oOutputFormat->comments($this) . $this->renderListContents($oOutputFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,6 +61,8 @@ class KeyFrame extends CSSList implements AtRule
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
@@ -68,12 +70,15 @@ class KeyFrame extends CSSList implements AtRule
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OutputFormat|null $oOutputFormat
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render(OutputFormat $oOutputFormat)
|
||||
public function render($oOutputFormat)
|
||||
{
|
||||
$sResult = "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{";
|
||||
$sResult .= parent::render($oOutputFormat);
|
||||
$sResult = $oOutputFormat->comments($this);
|
||||
$sResult .= "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{";
|
||||
$sResult .= $this->renderListContents($oOutputFormat);
|
||||
$sResult .= '}';
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user