[TASK] change intval() to (int) 83/53183/3
authorDanielRuf <daniel@daniel-ruf.de>
Sat, 10 Jun 2017 21:58:51 +0000 (23:58 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Mon, 12 Jun 2017 09:12:36 +0000 (11:12 +0200)
Typecasting with (int) is about 2-3 times faster than using intval().

Change-Id: Ifddcaaf9bf5c1fa77c632df10cba62c82d4614d1
Resolves: #81544
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/53183
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/indexed_search/Classes/Controller/SearchController.php
typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php
typo3/sysext/workspaces/Classes/Controller/AbstractController.php

index 0301b23..5edf1f0 100644 (file)
@@ -1312,7 +1312,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
         if ($row['data_page_mp']) {
             $urlParameters['MP'] = $row['data_page_mp'];
         }
-        $urlParameters['L'] = intval($row['sys_language_uid']);
+        $urlParameters['L'] = (int)$row['sys_language_uid'];
         // markup-GET vars:
         $urlParameters = array_merge($urlParameters, $markUpSwParams);
         // This will make sure that the path is retrieved if it hasn't been
@@ -1544,7 +1544,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
      */
     protected function getNumberOfResults($numberOfResults)
     {
-        $numberOfResults = intval($numberOfResults);
+        $numberOfResults = (int)$numberOfResults;
 
         return (in_array($numberOfResults, $this->availableResultsNumbers)) ?
             $numberOfResults : $this->defaultResultNumber;
index dfc84e1..f6e98fc 100644 (file)
@@ -97,8 +97,8 @@ class RecyclerModuleController extends ActionController
             $this->allowDelete = (bool)$modTS['properties']['allowDelete'];
         }
 
-        if (isset($modTS['properties']['recordsPageLimit']) && intval($modTS['properties']['recordsPageLimit']) > 0) {
-            $this->recordsPageLimit = intval($modTS['properties']['recordsPageLimit']);
+        if (isset($modTS['properties']['recordsPageLimit']) && (int)$modTS['properties']['recordsPageLimit'] > 0) {
+            $this->recordsPageLimit = (int)$modTS['properties']['recordsPageLimit'];
         }
     }
 
index 1b530aa..40eb444 100644 (file)
@@ -59,7 +59,7 @@ class AbstractController extends ActionController
     protected function initializeAction()
     {
         $this->pageRenderer = $this->getPageRenderer();
-        // @todo Evaluate how the intval() call can be used with Extbase validators/filters
+        // @todo Evaluate how the (int) typecast can be used with Extbase validators/filters
         $this->pageId = (int)GeneralUtility::_GP('id');
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         $lang = $this->getLanguageService();