Skip to content

Commit 645f3fc

Browse files
committed
Drop support for Composer v1.x
Composer themselves will no longer support version 1.x beyond 1st August 2025. Composer version 2.2 was released in December 2021, which is more than three years ago. Anyone wanting to use this plug-in with Composer <2.2 can use any existing version. https://blog.packagist.com/composer-2-0-is-now-available/ https://blog.packagist.com/deprecating-composer-1-support/ https://blog.packagist.com/shutting-down-packagist-org-support-for-composer-1-x/
1 parent 9711529 commit 645f3fc

9 files changed

+25
-88
lines changed

.github/workflows/integrationtest.yml

-14
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,17 @@ jobs:
4141
- '8.4'
4242
- '8.5'
4343
composer:
44-
- 'v1'
4544
- 'v2'
4645
os:
4746
- 'ubuntu-latest'
4847
- 'windows-latest'
4948

5049
exclude:
51-
# Exclude a particularly problematic build.
52-
# @link https://github.com/PHPCSStandards/composer-installer/issues/181
53-
- php: '5.5'
54-
composer: 'v1'
55-
os: 'windows-latest'
5650
# Installing on Windows with PHP 5.4 runs into all sorts of problems (which are not ours).
5751
# Considering PHP 5.4 is ancient, I deem it acceptable to exclude the Windows PHP 5.4 builds.
5852
# @link https://github.com/PHPCSStandards/composer-installer/pull/213
5953
- php: '5.4'
6054
os: 'windows-latest'
61-
# Composer 1.x is no longer supported and while Composer 2.2 is an LTS version, the LTS
62-
# is only for critical bugs and security issues, not for supporting new PHP versions.
63-
# In practice, this means that Composer 1.x and 2.2 are not compatible with PHP 8.4 and later.
64-
# @link https://github.com/composer/composer/issues/10340
65-
- php: '8.4'
66-
composer: 'v1'
67-
- php: '8.5'
68-
composer: 'v1'
6955

7056
include:
7157
# Composer 2.3 drops support for PHP < 7.2, so for PHP 5.4 to 7.1, `v2` will install

.github/workflows/quicktest.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,22 @@ jobs:
3232
- '7.2'
3333
- 'latest'
3434
composer:
35-
- 'v1'
35+
# Note: for PHP 5.4 - 7.1, "v2" will install Composer 2.2.
36+
# For PHP 7.2+, it will install Composer "latest".
3637
- 'v2'
3738
os:
3839
- 'ubuntu-latest'
3940
- 'windows-latest'
4041

4142
# Installing on Windows with PHP 5.4 runs into all sorts of problems (which are not ours).
42-
# Exclude the Windows PHP 5.4 builds and replace them with PHP 5.5/5.6 for the same.
43+
# Exclude the Windows PHP 5.4 builds and replace them with PHP 5.5 for the same.
4344
# @link https://github.com/PHPCSStandards/composer-installer/issues/181
4445
# @link https://github.com/PHPCSStandards/composer-installer/pull/213
4546
exclude:
4647
- php: '5.4'
4748
os: 'windows-latest'
4849
include:
4950
- php: '5.5'
50-
composer: 'v2'
51-
os: 'windows-latest'
52-
- php: '5.6'
53-
composer: 'v1'
5451
os: 'windows-latest'
5552

5653
name: "Quick test"

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ Even better: You could submit a pull request with a fix / new feature!
3232
### (Code) Quality checks
3333

3434
Every merge-request triggers a build process which runs various checks to help
35-
maintain a quality standard. All JSON, Markdown, PHP, and Yaml files are
35+
maintain a quality standard. All JSON, Markdown, PHP, and Yaml files are
3636
expected to adhere to these quality standards.
3737

3838
These tools fall into two categories: PHP and non-PHP.
3939

40-
### PHP
40+
### PHP
4141

4242
The PHP specific tools used by this build are:
4343

@@ -99,7 +99,7 @@ In case the test setup has trouble locating your `composer.phar` file:
9999
</php>
100100
```
101101
**Note**: this setting also allows for locally testing with different versions of Composer.
102-
You could, for instance, have multiple Composer Phar files locally, `composer1.phar`, `composer2.1.phar`, `composer2.2.phar`.
102+
You could, for instance, have multiple Composer Phar files locally, `composer.phar`, `composer2.2.phar`, `composer2.6.phar`.
103103
By changing the path in the value of this `env` setting, you can switch which version will be used in the tests.
104104

105105
### Non-PHP
@@ -112,7 +112,7 @@ The non-PHP specific tools used by this build are:
112112

113113
These tools are also run as [GitHub actions][].
114114
All the checks can be run locally using [`act`][].
115-
Alternatively they can be run using `docker run`, as all checks use Docker
115+
Alternatively they can be run using `docker run`, as all checks use Docker
116116
images provided by [Pipeline-Component][].
117117

118118
Finally, they could be run locally using NodeJS, Ruby, PHP, or whatever the tool

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Installation can be done with [Composer][composer], by requiring this package as
2323
composer require --dev dealerdirect/phpcodesniffer-composer-installer:"^1.0"
2424
```
2525

