Skip to content

Commit bcc3e3b

Browse files
authored
Merge pull request #316 from asgrim/format-warnings-correctly
Format Composer additional styles properly instead of trying to strip them
2 parents e8d83c5 + a70a993 commit bcc3e3b

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/Container.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Php\Pie;
66

7+
use Composer\Factory;
78
use Composer\Util\Platform as ComposerPlatform;
89
use Illuminate\Container\Container as IlluminateContainer;
910
use Php\Pie\Building\Build;
@@ -37,6 +38,7 @@
3738
use Psr\Container\ContainerInterface;
3839
use Symfony\Component\Console\ConsoleEvents;
3940
use Symfony\Component\Console\Event\ConsoleCommandEvent;
41+
use Symfony\Component\Console\Formatter\OutputFormatter;
4042
use Symfony\Component\Console\Helper\QuestionHelper;
4143
use Symfony\Component\Console\Input\ArgvInput;
4244
use Symfony\Component\Console\Input\InputInterface;
@@ -77,7 +79,16 @@ static function () {
7779
return $input;
7880
},
7981
);
80-
$container->instance(OutputInterface::class, new ConsoleOutput());
82+
$container->singleton(
83+
OutputInterface::class,
84+
static function (): OutputInterface {
85+
return new ConsoleOutput(
86+
ConsoleOutput::VERBOSITY_NORMAL,
87+
null,
88+
new OutputFormatter(false, Factory::createAdditionalStyles()),
89+
);
90+
},
91+
);
8192
$container->singleton(EventDispatcher::class, static function () {
8293
$displayedBanner = false;
8394
$eventDispatcher = new EventDispatcher();

src/DependencyResolver/UnableToResolveRequirement.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
use Php\Pie\ComposerIntegration\QuieterConsoleIO;
99
use RuntimeException;
1010

11-
use function array_map;
1211
use function count;
1312
use function implode;
1413
use function sprintf;
15-
use function strip_tags;
1614

1715
class UnableToResolveRequirement extends RuntimeException
1816
{
@@ -33,7 +31,7 @@ public static function fromRequirement(
3331
$requestedPackageAndVersion->package,
3432
$requestedPackageAndVersion->version !== null ? sprintf('version %s', $requestedPackageAndVersion->version) : 'the latest compatible version',
3533
DetermineMinimumStability::fromRequestedVersion($requestedPackageAndVersion->version),
36-
count($errors) ? "\n\n" . implode("\n\n", array_map(static fn ($e) => strip_tags($e), $errors)) : '',
34+
count($errors) ? "\n\n" . implode("\n\n", $errors) : '',
3735
),
3836
$requestedPackageAndVersion,
3937
);

0 commit comments

Comments
 (0)