From c7f9eb751499f3cd030c6c6efaf8db75bc5e76c6 Mon Sep 17 00:00:00 2001 From: dana Date: Sat, 2 Jun 2018 02:29:31 -0500 Subject: [PATCH] Application: Update for new package versions, fix formatting --- src/Twigc/Application.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Twigc/Application.php b/src/Twigc/Application.php index c2a6170..5ae3def 100644 --- a/src/Twigc/Application.php +++ b/src/Twigc/Application.php @@ -13,6 +13,7 @@ use GetOpt\{Argument,GetOpt,Operand,Option}; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Output\{ConsoleOutputInterface,OutputInterface}; use Twig\Environment; +use Twig\Extension\EscaperExtension; use Twig\Loader\{ArrayLoader,FilesystemLoader}; use Dana\Twigc\ComposerHelper; @@ -122,7 +123,7 @@ class Application { $temp = false; // If we're receiving data on standard input, and we didn't get a template, - // assume `-` — we'll make sure this doesn't conflict with `-j` below + // assume `-` — we'll make sure this doesn't conflict with `-j` below if ( ! posix_isatty(\STDIN) ) { $template = $template ?? '-'; } @@ -249,18 +250,18 @@ class Application { ), ]); - $twig->getExtension('Twig_Extension_Core')->setEscaper( + $twig->getExtension(EscaperExtension::class)->setEscaper( 'json', - function($twigEnv, $string, $charset) { + function ($twigEnv, $string, $charset) { return json_encode( $string, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE ); } ); - $twig->getExtension('Twig_Extension_Core')->setEscaper( + $twig->getExtension(EscaperExtension::class)->setEscaper( 'sh', - function($twigEnv, $string, $charset) { + function ($twigEnv, $string, $charset) { return '"' . addcslashes($string, '$`\\"') . '"'; } ); @@ -337,9 +338,9 @@ class Application { $table = new Table($output); $table->setStyle('compact'); - $table->getStyle()->setVerticalBorderChar(''); + $table->getStyle()->setVerticalBorderChars(''); $table->getStyle()->setCellRowContentFormat('%s '); - $table->setHeaders(['name', 'version', 'licence']); + $table->setHeaders(['#name', 'version', 'licence']); foreach ( $packages as $package ) { $table->addRow([