| 1 |  |  | <?php declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * @copyright Zicht Online <https://zicht.nl> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | namespace Zicht\Bundle\FrameworkExtraBundle\Command; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Monolog\Handler\FilterHandler; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Monolog\Handler\StreamHandler; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Monolog\Logger; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Psr\Log\LoggerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Symfony\Component\Console\Output\OutputInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | trait CreateStdLoggerTrait | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      * Returns a logger configured to use STDOUT and STDERR depending on $input and $output settings | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |      * Use this method to construct a logger that sends log messages to stdout or stderr.  This | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |      * is especially useful for commands that are executed using crontab in combination with the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |      * linux tool cronic. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      * Usage: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |      * ```php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      * class ExampleCommand extends AbstractCommand | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |      * { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      *     use CreateStdLoggerTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      *     protected function execute(InputInterface $input, OutputInterface $output) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      *     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      *         $logger = $this->createStdLogger($output, 'console'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      *         $logger->debug(...);      // logs to stdout when -v or --verbose | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      *         $logger->info(...);       // logs to stdout | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      *         $logger->notice(...);     // logs to stdout | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      *         $logger->warning(...);    // logs to stdout | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      *         $logger->error(...);      // logs to stderr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      *         $logger->critical(...);   // logs to stderr even when -q (quiet) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      *         $logger->alert(...);      // logs to stderr even when -q (quiet) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      *         $logger->emergency(...);  // logs to stderr even when -q (quiet) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      *     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      * } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * ``` | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 43 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |     protected function createStdLogger(OutputInterface $output, string $name): LoggerInterface | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |         $levelMap = [ | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |             OutputInterface::VERBOSITY_QUIET => Logger::CRITICAL, | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |             OutputInterface::VERBOSITY_NORMAL => Logger::INFO, | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |             OutputInterface::VERBOSITY_VERBOSE => Logger::DEBUG, | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |             OutputInterface::VERBOSITY_VERY_VERBOSE => Logger::DEBUG, | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |             OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG, | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |         $level = $levelMap[$output->getVerbosity()] ?: Logger::ERROR; | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |         $logger = new Logger($name); | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |         $logger->pushHandler(new FilterHandler(new StreamHandler(STDOUT, $level), Logger::DEBUG, Logger::ERROR - 1)); | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |         $logger->pushHandler(new FilterHandler(new StreamHandler(STDERR, $level), Logger::ERROR, Logger::EMERGENCY)); | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |         return $logger; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 60 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 61 |  |  |  | 
            
                        
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