@@ -539,9 +539,7 @@ private static function initPlaceholderFormatters(): array
539539
540540 return $ display ;
541541 },
542- 'elapsed ' => function (self $ bar ) {
543- return Helper::formatTime (time () - $ bar ->getStartTime ());
544- },
542+ 'elapsed ' => fn (self $ bar ) => Helper::formatTime (time () - $ bar ->getStartTime ()),
545543 'remaining ' => function (self $ bar ) {
546544 if (!$ bar ->getMaxSteps ()) {
547545 throw new LogicException ('Unable to display the remaining time if the maximum number of steps is not set. ' );
@@ -556,18 +554,10 @@ private static function initPlaceholderFormatters(): array
556554
557555 return Helper::formatTime ($ bar ->getEstimated ());
558556 },
559- 'memory ' => function (self $ bar ) {
560- return Helper::formatMemory (memory_get_usage (true ));
561- },
562- 'current ' => function (self $ bar ) {
563- return str_pad ($ bar ->getProgress (), $ bar ->getStepWidth (), ' ' , \STR_PAD_LEFT );
564- },
565- 'max ' => function (self $ bar ) {
566- return $ bar ->getMaxSteps ();
567- },
568- 'percent ' => function (self $ bar ) {
569- return floor ($ bar ->getProgressPercent () * 100 );
570- },
557+ 'memory ' => fn (self $ bar ) => Helper::formatMemory (memory_get_usage (true )),
558+ 'current ' => fn (self $ bar ) => str_pad ($ bar ->getProgress (), $ bar ->getStepWidth (), ' ' , \STR_PAD_LEFT ),
559+ 'max ' => fn (self $ bar ) => $ bar ->getMaxSteps (),
560+ 'percent ' => fn (self $ bar ) => floor ($ bar ->getProgressPercent () * 100 ),
571561 ];
572562 }
573563
@@ -611,9 +601,7 @@ private function buildLine(): string
611601 $ line = preg_replace_callback ($ regex , $ callback , $ this ->format );
612602
613603 // gets string length for each sub line with multiline format
614- $ linesLength = array_map (function ($ subLine ) {
615- return Helper::width (Helper::removeDecoration ($ this ->output ->getFormatter (), rtrim ($ subLine , "\r" )));
616- }, explode ("\n" , $ line ));
604+ $ linesLength = array_map (fn ($ subLine ) => Helper::width (Helper::removeDecoration ($ this ->output ->getFormatter (), rtrim ($ subLine , "\r" ))), explode ("\n" , $ line ));
617605
618606 $ linesWidth = max ($ linesLength );
619607
0 commit comments