Augmentation vers version 3.3.0

This commit is contained in:
Gauvain Boiché
2020-03-31 15:31:03 +02:00
parent d926806907
commit a1864c0414
2618 changed files with 406015 additions and 31377 deletions

View File

@@ -28,18 +28,18 @@ class TranslationNodeVisitor extends AbstractNodeVisitor
const UNDEFINED_DOMAIN = '_undefined';
private $enabled = false;
private $messages = array();
private $messages = [];
public function enable()
{
$this->enabled = true;
$this->messages = array();
$this->messages = [];
}
public function disable()
{
$this->enabled = false;
$this->messages = array();
$this->messages = [];
}
public function getMessages()
@@ -62,26 +62,26 @@ class TranslationNodeVisitor extends AbstractNodeVisitor
$node->getNode('node') instanceof ConstantExpression
) {
// extract constant nodes with a trans filter
$this->messages[] = array(
$this->messages[] = [
$node->getNode('node')->getAttribute('value'),
$this->getReadDomainFromArguments($node->getNode('arguments'), 1),
);
];
} elseif (
$node instanceof FilterExpression &&
'transchoice' === $node->getNode('filter')->getAttribute('value') &&
$node->getNode('node') instanceof ConstantExpression
) {
// extract constant nodes with a trans filter
$this->messages[] = array(
$this->messages[] = [
$node->getNode('node')->getAttribute('value'),
$this->getReadDomainFromArguments($node->getNode('arguments'), 2),
);
];
} elseif ($node instanceof TransNode) {
// extract trans nodes
$this->messages[] = array(
$this->messages[] = [
$node->getNode('body')->getAttribute('data'),
$node->hasNode('domain') ? $this->getReadDomainFromNode($node->getNode('domain')) : null,
);
];
}
return $node;
@@ -97,6 +97,8 @@ class TranslationNodeVisitor extends AbstractNodeVisitor
/**
* {@inheritdoc}
*
* @return int
*/
public function getPriority()
{
@@ -104,8 +106,7 @@ class TranslationNodeVisitor extends AbstractNodeVisitor
}
/**
* @param Node $arguments
* @param int $index
* @param int $index
*
* @return string|null
*/
@@ -116,7 +117,7 @@ class TranslationNodeVisitor extends AbstractNodeVisitor
} elseif ($arguments->hasNode($index)) {
$argument = $arguments->getNode($index);
} else {
return;
return null;
}
return $this->getReadDomainFromNode($argument);