Skip to content

Commit

Permalink
BC break: removed deprecated `PackageVersions\Versions::ROOT_PACKAGE_…
Browse files Browse the repository at this point in the history
…NAME` constant

This simplifies the tool to no longer be a plugin: `PackageVersions\Versions` is now a much simpler
class that is no longer generated/written to disk at installation, and `ocramius/package-versions`
is no longer a `"type": "composer-plugin"`, but rather a more usual `"type": "library"` package.

This:

 * Fixes #138 - this library no longer changes `vendor` post-installation
 * Fixes #142 - the `rootPackage` version is now detected via composer, and no longer leads to
   changes in `vendor/ocramius/package-versions/src/PackageVersions/Versions.php` at each change
   of source root in a project
 * Fixes #152 - when `"lock": false` is used in composer, since we no longer access lock file
   information from sources of this package
 * Fixes #107 - writing to `vendor` is no longer happening from this library, so no file access
   rights should be needed.
  • Loading branch information
Ocramius committed Aug 21, 2020
1 parent f51ff2b commit ef69a97
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 1,257 deletions.
20 changes: 0 additions & 20 deletions src/PackageVersions/ComposerV2Plugin.php

This file was deleted.

234 changes: 0 additions & 234 deletions src/PackageVersions/Installer.php

This file was deleted.

13 changes: 0 additions & 13 deletions src/PackageVersions/Versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
*/
final class Versions
{
/**
* @deprecated please use {@see self::rootPackageName()} instead.
* This constant will be removed in version 2.0.0.
*/
public const ROOT_PACKAGE_NAME = 'unknown/root-package@UNKNOWN';

private function __construct()
{
}
Expand All @@ -48,13 +42,6 @@ public static function rootPackageName() : string
*/
public static function getVersion(string $packageName) : string
{
/** @psalm-suppress DeprecatedConstant */
if ($packageName === self::ROOT_PACKAGE_NAME) {
$rootPackage = InstalledVersions::getRootPackage();

return $rootPackage['pretty_version'] . '@' . $rootPackage['reference'];
}

return InstalledVersions::getPrettyVersion($packageName)
. '@' . InstalledVersions::getReference($packageName);
}
Expand Down
Loading

0 comments on commit ef69a97

Please sign in to comment.