26-
When using Composer 2.2 or higher, Composer will [ask for your permission](https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution) to allow this plugin to execute code. For this plugin to be functional, permission needs to be granted.
26+
Since Composer 2.2, Composer will [ask for your permission](https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution) to allow this plugin to execute code. For this plugin to be functional, permission needs to be granted.
2727

2828
When permission has been granted, the following snippet will automatically be added to your `composer.json` file by Composer:
2929
```json
@@ -36,7 +36,7 @@ When permission has been granted, the following snippet will automatically be ad
3636
}
3737
```
3838

39-
When using Composer < 2.2, you can add the permission flag ahead of the upgrade to Composer 2.2, by running:
39+
You can safely add the permission flag (to avoid Composer needing to ask), by running:
4040
```bash
4141
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
4242
```
@@ -48,7 +48,7 @@ That's it.
4848
This plugin is compatible with:
4949

5050
- PHP **5.4+**, **7.x**, and **8.x** (Support for PHP v8 is available since [`v0.7.0`][v0.7])
51-
- [Composer][composer] **1.x** and **2.x** (Support for Composer v2 is available since [`v0.7.0`][v0.7])
51+
- [Composer][composer] **2.2+** (Support for Composer v2 is available since [`v0.7.0`][v0.7]; support for Composer < 2.2 was dropped in [`v1.1.0`][v1.1])
5252
- [PHP_CodeSniffer][codesniffer] **2.x** and **3.x** (Support for PHP_CodeSniffer v3 is available since [`v0.4.0`][v0.4])
5353

