Skip to content

Commit b7883bd

Browse files
feature #833 Bump flex to v2, composer >= 2.1, php >= 8.0 (nicolas-grekas)
This PR was merged into the 2.x branch. Discussion ---------- Bump flex to v2, composer >= 2.1, php >= 8.0 Let's drop the legacy since Symfony 6.0 will require composer >= 2.1 anyway. Commits ------- fce7def Bump flex to v2, composer >= 2.1, php >= 8.0
2 parents 72c4bc7 + fce7def commit b7883bd

18 files changed

+49
-1449
lines changed

.github/workflows/ci.yaml

+3-20
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,8 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
include:
22-
- php: '7.1'
23-
- php: '7.2'
24-
- php: '7.3'
25-
- php: '7.4'
2622
- php: '8.0'
2723
- php: '8.1'
28-
- php: '7.4'
2924
mode: low-deps
3025

3126
steps:
@@ -42,9 +37,8 @@ jobs:
4237
- name: "Validate composer.json"
4338
run: "composer validate --strict --no-check-lock"
4439

45-
- run: |
46-
composer require --no-update composer/composer:^1.0.2 --ansi
47-
40+
- name: "Install dependencies"
41+
run: |
4842
if [[ "${{ matrix.mode }}" = low-deps ]]; then
4943
composer u --prefer-lowest --prefer-stable --ansi
5044
else
@@ -56,17 +50,6 @@ jobs:
5650

5751
- run: vendor/bin/simple-phpunit
5852

59-
- run: |
60-
composer require --no-update composer/composer:^2 --ansi
61-
62-
if [[ "${{ matrix.mode }}" = low-deps ]]; then
63-
composer u --prefer-lowest --prefer-stable --ansi
64-
else
65-
composer u --ansi
66-
fi
67-
68-
- run: vendor/bin/simple-phpunit
69-
70-
- if: matrix.php == '7.1'
53+
- if: matrix.php == '8.0'
7154
name: "Lint PHP files"
7255
run: find src/ -name '*.php' | xargs -n1 php -l

composer.json

+13-10
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,28 @@
1111
],
1212
"minimum-stability": "dev",
1313
"require": {
14-
"php": ">=7.1",
15-
"composer-plugin-api": "^1.0|^2.0"
14+
"php": ">=8.0",
15+
"composer-plugin-api": "^2.1"
1616
},
1717
"require-dev": {
18-
"composer/composer": "^1.0.2|^2.0",
19-
"symfony/dotenv": "^4.4|^5.0|^6.0",
20-
"symfony/filesystem": "^4.4|^5.0|^6.0",
21-
"symfony/phpunit-bridge": "^4.4.12|^5.0|^6.0",
22-
"symfony/process": "^4.4|^5.0|^6.0"
18+
"composer/composer": "^2.1",
19+
"symfony/dotenv": "^5.4|^6.0",
20+
"symfony/filesystem": "^5.4|^6.0",
21+
"symfony/phpunit-bridge": "^5.4|^6.0",
22+
"symfony/process": "^5.4|^6.0"
2323
},
2424
"autoload": {
2525
"psr-4": {
2626
"Symfony\\Flex\\": "src"
2727
}
2828
},
29+
"replace": {
30+
"symfony/polyfill-php72": "*",
31+
"symfony/polyfill-php73": "*",
32+
"symfony/polyfill-php74": "*",
33+
"symfony/polyfill-php80": "*"
34+
},
2935
"extra": {
30-
"branch-alias": {
31-
"dev-main": "1.17-dev"
32-
},
3336
"class": "Symfony\\Flex\\Flex"
3437
}
3538
}

src/Cache.php

-158
This file was deleted.

src/Command/GenerateIdCommand.php

-39
This file was deleted.

src/Command/RecipesCommand.php

+4-9
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class RecipesCommand extends BaseCommand
3030
/** @var \Symfony\Flex\Flex */
3131
private $flex;
3232

33-
private $symfonyLock;
34-
private $downloader;
33+
private Lock $symfonyLock;
34+
private HttpDownloader $downloader;
3535

36-
public function __construct(/* cannot be type-hinted */ $flex, Lock $symfonyLock, $downloader)
36+
public function __construct(/* cannot be type-hinted */ $flex, Lock $symfonyLock, HttpDownloader $downloader)
3737
{
3838
$this->flex = $flex;
3939
$this->symfonyLock = $symfonyLock;
@@ -102,7 +102,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
102102

103103
$write = [];
104104
$hasOutdatedRecipes = false;
105-
/** @var Recipe $recipe */
106105
foreach ($recipes as $name => $recipe) {
107106
$lockRef = $this->symfonyLock->get($name)['recipe']['ref'] ?? null;
108107

@@ -375,11 +374,7 @@ private function findRecipeCommitDataFromTreeRef(string $package, string $repo,
375374

376375
private function requestGitHubApi(string $path)
377376
{
378-
if ($this->downloader instanceof HttpDownloader) {
379-
$contents = $this->downloader->get($path)->getBody();
380-
} else {
381-
$contents = $this->downloader->getContents('api.github.com', $path, false);
382-
}
377+
$contents = $this->downloader->get($path)->getBody();
383378

384379
return json_decode($contents, true);
385380
}

src/Command/RequireCommand.php

-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Composer\Factory;
1616
use Composer\Json\JsonFile;
1717
use Composer\Json\JsonManipulator;
18-
use Composer\Plugin\PluginInterface;
1918
use Symfony\Component\Console\Input\InputInterface;
2019
use Symfony\Component\Console\Input\InputOption;
2120
use Symfony\Component\Console\Output\OutputInterface;
@@ -56,10 +55,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
5655
$input->setArgument('packages', $this->resolver->resolve($input->getArgument('packages'), true));
5756
}
5857

59-
if (version_compare('2.0.0', PluginInterface::PLUGIN_API_VERSION, '>') && $input->hasOption('no-suggest')) {
60-
$input->setOption('no-suggest', true);
61-
}
62-
6358
$file = Factory::getComposerFile();
6459
$contents = file_get_contents($file);
6560
$json = JsonFile::parseJson($contents);

0 commit comments

Comments
 (0)