Dependency updates and update version number

This commit is contained in:
Kode
2018-06-13 19:35:28 +01:00
parent 18ec208381
commit e3ec7de23a
1261 changed files with 45582 additions and 29687 deletions

View File

@@ -31,7 +31,7 @@ abstract class AbstractNode implements NodeInterface
/**
* @return string
*/
public function getNodeName()
public function getNodeName(): string
{
if (null === $this->nodeName) {
$this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', get_called_class());

View File

@@ -29,14 +29,7 @@ class AttributeNode extends AbstractNode
private $operator;
private $value;
/**
* @param NodeInterface $selector
* @param string $namespace
* @param string $attribute
* @param string $operator
* @param string $value
*/
public function __construct(NodeInterface $selector, $namespace, $attribute, $operator, $value)
public function __construct(NodeInterface $selector, ?string $namespace, string $attribute, string $operator, ?string $value)
{
$this->selector = $selector;
$this->namespace = $namespace;
@@ -45,42 +38,27 @@ class AttributeNode extends AbstractNode
$this->value = $value;
}
/**
* @return NodeInterface
*/
public function getSelector()
public function getSelector(): NodeInterface
{
return $this->selector;
}
/**
* @return string
*/
public function getNamespace()
public function getNamespace(): ?string
{
return $this->namespace;
}
/**
* @return string
*/
public function getAttribute()
public function getAttribute(): string
{
return $this->attribute;
}
/**
* @return string
*/
public function getOperator()
public function getOperator(): string
{
return $this->operator;
}
/**
* @return string
*/
public function getValue()
public function getValue(): ?string
{
return $this->value;
}
@@ -88,7 +66,7 @@ class AttributeNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function getSpecificity()
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
}
@@ -96,7 +74,7 @@ class AttributeNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
$attribute = $this->namespace ? $this->namespace.'|'.$this->attribute : $this->attribute;

View File

@@ -26,28 +26,18 @@ class ClassNode extends AbstractNode
private $selector;
private $name;
/**
* @param NodeInterface $selector
* @param string $name
*/
public function __construct(NodeInterface $selector, $name)
public function __construct(NodeInterface $selector, string $name)
{
$this->selector = $selector;
$this->name = $name;
}
/**
* @return NodeInterface
*/
public function getSelector()
public function getSelector(): NodeInterface
{
return $this->selector;
}
/**
* @return string
*/
public function getName()
public function getName(): string
{
return $this->name;
}
@@ -55,7 +45,7 @@ class ClassNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function getSpecificity()
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
}
@@ -63,7 +53,7 @@ class ClassNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
return sprintf('%s[%s.%s]', $this->getNodeName(), $this->selector, $this->name);
}

View File

@@ -27,38 +27,24 @@ class CombinedSelectorNode extends AbstractNode
private $combinator;
private $subSelector;
/**
* @param NodeInterface $selector
* @param string $combinator
* @param NodeInterface $subSelector
*/
public function __construct(NodeInterface $selector, $combinator, NodeInterface $subSelector)
public function __construct(NodeInterface $selector, string $combinator, NodeInterface $subSelector)
{
$this->selector = $selector;
$this->combinator = $combinator;
$this->subSelector = $subSelector;
}
/**
* @return NodeInterface
*/
public function getSelector()
public function getSelector(): NodeInterface
{
return $this->selector;
}
/**
* @return string
*/
public function getCombinator()
public function getCombinator(): string
{
return $this->combinator;
}
/**
* @return NodeInterface
*/
public function getSubSelector()
public function getSubSelector(): NodeInterface
{
return $this->subSelector;
}
@@ -66,7 +52,7 @@ class CombinedSelectorNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function getSpecificity()
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
}
@@ -74,7 +60,7 @@ class CombinedSelectorNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
$combinator = ' ' === $this->combinator ? '<followed>' : $this->combinator;

View File

@@ -30,7 +30,7 @@ class ElementNode extends AbstractNode
* @param string|null $namespace
* @param string|null $element
*/
public function __construct($namespace = null, $element = null)
public function __construct(string $namespace = null, string $element = null)
{
$this->namespace = $namespace;
$this->element = $element;
@@ -55,7 +55,7 @@ class ElementNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function getSpecificity()
public function getSpecificity(): Specificity
{
return new Specificity(0, 0, $this->element ? 1 : 0);
}
@@ -63,7 +63,7 @@ class ElementNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
$element = $this->element ?: '*';

View File

@@ -34,25 +34,19 @@ class FunctionNode extends AbstractNode
* @param string $name
* @param Token[] $arguments
*/
public function __construct(NodeInterface $selector, $name, array $arguments = array())
public function __construct(NodeInterface $selector, string $name, array $arguments = array())
{
$this->selector = $selector;
$this->name = strtolower($name);
$this->arguments = $arguments;
}
/**
* @return NodeInterface
*/
public function getSelector()
public function getSelector(): NodeInterface
{
return $this->selector;
}
/**
* @return string
*/
public function getName()
public function getName(): string
{
return $this->name;
}
@@ -68,7 +62,7 @@ class FunctionNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function getSpecificity()
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
}
@@ -76,7 +70,7 @@ class FunctionNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
$arguments = implode(', ', array_map(function (Token $token) {
return "'".$token->getValue()."'";

View File

@@ -26,28 +26,18 @@ class HashNode extends AbstractNode
private $selector;
private $id;
/**
* @param NodeInterface $selector
* @param string $id
*/
public function __construct(NodeInterface $selector, $id)
public function __construct(NodeInterface $selector, string $id)
{
$this->selector = $selector;
$this->id = $id;
}
/**
* @return NodeInterface
*/
public function getSelector()
public function getSelector(): NodeInterface
{
return $this->selector;
}
/**
* @return string
*/
public function getId()
public function getId(): string
{
return $this->id;
}
@@ -55,7 +45,7 @@ class HashNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function getSpecificity()
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(1, 0, 0));
}
@@ -63,7 +53,7 @@ class HashNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
return sprintf('%s[%s#%s]', $this->getNodeName(), $this->selector, $this->id);
}

