File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030 dependency-versions : [ "highest" ]
3131 include :
3232 - php : " 7.2"
33- tools : " composer:v2.6 "
33+ tools : " composer:v2.2 "
3434 dependency-versions : " lowest"
3535
3636 steps :
Original file line number Diff line number Diff line change 1717 },
1818 "require-dev" : {
1919 "ext-json" : " *" ,
20- "composer/composer" : " ^2.6 " ,
20+ "composer/composer" : " ^2.2.26 " ,
2121 "phpstan/extension-installer" : " ^1.1" ,
2222 "phpstan/phpstan" : " ^1.8 || ^2.0" ,
2323 "phpstan/phpstan-phpunit" : " ^1.1 || ^2.0" ,
Original file line number Diff line number Diff line change 2626use function file_put_contents ;
2727use function getcwd ;
2828use function glob ;
29+ use function method_exists ;
2930use function min ;
3031use function mkdir ;
3132use function putenv ;
@@ -96,7 +97,11 @@ public function isProxyCommand(): bool
9697
9798 public function execute (InputInterface $ input , OutputInterface $ output ): int
9899 {
99- $ composer = $ this ->requireComposer ();
100+ // Switch to requireComposer() once Composer 2.3 is set as the minimum
101+ // @phpstan-ignore function.alreadyNarrowedType
102+ $ composer = method_exists ($ this , 'requireComposer ' )
103+ ? $ this ->requireComposer ()
104+ : $ this ->getComposer ();
100105
101106 $ config = Config::fromComposer ($ composer );
102107 $ currentWorkingDir = getcwd ();
Original file line number Diff line number Diff line change 1212use Composer \Factory ;
1313use Composer \IO \NullIO ;
1414
15+ use function method_exists ;
16+
1517class MyTestCommand extends BaseCommand
1618{
1719 /**
@@ -39,7 +41,11 @@ public function __construct()
3941
4042 public function execute (InputInterface $ input , OutputInterface $ output ): int
4143 {
42- $ this ->composer = $ this ->tryComposer ();
44+ // Switch to tryComposer() once Composer 2.3 is set as the minimum
45+ // @phpstan-ignore function.alreadyNarrowedType
46+ $ this ->composer = method_exists ($ this , 'tryComposer ' )
47+ ? $ this ->tryComposer ()
48+ : $ this ->getComposer (false );
4349
4450 $ factory = Factory::create (new NullIO ());
4551 $ config = $ factory ->getConfig ();
You can’t perform that action at this time.
0 commit comments