| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Doctrine\ORM\Query\AST\Functions\FunctionNode; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Doctrine\ORM\Query\AST\Node; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Doctrine\ORM\Query\Lexer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Doctrine\ORM\Query\Parser; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Doctrine\ORM\Query\SqlWalker; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Doctrine\ORM\Query\TokenType; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use MartinGeorgiev\Utils\DoctrineOrm; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * @since 0.1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * @author Martin Georgiev <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | abstract class BaseFunction extends FunctionNode | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     protected string $functionPrototype; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      * @var list<string> | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     protected array $nodesMapping = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      * @var list<Node|null> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     protected array $nodes = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      * This method is meant for internal use only, and it is not suggested that the forks of the library depend on it. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      * It will be made abstract from version 3.0. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * @see customiseFunction() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     /* abstract */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     protected function customizeFunction(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         // Void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     protected function customiseFunction(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         \trigger_error('The internal-use method of `customiseFunction()` is deprecated and is now renamed to `customizeFunction()`. `customiseFunction()` will be removed from version 3.0 onwards.', E_USER_DEPRECATED); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         $this->customizeFunction(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 | 306 |  |     protected function setFunctionPrototype(string $functionPrototype): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 | 306 |  |         $this->functionPrototype = $functionPrototype; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 | 175 |  |     protected function addNodeMapping(string $parserMethod): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 | 175 |  |         $this->nodesMapping[] = $parserMethod; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 299 |  |     public function parse(Parser $parser): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 299 |  |         $shouldUseLexer = DoctrineOrm::isPre219(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 | 299 |  |         $this->customizeFunction(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 | 299 |  |         $parser->match($shouldUseLexer ? Lexer::T_IDENTIFIER : TokenType::T_IDENTIFIER); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 | 299 |  |         $parser->match($shouldUseLexer ? Lexer::T_OPEN_PARENTHESIS : TokenType::T_OPEN_PARENTHESIS); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 | 299 |  |         $this->feedParserWithNodes($parser); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 | 226 |  |         $parser->match($shouldUseLexer ? Lexer::T_CLOSE_PARENTHESIS : TokenType::T_CLOSE_PARENTHESIS); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |      * Feeds given parser with previously set nodes. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 81 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 82 | 172 |  |     protected function feedParserWithNodes(Parser $parser): void | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 84 | 172 |  |         $nodesMappingCount = \count($this->nodesMapping); | 
            
                                                                        
                            
            
                                    
            
            
                | 85 | 172 |  |         $lastNode = $nodesMappingCount - 1; | 
            
                                                                        
                            
            
                                    
            
            
                | 86 | 172 |  |         for ($i = 0; $i < $nodesMappingCount; $i++) { | 
            
                                                                        
                            
            
                                    
            
            
                | 87 | 170 |  |             $parserMethod = $this->nodesMapping[$i]; | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  |             // @phpstan-ignore-next-line | 
            
                                                                        
                            
            
                                    
            
            
                | 89 | 170 |  |             $this->nodes[$i] = $parser->{$parserMethod}(); | 
            
                                                                        
                            
            
                                    
            
            
                | 90 | 170 |  |             if ($i < $lastNode) { | 
            
                                                                        
                            
            
                                    
            
            
                | 91 | 115 |  |                 $parser->match(\class_exists(TokenType::class) ? TokenType::T_COMMA : Lexer::T_COMMA); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 | 173 |  |     public function getSql(SqlWalker $sqlWalker): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 | 173 |  |         $dispatched = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 | 173 |  |         foreach ($this->nodes as $node) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 | 171 |  |             $dispatched[] = $node instanceof Node ? $node->dispatch($sqlWalker) : 'null'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 | 173 |  |         return \vsprintf($this->functionPrototype, $dispatched); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 105 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 106 |  |  |  | 
            
                        
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