Skip to content

Commit

Permalink
[TASK] Use PHP_SAPI, PHP_VERSION and M_PI constant instead of functon…
Browse files Browse the repository at this point in the history
…s calls

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>
  • Loading branch information
wouter90 authored and NeoBlack committed Jul 18, 2018
1 parent bc191e1 commit ffede9f
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion typo3/install/index.php
@@ -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');
}

Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/backend/Resources/Private/Php/backend.php
Expand Up @@ -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');
}

Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Console/CommandApplication.php
Expand Up @@ -57,7 +57,7 @@ public function run(callable $execute = null)
*/
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);
}
}
Expand Down
6 changes: 3 additions & 3 deletions typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
Expand Up @@ -676,7 +676,7 @@ public function makeText(&$im, $conf, $workArea)
*/
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
Expand Down Expand Up @@ -1341,11 +1341,11 @@ public function circleOffset($distance, $iterations)
$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)));
}
Expand Down
Expand Up @@ -34,7 +34,7 @@ protected function setUp()
$this->injectDependenciesIntoViewHelper($this->viewHelper);
$this->viewHelper->setRenderChildrenClosure(
function () {
return pi();
return M_PI;
}
);
}
Expand Down Expand Up @@ -88,7 +88,7 @@ public function formatNumberWithDecimals()
public function formatNumberWithThousandsSeparator()
{
$this->viewHelper->setRenderChildrenClosure(function () {
return pi() * 1000;
return M_PI * 1000;
});
$this->setArgumentsUnderTest(
$this->viewHelper,
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/frontend/Resources/Private/Php/frontend.php
Expand Up @@ -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');
}

Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/install/Classes/SystemEnvironment/Check.php
Expand Up @@ -250,7 +250,7 @@ protected function checkMemorySettings()
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'
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/install/Resources/Private/Php/install.php
Expand Up @@ -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');
}

Expand Down

0 comments on commit ffede9f

Please sign in to comment.