[TASK] Use in_array instead of array_search 69/57469/2
authorWouter Wolters <typo3@wouterwolters.nl>
Wed, 4 Jul 2018 19:04:04 +0000 (21:04 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 6 Jul 2018 13:36:10 +0000 (15:36 +0200)
Resolves: #85480
Releases: master
Change-Id: I0c666be36a30add9742fdba33d8211daf839fcf9
Reviewed-on: https://review.typo3.org/57469
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Reviewed-by: Rudy Gnodde <rgn@windinternet.nl>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/extbase/Classes/Mvc/Cli/RequestBuilder.php
typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php
typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php

index 716af45..7886f10 100644 (file)
@@ -218,10 +218,10 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
                 if ($expectedArgumentType !== 'boolean') {
                     return $possibleValue;
                 }
-                if (array_search($possibleValue, ['on', '1', 'y', 'yes', 'true', 'TRUE']) !== false) {
+                if (in_array($possibleValue, ['on', '1', 'y', 'yes', 'true', 'TRUE'], true)) {
                     return true;
                 }
-                if (array_search($possibleValue, ['off', '0', 'n', 'no', 'false', 'FALSE']) !== false) {
+                if (in_array($possibleValue, ['off', '0', 'n', 'no', 'false', 'FALSE'], true)) {
                     return false;
                 }
                 array_unshift($rawCommandLineArguments, $possibleValue);
index 1d9c500..f59f111 100644 (file)
@@ -313,10 +313,10 @@ class ObjectAccess
         if (!is_object($object)) {
             throw new \InvalidArgumentException('$object must be an object, ' . gettype($object) . ' given.', 1259828920);
         }
-        if ($object instanceof \stdClass && array_search($propertyName, array_keys(get_object_vars($object))) !== false) {
+        if ($object instanceof \stdClass && array_key_exists($propertyName, get_object_vars($object))) {
             return true;
         }
-        if (array_search($propertyName, array_keys(get_class_vars(get_class($object)))) !== false) {
+        if (array_key_exists($propertyName, get_class_vars(get_class($object)))) {
             return true;
         }
         return is_callable([$object, self::buildSetterMethodName($propertyName)]);
index f7523f1..f062f21 100644 (file)
@@ -289,7 +289,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
         foreach ($this->modTS['searchFields.'] as $table => $fieldList) {
             $fields = GeneralUtility::trimExplode(',', $fieldList, true);
             foreach ($fields as $field) {
-                if (!$searchFields || !is_array($searchFields[$table]) || array_search($field, $searchFields[$table]) === false) {
+                if (!$searchFields || !is_array($searchFields[$table]) || !in_array($field, $searchFields[$table], true)) {
                     $searchFields[$table][] = $field;
                 }
             }