Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:
curl https://fabbot.io/patch/symfony/flex/1032/6a726fa9cdb66fd66e9e0d6189e8992218ec9330/cs.diff | patch -p0
diff -ru src/Flex.php src/Flex.php
--- src/Flex.php 2024-11-29 17:48:10.072374795 +0000
+++ src/Flex.php 2024-11-29 17:48:12.219378703 +0000
@@ -360,7 +360,7 @@
$runtime = $this->options->get('runtime');
$dotenvPath = $rootDir.'/'.($runtime['dotenv_path'] ?? '.env');
- if (!file_exists($dotenvPath) && !file_exists($dotenvPath.'.local') && file_exists($dotenvPath.'.dist') && false === strpos(file_get_contents($dotenvPath.'.dist'), '.env.local')) {
+ if (!file_exists($dotenvPath) && !file_exists($dotenvPath.'.local') && file_exists($dotenvPath.'.dist') && !str_contains(file_get_contents($dotenvPath.'.dist'), '.env.local')) {
copy($dotenvPath.'.dist', $dotenvPath);
}
@@ -374,7 +374,7 @@
$this->io->writeError('');
$this->io->writeError('What about running <comment>composer global require symfony/thanks && composer thanks</> now?');
- $this->io->writeError(sprintf('This will spread some %s by sending a %s to the GitHub repositories of your fellow package maintainers.', $love, $star));
+ $this->io->writeError(\sprintf('This will spread some %s by sending a %s to the GitHub repositories of your fellow package maintainers.', $love, $star));
}
$this->io->writeError('');
@@ -392,7 +392,7 @@
return;
}
- $this->io->writeError(sprintf('<info>Symfony operations: %d recipe%s (%s)</>', \count($recipes), \count($recipes) > 1 ? 's' : '', $this->downloader->getSessionId()));
+ $this->io->writeError(\sprintf('<info>Symfony operations: %d recipe%s (%s)</>', \count($recipes), \count($recipes) > 1 ? 's' : '', $this->downloader->getSessionId()));
$installContribs = $this->composer->getPackage()->getExtra()['symfony']['allow-contrib'] ?? false;
$manifest = null;
$originalComposerJsonHash = $this->getComposerJsonHash();
@@ -400,8 +400,8 @@
foreach ($recipes as $recipe) {
if ('install' === $recipe->getJob() && !$installContribs && $recipe->isContrib()) {
$warning = $this->io->isInteractive() ? 'WARNING' : 'IGNORING';
- $this->io->writeError(sprintf(' - <warning> %s </> %s', $warning, $this->formatOrigin($recipe)));
- $question = sprintf(' The recipe for this package comes from the "contrib" repository, which is open to community contributions.
+ $this->io->writeError(\sprintf(' - <warning> %s </> %s', $warning, $this->formatOrigin($recipe)));
+ $question = \sprintf(' The recipe for this package comes from the "contrib" repository, which is open to community contributions.
Review the recipe at %s
Do you want to execute this recipe?
@@ -444,13 +444,13 @@
switch ($recipe->getJob()) {
case 'install':
$postInstallRecipes[] = $recipe;
- $this->io->writeError(sprintf(' - Configuring %s', $this->formatOrigin($recipe)));
+ $this->io->writeError(\sprintf(' - Configuring %s', $this->formatOrigin($recipe)));
$this->configurator->install($recipe, $this->lock, [
'force' => $event instanceof UpdateEvent && $event->force(),
]);
$manifest = $recipe->getManifest();
if (isset($manifest['post-install-output'])) {
- $this->postInstallOutput[] = sprintf('<bg=yellow;fg=white> %s </> instructions:', $recipe->getName());
+ $this->postInstallOutput[] = \sprintf('<bg=yellow;fg=white> %s </> instructions:', $recipe->getName());
$this->postInstallOutput[] = '';
foreach ($manifest['post-install-output'] as $line) {
$this->postInstallOutput[] = $this->options->expandTargetDir($line);
@@ -461,7 +461,7 @@
case 'update':
break;
case 'uninstall':
- $this->io->writeError(sprintf(' - Unconfiguring %s', $this->formatOrigin($recipe)));
+ $this->io->writeError(\sprintf(' - Unconfiguring %s', $this->formatOrigin($recipe)));
$this->configurator->unconfigure($recipe, $this->lock);
break;
}
@@ -594,7 +594,7 @@
$job = method_exists($operation, 'getOperationType') ? $operation->getOperationType() : $operation->getJobType();
if (!isset($manifests[$name]) && isset($data['conflicts'][$name])) {
- $this->io->writeError(sprintf(' - Skipping recipe for %s: all versions of the recipe conflict with your package versions.', $name));
+ $this->io->writeError(\sprintf(' - Skipping recipe for %s: all versions of the recipe conflict with your package versions.', $name));
continue;
}
@@ -605,7 +605,7 @@
if (!isset($newManifests[$name])) {
// no older recipe found
- $this->io->writeError(sprintf(' - Skipping recipe for %s: all versions of the recipe conflict with your package versions.', $name));
+ $this->io->writeError(\sprintf(' - Skipping recipe for %s: all versions of the recipe conflict with your package versions.', $name));
continue 2;
}
@@ -654,7 +654,7 @@
if ($bundles) {
$manifest = [
- 'origin' => sprintf('%s:%s@auto-generated recipe', $name, $package->getPrettyVersion()),
+ 'origin' => \sprintf('%s:%s@auto-generated recipe', $name, $package->getPrettyVersion()),
'manifest' => ['bundles' => $bundles],
];
$recipes[$name] = new Recipe($package, $name, $job, $manifest);
@@ -727,7 +727,7 @@
return $origin;
}
- return sprintf('<info>%s</> (<comment>>=%s</>): From %s', $matches[1], $matches[2], 'auto-generated recipe' === $matches[3] ? '<comment>'.$matches[3].'</>' : $matches[3]);
+ return \sprintf('<info>%s</> (<comment>>=%s</>): From %s', $matches[1], $matches[2], 'auto-generated recipe' === $matches[3] ? '<comment>'.$matches[3].'</>' : $matches[3]);
}
private function shouldRecordOperation(OperationInterface $operation, bool $isDevMode, ?Composer $composer = null): bool
@@ -797,7 +797,7 @@
$this->io->writeError('<info>Unpacking Symfony packs</>');
foreach ($result->getUnpacked() as $pkg) {
- $this->io->writeError(sprintf(' - Unpacked <info>%s</>', $pkg->getName()));
+ $this->io->writeError(\sprintf(' - Unpacked <info>%s</>', $pkg->getName()));
}
$unpacker->updateLock($result, $this->io);
diff -ru tests/FlexTest.php tests/FlexTest.php
--- tests/FlexTest.php 2024-11-29 17:48:10.341375284 +0000
+++ tests/FlexTest.php 2024-11-29 17:48:13.123380348 +0000
@@ -163,7 +163,7 @@
}
$expectedManifest = [
- 'origin' => sprintf('%s:%s@auto-generated recipe', $package->getName(),
+ 'origin' => \sprintf('%s:%s@auto-generated recipe', $package->getName(),
$package->getPrettyVersion()),
'manifest' => ['bundles' => []],
];