Skip to content

Commit 87a1084

Browse files
committed
Add compatibility with composer2
1 parent e4f5a26 commit 87a1084

18 files changed

+264
-1024
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ cache:
2020
env:
2121
global:
2222
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
23-
- SYMFONY_PHPUNIT_VERSION="6.1"
23+
- SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1
2424
- COMPOSER_FLAGS=''
2525

2626
before_install:
27+
- composer self-update --snapshot
2728
- composer validate
2829

2930
install:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
],
1212
"require": {
1313
"php": "^7.0",
14-
"composer-plugin-api": "^1.0"
14+
"composer-plugin-api": "^2.0"
1515
},
1616
"require-dev": {
17-
"composer/composer": "^1.0.2",
17+
"composer/composer": "^2.0@dev",
1818
"symfony/dotenv": "^3.4|^4.0|^5.0",
1919
"symfony/phpunit-bridge": "^3.4.19|^4.1.8|^5.0",
2020
"symfony/process": "^2.7|^3.0|^4.0|^5.0"

src/Cache.php

Lines changed: 0 additions & 147 deletions
This file was deleted.

src/Command/RecipesCommand.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313

1414
use Composer\Command\BaseCommand;
1515
use Composer\Downloader\TransportException;
16+
use Composer\Util\Http\Response;
17+
use Composer\Util\HttpDownloader;
1618
use Symfony\Component\Console\Input\InputArgument;
1719
use Symfony\Component\Console\Input\InputInterface;
1820
use Symfony\Component\Console\Output\OutputInterface;
1921
use Symfony\Flex\InformationOperation;
2022
use Symfony\Flex\Lock;
21-
use Symfony\Flex\ParallelDownloader;
2223
use Symfony\Flex\Recipe;
2324

2425
/**
@@ -32,7 +33,7 @@ class RecipesCommand extends BaseCommand
3233
private $symfonyLock;
3334
private $downloader;
3435

35-
public function __construct(/* cannot be type-hinted */ $flex, Lock $symfonyLock, ParallelDownloader $downloader)
36+
public function __construct(/* cannot be type-hinted */ $flex, Lock $symfonyLock, HttpDownloader $downloader)
3637
{
3738
$this->flex = $flex;
3839
$this->symfonyLock = $symfonyLock;
@@ -354,8 +355,9 @@ private function findRecipeCommitDataFromTreeRef(string $package, string $repo,
354355

355356
private function requestGitHubApi(string $path)
356357
{
357-
$contents = $this->downloader->getContents('api.github.com', $path, false);
358+
/** @var Response $response */
359+
$response = $this->downloader->get($path);
358360

359-
return json_decode($contents, true);
361+
return json_decode($response->getBody(), true);
360362
}
361363
}

src/Command/UnpackCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
114114
$lockFile->write($lockData);
115115

116116
// force removal of files under vendor/
117-
$locker = new Locker($io, $lockFile, $composer->getRepositoryManager(), $composer->getInstallationManager(), file_get_contents($json->getPath()));
117+
$locker = new Locker($io, $lockFile, $composer->getInstallationManager(), file_get_contents($json->getPath()));
118118
$composer->setLocker($locker);
119119
$install = Installer::create($io, $composer);
120120
$install
121121
->setDevMode(true)
122122
->setDumpAutoloader(false)
123123
->setRunScripts(false)
124-
->setSkipSuggest(true)
125124
->setIgnorePlatformRequirements(true)
126125
;
127126

src/ComposerRepository.php

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)