From 3dc98c647dd2de9fed7993e11c084ca9b947a515 Mon Sep 17 00:00:00 2001 From: Michael Moravec Date: Fri, 5 Jan 2018 05:27:22 +0100 Subject: [PATCH] Drop Doctrine\DBAL\Version in favor of Ocramius\PackageVersions --- UPGRADE.md | 6 ++++ build.properties | 3 -- build.xml | 23 ------------ composer.json | 3 +- .../DBAL/Tools/Console/ConsoleRunner.php | 4 +-- lib/Doctrine/DBAL/Version.php | 36 ------------------- 6 files changed, 10 insertions(+), 65 deletions(-) delete mode 100644 lib/Doctrine/DBAL/Version.php diff --git a/UPGRADE.md b/UPGRADE.md index 2847c786413..35f609819ab 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,3 +1,9 @@ +# Upgrade to 3.0 + +## BC BREAK: Removed Doctrine\DBAL\Version + +The Doctrine\DBAL\Version class is no longer available: please refrain from checking the DBAL version at runtime. + # Upgrade to 2.6 ## MINOR BC BREAK: `fetch()` and `fetchAll()` method signatures in `Doctrine\DBAL\Driver\ResultStatement` diff --git a/build.properties b/build.properties index 309e0e2105c..e69de29bb2d 100644 --- a/build.properties +++ b/build.properties @@ -1,3 +0,0 @@ -# Version class and file -project.version_class = Doctrine\\DBAL\\Version -project.version_file = lib/Doctrine/DBAL/Version.php diff --git a/build.xml b/build.xml index 064a6084e7e..95f80d42398 100644 --- a/build.xml +++ b/build.xml @@ -38,29 +38,6 @@ - - - - - - - - - - - - - - - - - diff --git a/composer.json b/composer.json index 67de86199d9..056f5405d46 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "require": { "php": "^7.1", "ext-pdo": "*", - "doctrine/common": "^2.7.1" + "doctrine/common": "^2.7.1", + "ocramius/package-versions": "^1.2" }, "require-dev": { "doctrine/coding-standard": "^1.0", diff --git a/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php b/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php index 0642594ee3e..69098e2ea8e 100644 --- a/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php +++ b/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php @@ -7,7 +7,7 @@ use Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand; use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand; use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper; -use Doctrine\DBAL\Version; +use PackageVersions\Versions; use Symfony\Component\Console\Application; use Symfony\Component\Console\Helper\HelperSet; @@ -40,7 +40,7 @@ public static function createHelperSet(Connection $connection) */ public static function run(HelperSet $helperSet, $commands = []) { - $cli = new Application('Doctrine Command Line Interface', Version::VERSION); + $cli = new Application('Doctrine Command Line Interface', Versions::getVersion('doctrine/dbal')); $cli->setCatchExceptions(true); $cli->setHelperSet($helperSet); diff --git a/lib/Doctrine/DBAL/Version.php b/lib/Doctrine/DBAL/Version.php deleted file mode 100644 index b3e2ac7cd21..00000000000 --- a/lib/Doctrine/DBAL/Version.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - */ -class Version -{ - /** - * Current Doctrine Version. - */ - const VERSION = '3.0.0-DEV'; - - /** - * Compares a Doctrine version with the current one. - * - * @param string $version The Doctrine version to compare to. - * - * @return integer -1 if older, 0 if it is the same, 1 if version passed as argument is newer. - */ - public static function compare($version) - { - $currentVersion = str_replace(' ', '', strtolower(self::VERSION)); - $version = str_replace(' ', '', $version); - - return version_compare($version, $currentVersion); - } -}