Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump flex to v2, composer >= 2.1, php >= 8.0 #833

Merged
merged 1 commit into from
Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@ jobs:
fail-fast: false
matrix:
include:
- php: '7.1'
- php: '7.2'
- php: '7.3'
- php: '7.4'
- php: '8.0'
- php: '8.1'
- php: '7.4'
mode: low-deps

steps:
Expand All @@ -42,9 +37,8 @@ jobs:
- name: "Validate composer.json"
run: "composer validate --strict --no-check-lock"

- run: |
composer require --no-update composer/composer:^1.0.2 --ansi

- name: "Install dependencies"
run: |
if [[ "${{ matrix.mode }}" = low-deps ]]; then
composer u --prefer-lowest --prefer-stable --ansi
else
Expand All @@ -56,17 +50,6 @@ jobs:

- run: vendor/bin/simple-phpunit

- run: |
composer require --no-update composer/composer:^2 --ansi

if [[ "${{ matrix.mode }}" = low-deps ]]; then
composer u --prefer-lowest --prefer-stable --ansi
else
composer u --ansi
fi

- run: vendor/bin/simple-phpunit

- if: matrix.php == '7.1'
- if: matrix.php == '8.0'
name: "Lint PHP files"
run: find src/ -name '*.php' | xargs -n1 php -l
23 changes: 13 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,28 @@
],
"minimum-stability": "dev",
"require": {
"php": ">=7.1",
"composer-plugin-api": "^1.0|^2.0"
"php": ">=8.0",
"composer-plugin-api": "^2.1"
},
"require-dev": {
"composer/composer": "^1.0.2|^2.0",
"symfony/dotenv": "^4.4|^5.0|^6.0",
"symfony/filesystem": "^4.4|^5.0|^6.0",
"symfony/phpunit-bridge": "^4.4.12|^5.0|^6.0",
"symfony/process": "^4.4|^5.0|^6.0"
"composer/composer": "^2.1",
"symfony/dotenv": "^5.4|^6.0",
"symfony/filesystem": "^5.4|^6.0",
"symfony/phpunit-bridge": "^5.4|^6.0",
"symfony/process": "^5.4|^6.0"
},
"autoload": {
"psr-4": {
"Symfony\\Flex\\": "src"
}
},
"replace": {
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*"
},
"extra": {
"branch-alias": {
"dev-main": "1.17-dev"
},
"class": "Symfony\\Flex\\Flex"
}
}
158 changes: 0 additions & 158 deletions src/Cache.php

This file was deleted.

39 changes: 0 additions & 39 deletions src/Command/GenerateIdCommand.php

This file was deleted.

13 changes: 4 additions & 9 deletions src/Command/RecipesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class RecipesCommand extends BaseCommand
/** @var \Symfony\Flex\Flex */
private $flex;

private $symfonyLock;
private $downloader;
private Lock $symfonyLock;
GromNaN marked this conversation as resolved.
Show resolved Hide resolved
private HttpDownloader $downloader;

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

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

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

private function requestGitHubApi(string $path)
{
if ($this->downloader instanceof HttpDownloader) {
$contents = $this->downloader->get($path)->getBody();
} else {
$contents = $this->downloader->getContents('api.github.com', $path, false);
}
$contents = $this->downloader->get($path)->getBody();

return json_decode($contents, true);
}
Expand Down
5 changes: 0 additions & 5 deletions src/Command/RequireCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Composer\Factory;
use Composer\Json\JsonFile;
use Composer\Json\JsonManipulator;
use Composer\Plugin\PluginInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -56,10 +55,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$input->setArgument('packages', $this->resolver->resolve($input->getArgument('packages'), true));
}

if (version_compare('2.0.0', PluginInterface::PLUGIN_API_VERSION, '>') && $input->hasOption('no-suggest')) {
$input->setOption('no-suggest', true);
}

$file = Factory::getComposerFile();
$contents = file_get_contents($file);
$json = JsonFile::parseJson($contents);
Expand Down
Loading