Skip to content

Commit

Permalink
Use constant instead of function
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasReker committed Dec 8, 2018
1 parent da69e20 commit 13c78e0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions classes/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static function run($ptr, $arg = 0)

public static function test_phpversion()
{
return version_compare(substr(phpversion(), 0, 5), '5.6.0', '>=');
return version_compare(substr(PHP_VERSION, 0, 5), '5.6.0', '>=');
}

public static function test_apache_mod_rewrite()
Expand All @@ -156,7 +156,7 @@ public static function test_apache_mod_rewrite()

public static function test_new_phpversion()
{
return version_compare(substr(phpversion(), 0, 5), '5.6.0', '>=');
return version_compare(substr(PHP_VERSION, 0, 5), '5.6.0', '>=');
}

public static function test_mysql_support()
Expand Down
4 changes: 2 additions & 2 deletions classes/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -3365,7 +3365,7 @@ public static function isX86_64arch()
*/
public static function isPHPCLI()
{
return defined('STDIN') || (Tools::strtolower(php_sapi_name()) == 'cli' && (!isset($_SERVER['REMOTE_ADDR']) || empty($_SERVER['REMOTE_ADDR'])));
return defined('STDIN') || (Tools::strtolower(PHP_SAPI) == 'cli' && (!isset($_SERVER['REMOTE_ADDR']) || empty($_SERVER['REMOTE_ADDR'])));
}

public static function argvToGET($argc, $argv)
Expand Down Expand Up @@ -3637,7 +3637,7 @@ public static function unSerialize($serialized, $object = false)
*/
public static function arrayUnique($array)
{
if (version_compare(phpversion(), '5.2.9', '<')) {
if (version_compare(PHP_VERSION, '5.2.9', '<')) {
return array_unique($array);
} else {
return array_unique($array, SORT_REGULAR);
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Hosting/HostingInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getServerInformation()
private function getPhpInformation()
{
return array(
'version' => phpversion(),
'version' => PHP_VERSION,
'memoryLimit' => ini_get('memory_limit'),
'maxExecutionTime' => ini_get('max_execution_time'),
'maxFileSizeUpload' => ini_get('upload_max_filesize'),
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Requirement/CheckRequirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private function getErrorMessages()
'fopen' => $this->translator->trans('Allow the PHP fopen() function on your server.', array(), 'Admin.Advparameters.Notification'),
'gz' => $this->translator->trans('Enable GZIP compression on your server.', array(), 'Admin.Advparameters.Notification'),
'files' => $this->translator->trans('Some PrestaShop files are missing from your server.', array(), 'Admin.Advparameters.Notification'),
'new_phpversion' => $this->translator->trans('You are using PHP %s version. Soon, the latest PHP version supported by PrestaShop will be PHP 5.6. To make sure you’re ready for the future, we recommend you to upgrade to PHP 5.6 now!', array('%s' => phpversion()), 'Admin.Advparameters.Notification'),
'new_phpversion' => $this->translator->trans('You are using PHP %s version. Soon, the latest PHP version supported by PrestaShop will be PHP 5.6. To make sure you’re ready for the future, we recommend you to upgrade to PHP 5.6 now!', array('%s' => PHP_VERSION), 'Admin.Advparameters.Notification'),
'apache_mod_rewrite' => $this->translator->trans('Enable the Apache mod_rewrite module', array(), 'Admin.Advparameters.Notification'),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function getContent()
public function __call($name, $arguments)
{
if (!empty(self::$_batch_mode)) {
self::$_defered_func_call[get_class().'::__call_'.$name] = array(array($this, '__call'), array($name, $arguments));
self::$_defered_func_call[__CLASS__.'::__call_'.$name] = array(array($this, '__call'), array($name, $arguments));
} else {
if (!Validate::isHookName($name)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion tools/build/CreateRelease.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
$consoleWrite = new ConsoleWriter();
$lineSeparator = PHP_EOL;

if (php_sapi_name() !== 'cli') {
if (PHP_SAPI !== 'cli') {
$consoleWrite->displayText(
"ERROR:{$lineSeparator}Must be run has a CLI script.{$lineSeparator}",
ConsoleWriter::COLOR_RED
Expand Down
2 changes: 1 addition & 1 deletion tools/profiling/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ protected function displayProfilingConfiguration()
<div class="col-4">
<table class="table table-condensed">
<tr><td>PrestaShop Version</td><td>'._PS_VERSION_.'</td></tr>
<tr><td>PHP Version</td><td>'.$this->getPhpVersionColor(phpversion()).'</td></tr>
<tr><td>PHP Version</td><td>'.$this->getPhpVersionColor(PHP_VERSION).'</td></tr>
<tr><td>MySQL Version</td><td>'.$this->getMySQLVersionColor(Db::getInstance()->getVersion()).'</td></tr>
<tr><td>Memory Limit</td><td>'.ini_get('memory_limit').'</td></tr>
<tr><td>Max Execution Time</td><td>'.ini_get('max_execution_time').'s</td></tr>
Expand Down

0 comments on commit 13c78e0

Please sign in to comment.