Version.php 792 B

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