Commit ffede9f9 authored by Wouter Wolters's avatar Wouter Wolters Committed by Frank Nägler
Browse files

[TASK] Use PHP_SAPI, PHP_VERSION and M_PI constant instead of functons calls

Resolves: #85293
Releases: master
Change-Id: Ifabbb20c1ef4ad482df676fe9999dcbdf18eb704
Reviewed-on: https://review.typo3.org/57249

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarRudy Gnodde <rgn@windinternet.nl>
Reviewed-by: default avatarJörg Bösche <typo3@joergboesche.de>
Reviewed-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
parent bc191e17
<?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');
}
......
......@@ -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');
}
......
......@@ -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);
}
}
......
......@@ -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)));
}
......
......@@ -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,
......
......@@ -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');
}
......
......@@ -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'
......
......@@ -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');
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment