Skip to content

Commit b88eae7

Browse files
committed
try --ansi pass
1 parent 7183cd7 commit b88eae7

File tree

3 files changed

+25
-28
lines changed

3 files changed

+25
-28
lines changed

src/Command/BreakPointCommand.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
final class BreakPointCommand extends Command
1818
{
1919
public function __construct(
20-
private readonly SymfonyStyle $symfonyStyle,
2120
private readonly OutdatedComposerFactory $outdatedComposerFactory,
2221
private readonly ComposerOutdatedResponseProvider $composerOutdatedResponseProvider
2322
) {
@@ -42,16 +41,18 @@ protected function configure(): void
4241

4342
protected function execute(InputInterface $input, OutputInterface $output): int
4443
{
44+
$symfonyStyle = new SymfonyStyle($input, $output);
45+
4546
$maxOutdatePackages = (int) $input->getOption('limit');
4647
$onlyDev = (bool) $input->getOption('dev');
4748

48-
$this->symfonyStyle->writeln('<fg=green>Analyzing "composer.json" for major outdated packages</>');
49+
$symfonyStyle->writeln('<fg=green>Analyzing "composer.json" for major outdated packages</>');
4950

5051
$responseJsonContents = $this->composerOutdatedResponseProvider->provide();
5152

5253
$responseJson = Json::decode($responseJsonContents, true);
5354
if (! isset($responseJson[ComposerKey::INSTALLED_KEY])) {
54-
$this->symfonyStyle->success('All packages are up to date');
55+
$symfonyStyle->success('All packages are up to date');
5556

5657
return self::SUCCESS;
5758
}
@@ -62,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6263
$composerJsonFilePath
6364
);
6465

65-
$this->symfonyStyle->title(
66+
$symfonyStyle->title(
6667
sprintf(
6768
'Found %d outdated package%s',
6869
$outdatedComposer->count($onlyDev),
@@ -71,25 +72,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7172
);
7273

7374
foreach ($outdatedComposer->getPackages($onlyDev) as $outdatedPackage) {
74-
$this->symfonyStyle->writeln(
75+
$symfonyStyle->writeln(
7576
sprintf('The "<fg=green>%s</>" package is outdated', $outdatedPackage->getName())
7677
);
7778

78-
$this->symfonyStyle->writeln(sprintf(
79+
$symfonyStyle->writeln(sprintf(
7980
' * Your version %s is <fg=%s>%s</>',
8081
$outdatedPackage->getCurrentVersion(),
8182
$outdatedPackage->isVeryOld() ? 'red' : 'yellow',
8283
$outdatedPackage->getCurrentVersionAge(),
8384
));
8485

85-
$this->symfonyStyle->writeln(sprintf(' * Bump to %s', $outdatedPackage->getLatestVersion()));
86-
$this->symfonyStyle->newLine();
86+
$symfonyStyle->writeln(sprintf(' * Bump to %s', $outdatedPackage->getLatestVersion()));
87+
$symfonyStyle->newLine();
8788
}
8889

89-
$this->symfonyStyle->newLine();
90+
$symfonyStyle->newLine();
9091
if ($outdatedComposer->count() >= $maxOutdatePackages) {
9192
// to much → fail
92-
$this->symfonyStyle->error(sprintf(
93+
$symfonyStyle->error(sprintf(
9394
'There %s %d outdated package%s. Update couple of them to get under %d limit',
9495
$outdatedComposer->count() > 1 ? 'are' : 'is',
9596
$outdatedComposer->count(),
@@ -102,7 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
102103

103104
if ($outdatedComposer->count() > max(1, $maxOutdatePackages - 5)) {
104105
// to much → fail
105-
$this->symfonyStyle->warning(sprintf(
106+
$symfonyStyle->warning(sprintf(
106107
'There are %d outdated packages. Soon, the count will go over %d limit and this job will fail.%sUpgrade in time',
107108
$outdatedComposer->count(),
108109
$maxOutdatePackages,
@@ -113,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
113114
}
114115

115116
// to many → fail
116-
$this->symfonyStyle->success(
117+
$symfonyStyle->success(
117118
sprintf('Still far away from limit %d. Good job keeping your project up to date!', $maxOutdatePackages)
118119
);
119120

src/Command/OpenVersionsCommand.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function __construct(
2323
private readonly NextVersionResolver $nextVersionResolver,
2424
private readonly OutdatedComposerFactory $outdatedComposerFactory,
2525
private readonly ComposerOutdatedResponseProvider $composerOutdatedResponseProvider,
26-
private readonly SymfonyStyle $symfonyStyle
2726
) {
2827
parent::__construct();
2928
}
@@ -42,15 +41,17 @@ protected function configure(): void
4241

4342
protected function execute(InputInterface $input, OutputInterface $output): int
4443
{
44+
$symfonyStyle = new SymfonyStyle($input, $output);
45+
4546
$composerJsonFilePath = getcwd() . '/composer.json';
4647

47-
$this->symfonyStyle->writeln('<fg=green>Analyzing "composer.json" for outdated packages</>');
48+
$symfonyStyle->writeln('<fg=green>Analyzing "composer.json" for outdated packages</>');
4849

4950
$responseJsonContents = $this->composerOutdatedResponseProvider->provide();
5051

5152
$responseJson = Json::decode($responseJsonContents, true);
5253
if (! isset($responseJson[ComposerKey::INSTALLED_KEY])) {
53-
$this->symfonyStyle->success('All packages are up to date. You are the best!');
54+
$symfonyStyle->success('All packages are up to date. You are the best!');
5455

5556
return self::SUCCESS;
5657
}
@@ -60,30 +61,30 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6061
$composerJsonFilePath
6162
);
6263

63-
$this->symfonyStyle->newLine();
64+
$symfonyStyle->newLine();
6465

65-
$this->symfonyStyle->writeln(
66+
$symfonyStyle->writeln(
6667
sprintf(
6768
'Found <fg=yellow>%d outdated package%s</>',
6869
$outdatedComposer->count(),
6970
$outdatedComposer->count() === 1 ? '' : 's'
7071
)
7172
);
7273

73-
$this->symfonyStyle->writeln(sprintf(
74+
$symfonyStyle->writeln(sprintf(
7475
' * %d prod package%s',
7576
$outdatedComposer->getProdPackagesCount(),
7677
$outdatedComposer->getProdPackagesCount() === 1 ? '' : 's'
7778
));
7879

79-
$this->symfonyStyle->writeln(sprintf(
80+
$symfonyStyle->writeln(sprintf(
8081
' * %d dev package%s',
8182
$outdatedComposer->getDevPackagesCount(),
8283
$outdatedComposer->getDevPackagesCount() === 1 ? '' : 's'
8384
));
8485

85-
$this->symfonyStyle->newLine();
86-
$this->symfonyStyle->title('Opening version constraints in "composer.json"');
86+
$symfonyStyle->newLine();
87+
$symfonyStyle->title('Opening version constraints in "composer.json"');
8788

8889
$limit = (int) $input->getOption('limit');
8990
$isDryRun = (bool) $input->getOption('dry-run');
@@ -116,7 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
116117
sprintf('"%s": "%s"', $outdatedPackage->getName(), $openedVersion)
117118
);
118119

119-
$this->symfonyStyle->writeln(sprintf(
120+
$symfonyStyle->writeln(sprintf(
120121
' * Opened "<fg=green>%s</>" package to "<fg=yellow>%s</>" version',
121122
$outdatedPackage->getName(),
122123
$openedVersion
@@ -134,7 +135,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
134135
FileSystem::write($composerJsonFilePath, $composerJsonContents . PHP_EOL);
135136
}
136137

137-
$this->symfonyStyle->success(
138+
$symfonyStyle->success(
138139
sprintf(
139140
'%d packages %s opened up to the next nearest version.%s%s "composer update" to push versions up',
140141
$openedPackageCount,

src/DependencyInjection/ContainerFactory.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ public function create(): Container
4040
return $jackConsoleApplication;
4141
});
4242

43-
$container->singleton(
44-
SymfonyStyle::class,
45-
static fn (): SymfonyStyle => new SymfonyStyle(new ArgvInput(), new ConsoleOutput())
46-
);
47-
4843
return $container;
4944
}
5045

0 commit comments

Comments
 (0)