@@ -431,7 +431,7 @@ public function install(Event $event)
431431 foreach ($ recipes as $ recipe ) {
432432 if ('install ' === $ recipe ->getJob () && !$ installContribs && $ recipe ->isContrib ()) {
433433 $ warning = $ this ->io ->isInteractive () ? 'WARNING ' : 'IGNORING ' ;
434- $ this ->io ->writeError (sprintf (' - <warning> %s </> %s ' , $ warning , $ recipe -> getFormattedOrigin ( )));
434+ $ this ->io ->writeError (sprintf (' - <warning> %s </> %s ' , $ warning , $ this -> formatOrigin ( $ recipe )));
435435 $ question = sprintf (' The recipe for this package comes from the "contrib" repository, which is open to community contributions.
436436 Review the recipe at %s
437437
@@ -474,7 +474,7 @@ function ($value) {
474474
475475 switch ($ recipe ->getJob ()) {
476476 case 'install ' :
477- $ this ->io ->writeError (sprintf (' - Configuring %s ' , $ recipe -> getFormattedOrigin ( )));
477+ $ this ->io ->writeError (sprintf (' - Configuring %s ' , $ this -> formatOrigin ( $ recipe )));
478478 $ this ->configurator ->install ($ recipe , $ this ->lock , [
479479 'force ' => $ event instanceof UpdateEvent && $ event ->force (),
480480 ]);
@@ -491,7 +491,7 @@ function ($value) {
491491 case 'update ' :
492492 break ;
493493 case 'uninstall ' :
494- $ this ->io ->writeError (sprintf (' - Unconfiguring %s ' , $ recipe -> getFormattedOrigin ( )));
494+ $ this ->io ->writeError (sprintf (' - Unconfiguring %s ' , $ this -> formatOrigin ( $ recipe )));
495495 $ this ->configurator ->unconfigure ($ recipe , $ this ->lock );
496496 break ;
497497 }
@@ -834,6 +834,23 @@ private function initOptions(): Options
834834 return new Options ($ options , $ this ->io );
835835 }
836836
837+ private function formatOrigin (Recipe $ recipe ): string
838+ {
839+ if (method_exists ($ recipe , 'getFormattedOrigin ' )) {
840+ return $ recipe ->getFormattedOrigin ();
841+ }
842+
843+ // BC with upgrading from flex < 1.18
844+ $ origin = $ recipe ->getOrigin ();
845+
846+ // symfony/translation:3.3@github.com/symfony/recipes:branch
847+ if (!preg_match ('/^([^:]++):([^@]++)@(.+)$/ ' , $ origin , $ matches )) {
848+ return $ origin ;
849+ }
850+
851+ return sprintf ('<info>%s</> (<comment>>=%s</>): From %s ' , $ matches [1 ], $ matches [2 ], 'auto-generated recipe ' === $ matches [3 ] ? '<comment> ' .$ matches [3 ].'</> ' : $ matches [3 ]);
852+ }
853+
837854 private function shouldRecordOperation (PackageEvent $ event ): bool
838855 {
839856 $ operation = $ event ->getOperation ();
0 commit comments