nicoSWD /
php-rule-parser
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | /** |
||
| 4 | * @license http://opensource.org/licenses/mit-license.php MIT |
||
| 5 | * @link https://github.com/nicoSWD |
||
| 6 | * @author Nicolas Oelgart <[email protected]> |
||
| 7 | */ |
||
| 8 | namespace nicoSWD\Rule; |
||
| 9 | |||
| 10 | use nicoSWD\Rule\Grammar\JavaScript\JavaScript; |
||
| 11 | use nicoSWD\Rule\TokenStream\AST; |
||
| 12 | use nicoSWD\Rule\Compiler\CompilerFactory; |
||
| 13 | use nicoSWD\Rule\Evaluator\Evaluator; |
||
| 14 | use nicoSWD\Rule\Evaluator\EvaluatorInterface; |
||
| 15 | use nicoSWD\Rule\Expression\ExpressionFactory; |
||
| 16 | use nicoSWD\Rule\Tokenizer\Tokenizer; |
||
| 17 | use nicoSWD\Rule\TokenStream\Token\TokenFactory; |
||
|
0 ignored issues
–
show
|
|||
| 18 | use nicoSWD\Rule\TokenStream\TokenStreamFactory; |
||
| 19 | use nicoSWD\Rule\TokenStream\CallableUserMethodFactory; |
||
| 20 | |||
| 21 | return new class { |
||
| 22 | private static TokenStreamFactory $tokenStreamFactory; |
||
| 23 | private static TokenFactory $tokenFactory; |
||
| 24 | private static CompilerFactory $compiler; |
||
| 25 | private static JavaScript $javaScript; |
||
| 26 | private static ExpressionFactory $expressionFactory; |
||
| 27 | private static CallableUserMethodFactory $userMethodFactory; |
||
| 28 | private static Tokenizer $tokenizer; |
||
| 29 | private static Evaluator $evaluator; |
||
| 30 | |||
| 31 | public function parser(array $variables): Parser\Parser |
||
|
0 ignored issues
–
show
The type
nicoSWD\Rule\Parser\Parser 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 Loading history...
|
|||
| 32 | { |
||
| 33 | return new Parser\Parser( |
||
| 34 | self::ast($variables), |
||
| 35 | self::expressionFactory(), |
||
| 36 | self::compiler() |
||
| 37 | ); |
||
| 38 | } |
||
| 39 | 280 | ||
| 40 | public function evaluator(): EvaluatorInterface |
||
| 41 | 280 | { |
|
| 42 | 280 | if (!isset(self::$evaluator)) { |
|
| 43 | 280 | self::$evaluator = new Evaluator(); |
|
| 44 | 280 | } |
|
| 45 | |||
| 46 | return self::$evaluator; |
||
| 47 | } |
||
| 48 | 212 | ||
| 49 | private static function tokenFactory(): TokenFactory |
||
| 50 | 212 | { |
|
| 51 | 2 | if (!isset(self::$tokenFactory)) { |
|
| 52 | self::$tokenFactory = new TokenFactory(); |
||
| 53 | } |
||
| 54 | 212 | ||
| 55 | return self::$tokenFactory; |
||
| 56 | } |
||
| 57 | 280 | ||
| 58 | private static function compiler(): CompilerFactory |
||
| 59 | 280 | { |
|
| 60 | 2 | if (!isset(self::$compiler)) { |
|
| 61 | self::$compiler = new CompilerFactory(); |
||
| 62 | } |
||
| 63 | 280 | ||
| 64 | return self::$compiler; |
||
| 65 | } |
||
| 66 | 280 | ||
| 67 | private static function ast(array $variables): AST |
||
| 68 | 280 | { |
|
| 69 | 2 | $ast = new AST(self::tokenizer(), self::tokenFactory(), self::tokenStreamFactory(), self::userMethodFactory()); |
|
| 70 | $ast->setVariables($variables); |
||
| 71 | |||
| 72 | 280 | return $ast; |
|
| 73 | } |
||
| 74 | |||
| 75 | 280 | private static function tokenizer(): Tokenizer |
|
| 76 | { |
||
| 77 | 280 | if (!isset(self::$tokenizer)) { |
|
| 78 | 280 | self::$tokenizer = new Tokenizer(self::javascript(), self::tokenFactory()); |
|
| 79 | } |
||
| 80 | 280 | ||
| 81 | return self::$tokenizer; |
||
| 82 | } |
||
| 83 | 280 | ||
| 84 | private static function javascript(): JavaScript |
||
| 85 | 280 | { |
|
| 86 | 2 | if (!isset(self::$javaScript)) { |
|
| 87 | self::$javaScript = new JavaScript(); |
||
| 88 | } |
||
| 89 | 280 | ||
| 90 | return self::$javaScript; |
||
| 91 | } |
||
| 92 | 2 | ||
| 93 | private static function tokenStreamFactory(): TokenStreamFactory |
||
| 94 | 2 | { |
|
| 95 | 2 | if (!isset(self::$tokenStreamFactory)) { |
|
| 96 | self::$tokenStreamFactory = new TokenStreamFactory(); |
||
| 97 | } |
||
| 98 | 2 | ||
| 99 | return self::$tokenStreamFactory; |
||
| 100 | } |
||
| 101 | 280 | ||
| 102 | private static function expressionFactory(): ExpressionFactory |
||
| 103 | 280 | { |
|
| 104 | 2 | if (!isset(self::$expressionFactory)) { |
|
| 105 | self::$expressionFactory = new ExpressionFactory(); |
||
| 106 | } |
||
| 107 | 280 | ||
| 108 | return self::$expressionFactory; |
||
| 109 | } |
||
| 110 | 280 | ||
| 111 | private static function userMethodFactory(): CallableUserMethodFactory |
||
| 112 | 280 | { |
|
| 113 | 2 | if (!isset(self::$userMethodFactory)) { |
|
| 114 | self::$userMethodFactory = new CallableUserMethodFactory(); |
||
| 115 | } |
||
| 116 | 280 | ||
| 117 | return self::$userMethodFactory; |
||
| 118 | } |
||
| 119 | }; |
||
| 120 |
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