5454
### How it works
@@ -283,3 +283,4 @@ THE SOFTWARE.
283283
[using-composer-plugins]: https://getcomposer.org/doc/articles/plugins.md#using-plugins
284284
[v0.4]: https://github.com/PHPCSStandards/composer-installer/releases/tag/v0.4.0
285285
[v0.7]: https://github.com/PHPCSStandards/composer-installer/releases/tag/v0.7.0
286+
[v1.1]: https://github.com/PHPCSStandards/composer-installer/releases/tag/v1.1.0

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
},
2929
"require": {
3030
"php": ">=5.4",
31-
"composer-plugin-api": "^1.0 || ^2.0",
31+
"composer-plugin-api": "^2.2",
3232
"squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0"
3333
},
3434
"require-dev": {
3535
"ext-json": "*",
3636
"ext-zip": "*",
37-
"composer/composer": "*",
37+
"composer/composer": "^2.2",
3838
"phpcompatibility/php-compatibility": "^9.0",
3939
"php-parallel-lint/php-parallel-lint": "^1.3.1",
4040
"yoast/phpunit-polyfills": "^1.0"

tests/IntegrationTest/BaseLineTest.php

-12
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,6 @@ public function testBaseLineGlobal($phpcsVersion, $expectedStnds)
108108
*/
109109
public function testBaseLineLocal($phpcsVersion, $expectedStnds)
110110
{
111-
if (
112-
$phpcsVersion === PHPCSVersions::MASTER
113-
&& \CLI_PHP_MINOR === '5.5'
114-
&& $this->onWindows() === true
115-
&& substr(\COMPOSER_VERSION, 0, 1) === '1'
116-
) {
117-
$this->markTestSkipped(
118-
'Composer 1.x on Windows with PHP 5.5 does run the plugin when there are no external standards,'
119-
. ' but doesn\'t consistently show this in the logs'
120-
);
121-
}
122-
123111
$config = $this->composerConfig;
124112
$config['require-dev']['squizlabs/php_codesniffer'] = $phpcsVersion;
125113

tests/IntegrationTest/InstallUpdateEventsTest.php

+6-15
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function testPluginRunsOnReinstall()
177177
}
178178

179179
/**
180-
* Test that the plugin runs (or doesn't run) when Composer is invoked with the --no-scripts argument.
180+
* Test that the plugin runs when Composer is invoked with the --no-scripts argument.
181181
*
182182
* Note: the behaviour of Composer changed in 2.1.2. Prior to that, `--no-scripts` would
183183
* also stop plugins from running. As of Composer 2.1.2, `--no-scripts` and `--no-plugins`
@@ -198,20 +198,11 @@ public function testPluginRunsOnInstallWithNoScripts()
198198

199199
$this->assertSame(0, $result['exitcode'], 'Exitcode for composer install did not match 0');
200200

201-
if (version_compare(\COMPOSER_VERSION, '2.1.2', '>=') === true) {
202-
$this->assertStringContainsString(
203-
Plugin::MESSAGE_RUNNING_INSTALLER,
204-
$result['stdout'],
205-
'Output from running Composer install missing expected contents.'
206-
);
207-
} else {
208-
// Composer 1.x.
209-
$this->assertStringNotContainsString(
210-
Plugin::MESSAGE_RUNNING_INSTALLER,
211-
$result['stdout'],
212-
'Output from running Composer install contains unexpected contents.'
213-
);
214-
}
201+
$this->assertStringContainsString(
202+
Plugin::MESSAGE_RUNNING_INSTALLER,
203+
$result['stdout'],
204+
'Output from running Composer install missing expected contents.'
205+
);
215206
}
216207

217208
/**

tests/IntegrationTest/RemovePluginTest.php

+6-24
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,6 @@ protected function tear_down()
5656
$this->removeTestEnvironment();
5757
}
5858

59-
/**
60-
* Helper method to get the stdout expectation for when the plugin is uninstalled.
61-
*
62-
* As of Composer 2.0.0, plugins which have been uninstalled will not run anymore
63-
* after the uninstall (which is good).
64-
* It is unclear which particular change this can be attributed to.
65-
*
66-
* @return string
67-
*/
68-
private function getUninstallStdOutExpectation()
69-
{
70-
if (strpos(\COMPOSER_VERSION, '1') === 0) {
71-
return Plugin::MESSAGE_PLUGIN_UNINSTALLED;
72-
}
73-
74-
return '';
75-
}
76-
7759
/**
7860
* Test the plugin doesn't exit with a non-0 exit code and doesn't throw errors when PHPCS and the plugin
7961
* were installed via --dev and a no-dev install is run, which removes the plugin and PHPCS.
@@ -101,7 +83,7 @@ public function testRemovePHPCSViaNoDevGlobal()
10183
$this->assertExecute(
10284
'composer global install --no-dev -v --no-ansi',
10385
0, // Expected exit code.
104-
$this->getUninstallStdOutExpectation(), // Expected stdout.
86+
null, // No stdout expectation.
10587
null, // No stderr expectation.
10688
'Uninstall by switching to no-dev did not meet expectations.'
10789
);
@@ -133,7 +115,7 @@ public function testRemovePHPCSViaNoDevLocal()
133115
$this->assertExecute(
134116
sprintf('composer install --no-dev -v --no-ansi --working-dir=%s', escapeshellarg(static::$tempLocalPath)),
135117
0, // Expected exit code.
136-
$this->getUninstallStdOutExpectation(), // Expected stdout.
118+
null, // No stdout expectation.
137119
null, // No stderr expectation.
138120
'Uninstall by switching to no-dev did not meet expectations.'
139121
);
@@ -166,7 +148,7 @@ public function testRemovePHPCSViaDevUninstallGlobal()
166148
$this->assertExecute(
167149
'composer global remove --dev phpcs-composer-installer/multistandard -v --no-ansi',
168150
0, // Expected exit code.
169-
$this->getUninstallStdOutExpectation(), // Expected stdout.
151+
null, // No stdout expectation.
170152
null, // No stderr expectation.
171153
'Uninstall of dev dependency did not meet expectations.'
172154
);
@@ -203,7 +185,7 @@ public function testRemovePHPCSViaDevUninstallLocal()
203185
$this->assertExecute(
204186
$command,
205187
0, // Expected exit code.
206-
$this->getUninstallStdOutExpectation(), // Expected stdout.
188+
null, // No stdout expectation.
207189
null, // No stderr expectation.
208190
'Uninstall of dev dependency did not meet expectations.'
209191
);
@@ -236,7 +218,7 @@ public function testRemovePHPCSViaNoDevUninstallGlobal()
236218
$this->assertExecute(
237219
'composer global remove phpcs-composer-installer/multistandard -v --no-ansi',
238220
0, // Expected exit code.
239-
$this->getUninstallStdOutExpectation(), // Expected stdout.
221+
null, // No stdout expectation.
240222
null, // No stderr expectation.
241223
'Uninstall of no-dev dependency did not meet expectations.'
242224
);
@@ -273,7 +255,7 @@ public function testRemovePHPCSViaNoDevUninstallLocal()
273255
$this->assertExecute(
274256
$command,
275257
0, // Expected exit code.
276-
$this->getUninstallStdOutExpectation(), // Expected stdout.
258+
null, // No stdout expectation.
277259
null, // No stderr expectation.
278260
'Uninstall of no-dev dependency did not meet expectations.'
279261
);

tests/TestCase.php

-8
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,6 @@ protected static function writeComposerJsonFile($config, $directory)
252252
$config['config']['allow-plugins']['dealerdirect/phpcodesniffer-composer-installer'] = true;
253253
}
254254

255-
/*
256-
* Disable TLS when on Windows with Composer 1.x and PHP 5.4.
257-
* @link https://github.com/composer/composer/issues/10495
258-
*/
259-
if (static::onWindows() === true && \CLI_PHP_MINOR === '5.4' && strpos(\COMPOSER_VERSION, '1') === 0) {
260-
$config['config']['disable-tls'] = true;
261-
}
262-
263255
$encoded = json_encode($config, \JSON_UNESCAPED_SLASHES | \JSON_PRETTY_PRINT);
264256
if (json_last_error() !== \JSON_ERROR_NONE || $encoded === false) {
265257
throw new RuntimeException('Provided configuration can not be encoded to valid JSON');

0 commit comments

Comments
 (0)