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

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

parent 3d862a7a
# 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.
......
# Version class and file
project.version_class = Doctrine\\DBAL\\Version
project.version_file = lib/Doctrine/DBAL/Version.php
......@@ -38,29 +38,6 @@
</exec>
</target>
<target name="make-release" depends="check-git-checkout-clean,prepare,php">
<replace file="${project.version_file}" token="-DEV" value="" failOnNoReplacements="true" />
<exec executable="${php_executable}" outputproperty="doctrine.current_version" failonerror="true">
<arg value="-r" />
<arg value="require_once '${project.version_file}';echo ${project.version_class}::VERSION;" />
</exec>
<exec executable="${php_executable}" outputproperty="doctrine.next_version" failonerror="true">
<arg value="-r" />
<arg value="$parts = explode('.', str_ireplace(array('-DEV', '-ALPHA', '-BETA'), '', '${doctrine.current_version}'));
if (count($parts) != 3) {
throw new \InvalidArgumentException('Version is assumed in format x.y.z, ${doctrine.current_version} given');
}
$parts[2]++;
echo implode('.', $parts);
" />
</exec>
<git-commit file="${project.version_file}" message="Release ${doctrine.current_version}" />
<git-tag version="${doctrine.current_version}" />
<replace file="${project.version_file}" token="${doctrine.current_version}" value="${doctrine.next_version}-DEV" />
<git-commit file="${project.version_file}" message="Bump version to ${doctrine.next_version}" />
</target>
<target name="check-git-checkout-clean">
<exec executable="git" failonerror="true">
<arg value="diff-index" />
......
......@@ -23,7 +23,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": "^5.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": "e29af4401242f1274b7201f78128343d",
"content-hash": "aa8c419d7e09c6754e7f58789037136f",
"packages": [
{
"name": "doctrine/cache",
......@@ -153,6 +153,55 @@
"eventmanager"
],
"time": "2018-06-11T11:59:03+00:00"
},
{
"name": "ocramius/package-versions",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/PackageVersions.git",
"reference": "4489d5002c49d55576fa0ba786f42dbb009be46f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/4489d5002c49d55576fa0ba786f42dbb009be46f",
"reference": "4489d5002c49d55576fa0ba786f42dbb009be46f",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0.0",
"php": "^7.1.0"
},
"require-dev": {
"composer/composer": "^1.6.3",
"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": "2018-02-05T13:05:30+00:00"
}
],
"packages-dev": [
......@@ -1048,55 +1097,6 @@
],
"time": "2018-06-03T11:33:10+00:00"
},
{
"name": "ocramius/package-versions",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/PackageVersions.git",
"reference": "4489d5002c49d55576fa0ba786f42dbb009be46f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/4489d5002c49d55576fa0ba786f42dbb009be46f",
"reference": "4489d5002c49d55576fa0ba786f42dbb009be46f",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0.0",
"php": "^7.1.0"
},
"require-dev": {
"composer/composer": "^1.6.3",
"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": "2018-02-05T13:05:30+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.
*/
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