@@ -51,8 +51,8 @@ protected function configure()
5151 ->setName ('router:match ' )
5252 ->setDefinition (array (
5353 new InputArgument ('path_info ' , InputArgument::REQUIRED , 'A path info ' ),
54- new InputOption ('method ' , null , InputOption::VALUE_REQUIRED , 'Sets the HTTP method ' , ' GET ' ),
55- new InputOption ('host ' , null , InputOption::VALUE_REQUIRED , 'Sets the HTTP host ' , ' localhost ' ),
54+ new InputOption ('method ' , null , InputOption::VALUE_REQUIRED , 'Sets the HTTP method ' ),
55+ new InputOption ('host ' , null , InputOption::VALUE_REQUIRED , 'Sets the HTTP host ' ),
5656 ))
5757 ->setDescription ('Helps debug routes by simulating a path info match ' )
5858 ->setHelp (<<<EOF
@@ -74,8 +74,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
7474 {
7575 $ router = $ this ->getContainer ()->get ('router ' );
7676 $ context = $ router ->getContext ();
77- $ context ->setMethod ($ input ->getOption ('method ' ));
78- $ context ->setHost ($ input ->getOption ('host ' ));
77+ if (null !== $ method = $ input ->getOption ('method ' )) {
78+ $ context ->setMethod ($ method );
79+ }
80+ if (null !== $ host = $ input ->getOption ('host ' )) {
81+ $ context ->setHost ($ host );
82+ }
7983
8084 $ matcher = new TraceableUrlMatcher ($ router ->getRouteCollection (), $ context );
8185
0 commit comments