Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
dependency-versions: [ "highest" ]
include:
- php: "7.2"
tools: "composer:v2.6"
tools: "composer:v2.2"
dependency-versions: "lowest"

steps:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"require-dev": {
"ext-json": "*",
"composer/composer": "^2.6",
"composer/composer": "^2.2.26",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8 || ^2.0",
"phpstan/phpstan-phpunit": "^1.1 || ^2.0",
Expand Down
7 changes: 6 additions & 1 deletion src/Command/BinCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use function file_put_contents;
use function getcwd;
use function glob;
use function method_exists;
use function min;
use function mkdir;
use function putenv;
Expand Down Expand Up @@ -96,7 +97,11 @@ public function isProxyCommand(): bool

public function execute(InputInterface $input, OutputInterface $output): int
{
$composer = $this->requireComposer();
// Switch to requireComposer() once Composer 2.3 is set as the minimum
// @phpstan-ignore function.alreadyNarrowedType
$composer = method_exists($this, 'requireComposer')
? $this->requireComposer()
: $this->getComposer();

$config = Config::fromComposer($composer);
$currentWorkingDir = getcwd();
Expand Down
8 changes: 7 additions & 1 deletion tests/Fixtures/MyTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use Composer\Factory;
use Composer\IO\NullIO;

use function method_exists;

class MyTestCommand extends BaseCommand
{
/**
Expand Down Expand Up @@ -39,7 +41,11 @@ public function __construct()

public function execute(InputInterface $input, OutputInterface $output): int
{
$this->composer = $this->tryComposer();
// Switch to tryComposer() once Composer 2.3 is set as the minimum
// @phpstan-ignore function.alreadyNarrowedType
$this->composer = method_exists($this, 'tryComposer')
? $this->tryComposer()
: $this->getComposer(false);

$factory = Factory::create(new NullIO());
$config = $factory->getConfig();
Expand Down
Loading