Skip to content

Commit 43eb0cb

Browse files
committed
fix: use php constants to detect the PHP version
1 parent 84694bc commit 43eb0cb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

bin/doctum.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/usr/bin/env php
22
<?php
33

4-
if (PHP_VERSION_ID < 70100) {
5-
echo 'You need to use PHP 7.1 to run Doctum.' . PHP_EOL;
6-
$majorVersion = (int) (PHP_VERSION_ID / 10000);
7-
$minorVersion = (int) substr((string) PHP_VERSION_ID, -4, 2);
8-
echo 'Current detected version: (' . $majorVersion . '.' . $minorVersion . ') (' . PHP_VERSION_ID . ').' . PHP_EOL;
4+
if (PHP_MAJOR_VERSION <= 7 && PHP_MINOR_VERSION < 1) {
5+
echo 'You need to use PHP 7.1 or above to run Doctum.' . PHP_EOL;
6+
echo 'Current detected version: (' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . ') (' . PHP_VERSION_ID . ').' . PHP_EOL;
97
exit(1);
108
}
119

0 commit comments

Comments
 (0)