View File

@@ -51,7 +51,7 @@ class NegationNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function getSpecificity()
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
}
@@ -59,7 +59,7 @@ class NegationNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
return sprintf('%s[%s:not(%s)]', $this->getNodeName(), $this->selector, $this->subSelector);
}

View File

@@ -23,24 +23,9 @@ namespace Symfony\Component\CssSelector\Node;
*/
interface NodeInterface
{
/**
* Returns node's name.
*
* @return string
*/
public function getNodeName();
public function getNodeName(): string;
/**
* Returns node's specificity.
*
* @return Specificity
*/
public function getSpecificity();
public function getSpecificity(): Specificity;
/**
* Returns node's string representation.
*
* @return string
*/
public function __toString();
public function __toString(): string;
}

View File

@@ -26,28 +26,18 @@ class PseudoNode extends AbstractNode
private $selector;
private $identifier;
/**
* @param NodeInterface $selector
* @param string $identifier
*/
public function __construct(NodeInterface $selector, $identifier)
public function __construct(NodeInterface $selector, string $identifier)
{
$this->selector = $selector;
$this->identifier = strtolower($identifier);
}
/**
* @return NodeInterface
*/
public function getSelector()
public function getSelector(): NodeInterface
{
return $this->selector;
}
/**
* @return string
*/
public function getIdentifier()
public function getIdentifier(): string
{
return $this->identifier;
}
@@ -55,7 +45,7 @@ class PseudoNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function getSpecificity()
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
}
@@ -63,7 +53,7 @@ class PseudoNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
return sprintf('%s[%s:%s]', $this->getNodeName(), $this->selector, $this->identifier);
}

View File

@@ -26,28 +26,18 @@ class SelectorNode extends AbstractNode
private $tree;
private $pseudoElement;
/**
* @param NodeInterface $tree
* @param null|string $pseudoElement
*/
public function __construct(NodeInterface $tree, $pseudoElement = null)
public function __construct(NodeInterface $tree, string $pseudoElement = null)
{
$this->tree = $tree;
$this->pseudoElement = $pseudoElement ? strtolower($pseudoElement) : null;
}
/**
* @return NodeInterface
*/
public function getTree()
public function getTree(): NodeInterface
{
return $this->tree;
}
/**
* @return null|string
*/
public function getPseudoElement()
public function getPseudoElement(): ?string
{
return $this->pseudoElement;
}
@@ -55,7 +45,7 @@ class SelectorNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function getSpecificity()
public function getSpecificity(): Specificity
{
return $this->tree->getSpecificity()->plus(new Specificity(0, 0, $this->pseudoElement ? 1 : 0));
}
@@ -63,7 +53,7 @@ class SelectorNode extends AbstractNode
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
return sprintf('%s[%s%s]', $this->getNodeName(), $this->tree, $this->pseudoElement ? '::'.$this->pseudoElement : '');
}

View File

@@ -33,32 +33,19 @@ class Specificity
private $b;
private $c;
/**
* @param int $a
* @param int $b
* @param int $c
*/
public function __construct($a, $b, $c)
public function __construct(int $a, int $b, int $c)
{
$this->a = $a;
$this->b = $b;
$this->c = $c;
}
/**
* @return self
*/
public function plus(Specificity $specificity)
public function plus(self $specificity): self
{
return new self($this->a + $specificity->a, $this->b + $specificity->b, $this->c + $specificity->c);
}
/**
* Returns global specificity value.
*
* @return int
*/
public function getValue()
public function getValue(): int
{
return $this->a * self::A_FACTOR + $this->b * self::B_FACTOR + $this->c * self::C_FACTOR;
}
@@ -69,7 +56,7 @@ class Specificity
*
* @return int
*/
public function compareTo(Specificity $specificity)
public function compareTo(self $specificity)
{
if ($this->a !== $specificity->a) {
return $this->a > $specificity->a ? 1 : -1;