[TASK] Use PHP_SAPI, PHP_VERSION and M_PI constant instead of functons calls 49/57249/3
authorWouter Wolters <typo3@wouterwolters.nl>
Sun, 17 Jun 2018 15:01:21 +0000 (17:01 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Wed, 18 Jul 2018 17:14:10 +0000 (19:14 +0200)
Resolves: #85293
Releases: master
Change-Id: Ifabbb20c1ef4ad482df676fe9999dcbdf18eb704
Reviewed-on: https://review.typo3.org/57249
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Rudy Gnodde <rgn@windinternet.nl>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/install/index.php
typo3/sysext/backend/Resources/Private/Php/backend.php
typo3/sysext/core/Classes/Console/CommandApplication.php
typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/NumberViewHelperTest.php
typo3/sysext/frontend/Resources/Private/Php/frontend.php
typo3/sysext/install/Classes/SystemEnvironment/Check.php
typo3/sysext/install/Resources/Private/Php/install.php

index d1dee35..34ad236 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 // Exit early if php requirement is not satisfied.
-if (version_compare(PHP_VERSION, '7.2.0', '<')) {
+if (PHP_VERSION_ID < 70200) {
     die('This version of TYPO3 CMS requires PHP 7.2 or above');
 }
 
index 352dbc9..737d56a 100644 (file)
@@ -13,7 +13,7 @@
  */
 
 // Exit early if php requirement is not satisfied.
-if (version_compare(PHP_VERSION, '7.2.0', '<')) {
+if (PHP_VERSION_ID < 70200) {
     die('This version of TYPO3 CMS requires PHP 7.2 or above');
 }
 
index 6941bd6..36c43e6 100644 (file)
@@ -57,7 +57,7 @@ class CommandApplication implements ApplicationInterface
      */
     protected function checkEnvironmentOrDie()
     {
-        if (php_sapi_name() !== 'cli') {
+        if (PHP_SAPI !== 'cli') {
             die('Not called from a command line interface (e.g. a shell or scheduler).' . LF);
         }
     }
index 202dcf6..0ca004b 100644 (file)
@@ -676,7 +676,7 @@ class GraphicalFunctions
      */
     public function txtPosition($conf, $workArea, $BB)
     {
-        $angle = (int)$conf['angle'] / 180 * pi();
+        $angle = (int)$conf['angle'] / 180 * M_PI;
         $conf['angle'] = 0;
         $straightBB = $this->calcBBox($conf);
         // offset, align, valign, workarea
@@ -1341,11 +1341,11 @@ class GraphicalFunctions
         $res = [];
         if ($distance && $iterations) {
             for ($a = 0; $a < $iterations; $a++) {
-                $yOff = round(sin(2 * pi() / $iterations * ($a + 1)) * 100 * $distance);
+                $yOff = round(sin(2 * M_PI / $iterations * ($a + 1)) * 100 * $distance);
                 if ($yOff) {
                     $yOff = (int)(ceil(abs($yOff / 100)) * ($yOff / abs($yOff)));
                 }
-                $xOff = round(cos(2 * pi() / $iterations * ($a + 1)) * 100 * $distance);
+                $xOff = round(cos(2 * M_PI / $iterations * ($a + 1)) * 100 * $distance);
                 if ($xOff) {
                     $xOff = (int)(ceil(abs($xOff / 100)) * ($xOff / abs($xOff)));
                 }
index f5e2a49..271390d 100644 (file)
@@ -34,7 +34,7 @@ class NumberViewHelperTest extends ViewHelperBaseTestcase
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
         $this->viewHelper->setRenderChildrenClosure(
             function () {
-                return pi();
+                return M_PI;
             }
         );
     }
@@ -88,7 +88,7 @@ class NumberViewHelperTest extends ViewHelperBaseTestcase
     public function formatNumberWithThousandsSeparator()
     {
         $this->viewHelper->setRenderChildrenClosure(function () {
-            return pi() * 1000;
+            return M_PI * 1000;
         });
         $this->setArgumentsUnderTest(
             $this->viewHelper,
index 7fddec2..4681a4a 100644 (file)
@@ -13,7 +13,7 @@
  */
 
 // Exit early if php requirement is not satisfied.
-if (version_compare(PHP_VERSION, '7.2.0', '<')) {
+if (PHP_VERSION_ID < 70200) {
     die('This version of TYPO3 CMS requires PHP 7.2 or above');
 }
 
index 6b63986..407be99 100644 (file)
@@ -250,7 +250,7 @@ class Check implements CheckInterface
     protected function checkPhpVersion()
     {
         $minimumPhpVersion = '7.2.0';
-        $currentPhpVersion = phpversion();
+        $currentPhpVersion = PHP_VERSION;
         if (version_compare($currentPhpVersion, $minimumPhpVersion) < 0) {
             $this->messageQueue->enqueue(new FlashMessage(
                 'Your PHP version ' . $currentPhpVersion . ' is too old. TYPO3 CMS does not run'
index 7ce212a..b0a70ee 100644 (file)
@@ -94,7 +94,7 @@
  */
 
 // Exit early if php requirement is not satisfied.
-if (version_compare(PHP_VERSION, '7.2.0', '<')) {
+if (PHP_VERSION_ID < 70200) {
     die('This version of TYPO3 CMS requires PHP 7.2 or above');
 }