1<?php 2 3namespace Doctrine\DBAL; 4 5use function str_replace; 6use function strtolower; 7use function version_compare; 8 9/** 10 * Class to store and retrieve the version of Doctrine. 11 */ 12class Version 13{ 14 /** 15 * Current Doctrine Version. 16 */ 17 public const VERSION = '2.9.3'; 18 19 /** 20 * Compares a Doctrine version with the current one. 21 * 22 * @param string $version The Doctrine version to compare to. 23 * 24 * @return int -1 if older, 0 if it is the same, 1 if version passed as argument is newer. 25 */ 26 public static function compare($version) 27 { 28 $currentVersion = str_replace(' ', '', strtolower(self::VERSION)); 29 $version = str_replace(' ', '', $version); 30 31 return version_compare($version, $currentVersion); 32 } 33} 34