Unverified Commit cb6710c9 authored by Michael Moravec's avatar Michael Moravec Committed by Sergei Morozov

Drop Doctrine\DBAL\Version in favor of Ocramius\PackageVersions

parent 581467fa
# 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.
## BC BREAK: the PDO symbols are no longer part of the DBAL API
1. The support of `PDO::PARAM_*`, `PDO::FETCH_*`, `PDO::CASE_*` and `PDO::PARAM_INPUT_OUTPUT` constants in the DBAL API is removed.
......
......@@ -34,7 +34,8 @@
"require": {
"php": "^7.2",
"doctrine/cache": "^1.0",
"doctrine/event-manager": "^1.0"
"doctrine/event-manager": "^1.0",
"ocramius/package-versions": "^1.2"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3311fd2852ff0daf31459e8626e7b59d",
"content-hash": "c80faa771bd92a02a1deef849df31e83",
"packages": [
{
"name": "doctrine/cache",
......@@ -153,6 +153,56 @@
"eventmanager"
],
"time": "2018-06-11T11:59:03+00:00"
},
{
"name": "ocramius/package-versions",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/PackageVersions.git",
"reference": "a4d4b60d0e60da2487bd21a2c6ac089f85570dbb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/a4d4b60d0e60da2487bd21a2c6ac089f85570dbb",
"reference": "a4d4b60d0e60da2487bd21a2c6ac089f85570dbb",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0.0",
"php": "^7.1.0"
},
"require-dev": {
"composer/composer": "^1.6.3",
"doctrine/coding-standard": "^5.0.1",
"ext-zip": "*",
"infection/infection": "^0.7.1",
"phpunit/phpunit": "^7.0.0"
},
"type": "composer-plugin",
"extra": {
"class": "PackageVersions\\Installer",
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"PackageVersions\\": "src/PackageVersions"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
}
],
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
"time": "2019-02-21T12:16:21+00:00"
}
],
"packages-dev": [
......@@ -1095,56 +1145,6 @@
],
"time": "2019-08-12T20:17:41+00:00"
},
{
"name": "ocramius/package-versions",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/PackageVersions.git",
"reference": "a4d4b60d0e60da2487bd21a2c6ac089f85570dbb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/a4d4b60d0e60da2487bd21a2c6ac089f85570dbb",
"reference": "a4d4b60d0e60da2487bd21a2c6ac089f85570dbb",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0.0",
"php": "^7.1.0"
},
"require-dev": {
"composer/composer": "^1.6.3",
"doctrine/coding-standard": "^5.0.1",
"ext-zip": "*",
"infection/infection": "^0.7.1",
"phpunit/phpunit": "^7.0.0"
},
"type": "composer-plugin",
"extra": {
"class": "PackageVersions\\Installer",
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"PackageVersions\\": "src/PackageVersions"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
}
],
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
"time": "2019-02-21T12:16:21+00:00"
},
{
"name": "phar-io/manifest",
"version": "1.0.3",
......
......@@ -7,7 +7,7 @@ use Doctrine\DBAL\Tools\Console\Command\ImportCommand;
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\Command\Command;
use Symfony\Component\Console\Helper\HelperSet;
......@@ -38,7 +38,7 @@ class ConsoleRunner
*/
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);
......
<?php
namespace Doctrine\DBAL;
use function str_replace;
use function strtolower;
use function version_compare;
/**
* Class to store and retrieve the version of Doctrine.
*/
class Version
{
/**
* Current Doctrine Version.
*/
public const VERSION = '3.0.0-DEV';
/**
* Compares a Doctrine version with the current one.
*
* @param string $version The Doctrine version to compare to.
*
* @return int -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);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment