Skip to content

Commit

Permalink
Add notice to output about deprecation of HHVM and PHP < 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
theseer committed Jul 2, 2017
1 parent 3d38916 commit 57dcf45
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
2 changes: 2 additions & 0 deletions build/phar/autoload.php.in
Expand Up @@ -22,6 +22,8 @@ spl_autoload_register(
Phar::mapPhar('phpdox.phar');
define('PHPDOX_PHAR', 'phpdox.phar');

require 'phar://phpdox.phar/phpdox/runtimecheck.php';

$factory = new TheSeer\phpDox\Factory(
new \TheSeer\phpDox\FileInfo('phar://' . PHPDOX_PHAR),
new \TheSeer\phpDox\Version('___VERSION___')
Expand Down
16 changes: 2 additions & 14 deletions phpdox
Expand Up @@ -40,19 +40,7 @@
*
*/

if (!defined('HHVM_VERSION') && (version_compare(phpversion(), '5.5', 'lt'))) {
fwrite(
STDERR,
sprintf(
"phpDox requires PHP 5.5 or later; " .
"Upgrading to the latest version of PHP is highly recommended. (Version used: %s)\n\n",
phpversion()
)
);

die(1);
}

require __DIR__ . '/src/runtimecheck.php';
require __DIR__ . '/src/autoload.php';

$found = false;
Expand All @@ -73,7 +61,7 @@ if (!$found) {

$factory = new TheSeer\phpDox\Factory(
new \TheSeer\phpDox\FileInfo(__DIR__),
new \TheSeer\phpDox\Version('0.11.0-dev')
new \TheSeer\phpDox\Version('0.10.1')
);
exit($factory->getCLI()->run(
new TheSeer\phpDox\CLIOptions($_SERVER['argv'])
Expand Down
33 changes: 33 additions & 0 deletions src/runtimecheck.php
@@ -0,0 +1,33 @@
<?php

if (defined('HHVM_VERSION')) {
fwrite(
STDERR,
"It seems like you are using HHVM to run phpDox.\nHHVM is no longer a supported environment." .
"Please consider using PHP 7.x.\n\n"
);
return;
}

if ((version_compare(phpversion(), '5.5', 'lt'))) {
fwrite(
STDERR,
sprintf(
"phpDox requires PHP 5.5 or later; " .
"Upgrading to the latest version of PHP is highly recommended. (Version used: %s)\n\n",
phpversion()
)
);

die(1);
}

if ((version_compare(phpversion(), '7.0', 'lt'))) {
fwrite(
STDERR,
sprintf(
"You are using an outdated version of PHP (%s) to run phpDox. Please consider upgrading to PHP 7.x!\n\n",
phpversion()
)
);
}

0 comments on commit 57dcf45

Please sign in to comment.