Skip to content

Commit

Permalink
Merge pull request #9356 from derrabus/remove/package-versions
Browse files Browse the repository at this point in the history
Remove the `composer/package-versions-deprecated` package
  • Loading branch information
greg0ire authored Jan 11, 2022
2 parents e487b6f + 697e234 commit ec391be
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 1 addition & 2 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ These methods have been deprecated:
## Deprecated `Doctrine\ORM\Version`

The `Doctrine\ORM\Version` class is now deprecated and will be removed in Doctrine ORM 3.0:
please refrain from checking the ORM version at runtime or use
[ocramius/package-versions](https://github.com/Ocramius/PackageVersions/).
please refrain from checking the ORM version at runtime or use Composer's [runtime API](https://getcomposer.org/doc/07-runtime.md#knowing-whether-package-x-is-installed-in-version-y).

## Deprecated `EntityManager#merge()` method

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"sort-packages": true
},
"require": {
"php": "^7.1 ||^8.0",
"php": "^7.1 || ^8.0",
"composer-runtime-api": "^2",
"ext-ctype": "*",
"ext-pdo": "*",
"composer/package-versions-deprecated": "^1.8",
"doctrine/cache": "^1.12.1 || ^2.1.1",
"doctrine/collections": "^1.5",
"doctrine/common": "^3.0.3",
Expand Down
8 changes: 6 additions & 2 deletions lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@

namespace Doctrine\ORM\Tools\Console;

use Composer\InstalledVersions;
use Doctrine\DBAL\Tools\Console as DBALConsole;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\Console\EntityManagerProvider\ConnectionFromManagerProvider;
use Doctrine\ORM\Tools\Console\EntityManagerProvider\HelperSetManagerProvider;
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
use OutOfBoundsException;
use PackageVersions\Versions;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
use Symfony\Component\Console\Helper\HelperSet;

use function assert;
use function class_exists;

/**
Expand Down Expand Up @@ -59,7 +60,10 @@ public static function run($helperSetOrProvider, array $commands = []): void
*/
public static function createApplication($helperSetOrProvider, array $commands = []): Application
{
$cli = new Application('Doctrine Command Line Interface', Versions::getVersion('doctrine/orm'));
$version = InstalledVersions::getVersion('doctrine/orm');
assert($version !== null);

$cli = new Application('Doctrine Command Line Interface', $version);
$cli->setCatchExceptions(true);

if ($helperSetOrProvider instanceof HelperSet) {
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ORM/Tools/Console/ConsoleRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace Doctrine\Tests\ORM\Tools\Console;

use Composer\InstalledVersions;
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Doctrine\ORM\Tools\Console\EntityManagerProvider;
use Doctrine\Tests\DoctrineTestCase;
use PackageVersions\Versions;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\HelperSet;

Expand All @@ -28,7 +28,7 @@ public function testCreateApplicationShouldReturnAnApplicationWithTheCorrectComm
$app = ConsoleRunner::createApplication($helperSet);

self::assertSame($helperSet, $app->getHelperSet());
self::assertSame(Versions::getVersion('doctrine/orm'), $app->getVersion());
self::assertSame(InstalledVersions::getVersion('doctrine/orm'), $app->getVersion());

self::assertTrue($app->has('dbal:reserved-words'));
self::assertTrue($app->has('dbal:run-sql'));
Expand Down

0 comments on commit ec391be

Please sign in to comment.