From 13c78e06c79b0b07235479a176f21393ad3f29ff Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Sat, 8 Dec 2018 20:08:39 +0100 Subject: [PATCH] Use constant instead of function --- classes/ConfigurationTest.php | 4 ++-- classes/Tools.php | 4 ++-- src/Adapter/Hosting/HostingInformation.php | 2 +- src/Adapter/Requirement/CheckRequirements.php | 2 +- tests-legacy/resources/modules/gamification/gamification.php | 2 +- tools/build/CreateRelease.php | 2 +- tools/profiling/Controller.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/classes/ConfigurationTest.php b/classes/ConfigurationTest.php index 9654392fd1139..07389354d5f72 100644 --- a/classes/ConfigurationTest.php +++ b/classes/ConfigurationTest.php @@ -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() @@ -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() diff --git a/classes/Tools.php b/classes/Tools.php index d8fbb53e49660..3a75bf52210c1 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -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) @@ -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); diff --git a/src/Adapter/Hosting/HostingInformation.php b/src/Adapter/Hosting/HostingInformation.php index 6380ad4fb57f7..f414338d3a808 100644 --- a/src/Adapter/Hosting/HostingInformation.php +++ b/src/Adapter/Hosting/HostingInformation.php @@ -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'), diff --git a/src/Adapter/Requirement/CheckRequirements.php b/src/Adapter/Requirement/CheckRequirements.php index 6dea6129c9a15..f9e6c6e7c35d1 100644 --- a/src/Adapter/Requirement/CheckRequirements.php +++ b/src/Adapter/Requirement/CheckRequirements.php @@ -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'), ); } diff --git a/tests-legacy/resources/modules/gamification/gamification.php b/tests-legacy/resources/modules/gamification/gamification.php index 393942494700b..c67cd61a534af 100644 --- a/tests-legacy/resources/modules/gamification/gamification.php +++ b/tests-legacy/resources/modules/gamification/gamification.php @@ -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; diff --git a/tools/build/CreateRelease.php b/tools/build/CreateRelease.php index 5ade6ade1b885..5c5187ee19e5f 100644 --- a/tools/build/CreateRelease.php +++ b/tools/build/CreateRelease.php @@ -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 diff --git a/tools/profiling/Controller.php b/tools/profiling/Controller.php index 30ab79b2eb179..4d2ec65825e7e 100644 --- a/tools/profiling/Controller.php +++ b/tools/profiling/Controller.php @@ -436,7 +436,7 @@ protected function displayProfilingConfiguration()
- +
PrestaShop Version'._PS_VERSION_.'
PHP Version'.$this->getPhpVersionColor(phpversion()).'
PHP Version'.$this->getPhpVersionColor(PHP_VERSION).'
MySQL Version'.$this->getMySQLVersionColor(Db::getInstance()->getVersion()).'
Memory Limit'.ini_get('memory_limit').'
Max Execution Time'.ini_get('max_execution_time').'s