1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the PHP Translation package. |
||
5 | * |
||
6 | * (c) PHP Translation team <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Translation\Bundle\Tests\Unit\Twig; |
||
13 | |||
14 | use PHPUnit\Framework\TestCase; |
||
0 ignored issues
–
show
|
|||
15 | use Symfony\Bridge\Twig\Extension\TranslationExtension as SymfonyTranslationExtension; |
||
16 | use Symfony\Component\Translation\IdentityTranslator; |
||
17 | use Translation\Bundle\Twig\TranslationExtension; |
||
18 | use Twig\Environment; |
||
19 | use Twig\Loader\ArrayLoader; |
||
20 | use Twig\Source; |
||
21 | |||
22 | /** |
||
23 | * @author Johannes M. Schmitt <[email protected]> |
||
24 | */ |
||
25 | abstract class BaseTwigTestCase extends TestCase |
||
26 | { |
||
27 | final protected function parse(string $file, bool $debug = false): string |
||
28 | { |
||
29 | $content = \file_get_contents(__DIR__.'/Fixture/'.$file); |
||
30 | |||
31 | $loader = \class_exists(ArrayLoader::class) |
||
32 | ? new ArrayLoader() |
||
33 | : new \Twig_Loader_Array([]); |
||
0 ignored issues
–
show
The type
Twig_Loader_Array was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
34 | $env = new Environment($loader); |
||
35 | $env->addExtension(new SymfonyTranslationExtension($translator = new IdentityTranslator())); |
||
36 | $env->addExtension(new TranslationExtension($translator, $debug)); |
||
37 | |||
38 | return (string) $env->parse($env->tokenize(new Source($content, '')))->getNode('body'); |
||
39 | } |
||
40 | } |
||
41 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths