Skip to content

Commit

Permalink
Merge pull request #5 from nicolas-grekas/deprec-annot
Browse files Browse the repository at this point in the history
Replace runtime warning by docblock annotation
  • Loading branch information
Seldaek authored Jul 10, 2020
2 parents b980588 + 53232fc commit 7a8001f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/PackageVersions/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ final class Installer implements PluginInterface, EventSubscriberInterface
* @see \PackageVersions\Installer
*
* This file is overwritten at every run of `composer install` or `composer update`.
*
* @deprecated in favor of the Composer\InstalledVersions class provided by Composer 2. Require composer-runtime-api:^2 to ensure it is present.
*/
%s
{
Expand Down Expand Up @@ -160,10 +162,6 @@ private static function writeVersionClassToFile(string $versionClassSource, Comp
rename($installPathTmp, $installPath);

$io->write('<info>composer/package-versions-deprecated:</info> ...done generating version class');

if (version_compare(PluginInterface::PLUGIN_API_VERSION, '2.0.0', '>=')) {
$io->write('<info>composer/package-versions-deprecated:</info> <warning>You should rely on the Composer\InstalledVersions class instead of this package as you are using Composer 2. You can require composer-runtime-api:^2 to ensure it is present.</warning>');
}
}

/**
Expand Down
8 changes: 8 additions & 0 deletions test/PackageVersionsTest/InstallerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ public function testDumpVersionsClass()
* @see \PackageVersions\Installer
*
* This file is overwritten at every run of `composer install` or `composer update`.
*
* @deprecated in favor of the Composer\InstalledVersions class provided by Composer 2. Require composer-runtime-api:^2 to ensure it is present.
*/
final class Versions
{
Expand Down Expand Up @@ -332,6 +334,8 @@ public function testDumpVersionsClassNoDev()
* @see \PackageVersions\Installer
*
* This file is overwritten at every run of `composer install` or `composer update`.
*
* @deprecated in favor of the Composer\InstalledVersions class provided by Composer 2. Require composer-runtime-api:^2 to ensure it is present.
*/
final class Versions
{
Expand Down Expand Up @@ -451,6 +455,8 @@ public function testDumpVersionsWithoutPackageSourceDetails()
* @see \PackageVersions\Installer
*
* This file is overwritten at every run of `composer install` or `composer update`.
*
* @deprecated in favor of the Composer\InstalledVersions class provided by Composer 2. Require composer-runtime-api:^2 to ensure it is present.
*/
final class Versions
{
Expand Down Expand Up @@ -863,6 +869,8 @@ public function testGetVersionsIsNotNormalizedForRootPackage()
* @see \PackageVersions\Installer
*
* This file is overwritten at every run of `composer install` or `composer update`.
*
* @deprecated in favor of the Composer\InstalledVersions class provided by Composer 2. Require composer-runtime-api:^2 to ensure it is present.
*/
final class Versions
{
Expand Down

0 comments on commit 7a8001f

Please sign in to comment.