Skip to content

Commit 9fb60f2

Browse files
committed
bug #415 Reenable flex when it is found in require-dev (nicolas-grekas)
This PR was merged into the 1.1-dev branch. Discussion ---------- Reenable flex when it is found in require-dev As discussed in #414 Commits ------- 603ff43 Reenable flex when it is found in require-dev
2 parents 5583bd7 + 603ff43 commit 9fb60f2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Downloader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public function __construct(Composer $composer, IoInterface $io, ParallelDownloa
4343
$this->caFile = getenv('SYMFONY_CAFILE');
4444
}
4545

46-
foreach ($composer->getPackage()->getRequires() as $link) {
47-
// recipes apply only when symfony/flex is found in "require" in the root package
46+
foreach (array_merge($composer->getPackage()->getRequires() ?? [], $composer->getPackage()->getDevRequires() ?? []) as $link) {
47+
// recipes apply only when symfony/flex is found in "require" or "require-dev" in the root package
4848
if ('symfony/flex' !== $link->getTarget()) {
4949
continue;
5050
}

src/Flex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ public function generateFlexId()
546546
}
547547

548548
if (null === $this->downloader->getEndpoint()) {
549-
throw new \LogicException('Cannot generate project id when "symfony/flex" is not in the "require" section of the root composer.json.');
549+
throw new \LogicException('Cannot generate project id when "symfony/flex" is not found in the root composer.json.');
550550
}
551551

552552
$json = new JsonFile(Factory::getComposerFile());
@@ -560,7 +560,7 @@ public function generateFlexId()
560560
private function fetchRecipes(): array
561561
{
562562
if (null === $this->downloader->getEndpoint()) {
563-
$this->io->writeError('<warning>Symfony recipes are disabled: "symfony/flex" is not in the "require" section of the root composer.json</warning>');
563+
$this->io->writeError('<warning>Symfony recipes are disabled: "symfony/flex" not found in the root composer.json</warning>');
564564

565565
return [[], []];
566566
}

0 commit comments

Comments
 (0)