railt /
sdl
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This file is part of Railt package. |
||
| 5 | * |
||
| 6 | * For the full copyright and license information, please view the LICENSE |
||
| 7 | * file that was distributed with this source code. |
||
| 8 | */ |
||
| 9 | |||
| 10 | declare(strict_types=1); |
||
| 11 | |||
| 12 | namespace Railt\SDL; |
||
| 13 | |||
| 14 | use GraphQL\Contracts\TypeSystem\SchemaInterface; |
||
| 15 | use Phplrt\Visitor\Traverser; |
||
| 16 | use Phplrt\Visitor\TraverserInterface; |
||
| 17 | use Railt\SDL\Backend\ContextInterface; |
||
| 18 | use Railt\SDL\Backend\HashTable\VariablesVisitor; |
||
| 19 | use Railt\SDL\Backend\HashTableInterface; |
||
| 20 | use Railt\SDL\Backend\Linker\LinkerVisitor; |
||
|
0 ignored issues
–
show
|
|||
| 21 | use Railt\SDL\Backend\SymbolTableBuilderVisitor; |
||
| 22 | use Railt\SDL\Frontend\Ast\Node; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Class Backend |
||
| 26 | */ |
||
| 27 | class Backend |
||
| 28 | { |
||
| 29 | /** |
||
| 30 | * @var Compiler |
||
| 31 | */ |
||
| 32 | private Compiler $compiler; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var TraverserInterface |
||
| 36 | */ |
||
| 37 | private TraverserInterface $traverser; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var ContextInterface |
||
| 41 | */ |
||
| 42 | private ContextInterface $ctx; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Backend constructor. |
||
| 46 | * |
||
| 47 | * @param Compiler $compiler |
||
| 48 | * @param ContextInterface $ctx |
||
| 49 | */ |
||
| 50 | public function __construct(Compiler $compiler, ContextInterface $ctx) |
||
| 51 | { |
||
| 52 | $this->ctx = $ctx; |
||
| 53 | $this->compiler = $compiler; |
||
| 54 | |||
| 55 | $this->traverser = new Traverser([ |
||
| 56 | $compiler->getSpecification(), |
||
| 57 | new SymbolTableBuilderVisitor($ctx), |
||
| 58 | ]); |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @param iterable|Node[] $ast |
||
| 63 | * @param HashTableInterface $vars |
||
| 64 | * @return SchemaInterface |
||
| 65 | * @throws \Throwable |
||
| 66 | */ |
||
| 67 | public function run(iterable $ast, HashTableInterface $vars): SchemaInterface |
||
| 68 | { |
||
| 69 | // Precompile |
||
| 70 | $ast = $this->precompile($ast, $vars); |
||
| 71 | |||
| 72 | // Link types |
||
| 73 | $ast = $this->linker($ast); |
||
| 74 | |||
| 75 | return $this->ctx->getSchema(); |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @param iterable $ast |
||
| 80 | * @param HashTableInterface $vars |
||
| 81 | * @return iterable |
||
| 82 | */ |
||
| 83 | private function precompile(iterable $ast, HashTableInterface $vars): iterable |
||
| 84 | { |
||
| 85 | return (clone $this->traverser) |
||
| 86 | ->with(new VariablesVisitor($vars)) |
||
| 87 | ->traverse($ast); |
||
| 88 | } |
||
| 89 | |||
| 90 | /** |
||
| 91 | * @param iterable $ast |
||
| 92 | * @return iterable |
||
| 93 | */ |
||
| 94 | private function linker(iterable $ast): iterable |
||
| 95 | { |
||
| 96 | $traverser = new Traverser([ |
||
| 97 | new LinkerVisitor($this->ctx, $this->compiler->getLinker()), |
||
| 98 | ]); |
||
| 99 | |||
| 100 | return $traverser->traverse($ast); |
||
| 101 | } |
||
| 102 | } |
||
| 103 |
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