|
@@ 172-186 (lines=15) @@
|
| 169 |
|
} |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
if (!$node->args[0]->value instanceof String_) { |
| 173 |
|
if ($ignore) { |
| 174 |
|
return; |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
$message = sprintf('Can only extract the translation id from a scalar string, but got "%s". Please refactor your code to make it extractable, or add the doc comment /** @Ignore */ to this code element (in %s on line %d).', get_class($node->args[0]->value), $this->file, $node->args[0]->value->getLine()); |
| 178 |
|
|
| 179 |
|
if ($this->logger) { |
| 180 |
|
$this->logger->error($message); |
| 181 |
|
|
| 182 |
|
return; |
| 183 |
|
} |
| 184 |
|
|
| 185 |
|
throw new RuntimeException($message); |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
$id = $node->args[0]->value->value; |
| 189 |
|
if (in_array(strtolower($node->name), ['_n', '_fn'], true)) { |
|
@@ 198-212 (lines=15) @@
|
| 195 |
|
$domainIndex = array_search(strtolower($node->name), $this->methodNames); |
| 196 |
|
|
| 197 |
|
if (isset($node->args[$domainIndex])) { |
| 198 |
|
if (!$node->args[$domainIndex]->value instanceof String_) { |
| 199 |
|
if ($ignore) { |
| 200 |
|
return; |
| 201 |
|
} |
| 202 |
|
|
| 203 |
|
$message = sprintf('Can only extract the translation domain from a scalar string, but got "%s". Please refactor your code to make it extractable, or add the doc comment /** @Ignore */ to this code element (in %s on line %d).', get_class($node->args[0]->value), $this->file, $node->args[0]->value->getLine()); |
| 204 |
|
|
| 205 |
|
if ($this->logger) { |
| 206 |
|
$this->logger->error($message); |
| 207 |
|
|
| 208 |
|
return; |
| 209 |
|
} |
| 210 |
|
|
| 211 |
|
throw new RuntimeException($message); |
| 212 |
|
} |
| 213 |
|
|
| 214 |
|
$domain = $node->args[$domainIndex]->value->value; |
| 215 |
|
} else { |