mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
migration symfony 5 4 (#300)
* symfony 5.4 (diff dev) * symfony 5.4 (working) * symfony 5.4 (update autoload) * symfony 5.4 (remove swiftmailer mailer implementation) * symfony 5.4 (php doc and split Global accessor class) ### Impacted packages: composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
@@ -29,7 +29,7 @@ class PseudoClassExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPseudoClassTranslators()
|
||||
public function getPseudoClassTranslators(): array
|
||||
{
|
||||
return [
|
||||
'root' => [$this, 'translateRoot'],
|
||||
@@ -43,18 +43,12 @@ class PseudoClassExtension extends AbstractExtension
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateRoot(XPathExpr $xpath)
|
||||
public function translateRoot(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition('not(parent::*)');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateFirstChild(XPathExpr $xpath)
|
||||
public function translateFirstChild(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath
|
||||
->addStarPrefix()
|
||||
@@ -62,10 +56,7 @@ class PseudoClassExtension extends AbstractExtension
|
||||
->addCondition('position() = 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateLastChild(XPathExpr $xpath)
|
||||
public function translateLastChild(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath
|
||||
->addStarPrefix()
|
||||
@@ -74,11 +65,9 @@ class PseudoClassExtension extends AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function translateFirstOfType(XPathExpr $xpath)
|
||||
public function translateFirstOfType(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
if ('*' === $xpath->getElement()) {
|
||||
throw new ExpressionErrorException('"*:first-of-type" is not implemented.');
|
||||
@@ -90,11 +79,9 @@ class PseudoClassExtension extends AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function translateLastOfType(XPathExpr $xpath)
|
||||
public function translateLastOfType(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
if ('*' === $xpath->getElement()) {
|
||||
throw new ExpressionErrorException('"*:last-of-type" is not implemented.');
|
||||
@@ -105,10 +92,7 @@ class PseudoClassExtension extends AbstractExtension
|
||||
->addCondition('position() = last()');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateOnlyChild(XPathExpr $xpath)
|
||||
public function translateOnlyChild(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath
|
||||
->addStarPrefix()
|
||||
@@ -116,26 +100,14 @@ class PseudoClassExtension extends AbstractExtension
|
||||
->addCondition('last() = 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function translateOnlyOfType(XPathExpr $xpath)
|
||||
public function translateOnlyOfType(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
$element = $xpath->getElement();
|
||||
|
||||
if ('*' === $element) {
|
||||
throw new ExpressionErrorException('"*:only-of-type" is not implemented.');
|
||||
}
|
||||
|
||||
return $xpath->addCondition(sprintf('count(preceding-sibling::%s)=0 and count(following-sibling::%s)=0', $element, $element));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateEmpty(XPathExpr $xpath)
|
||||
public function translateEmpty(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition('not(*) and not(string-length())');
|
||||
}
|
||||
@@ -143,7 +115,7 @@ class PseudoClassExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'pseudo-class';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user