diff --git a/app/code/Magento/Analytics/Model/Cryptographer.php b/app/code/Magento/Analytics/Model/Cryptographer.php index efddcb501aabb..d6fe613e6d096 100644 --- a/app/code/Magento/Analytics/Model/Cryptographer.php +++ b/app/code/Magento/Analytics/Model/Cryptographer.php @@ -135,6 +135,6 @@ private function validateCipherMethod($cipherMethod) ); $cipherMethod = strtolower($cipherMethod); - return (false !== array_search($cipherMethod, $methods)); + return in_array($cipherMethod, $methods); } } diff --git a/app/code/Magento/Backend/Model/Menu/Item/Validator.php b/app/code/Magento/Backend/Model/Menu/Item/Validator.php index 7b72b355f551d..8da155a63427f 100644 --- a/app/code/Magento/Backend/Model/Menu/Item/Validator.php +++ b/app/code/Magento/Backend/Model/Menu/Item/Validator.php @@ -122,7 +122,7 @@ private function assertContainsRequiredParameters($data) */ private function assertIdentifierIsNotUsed($id) { - if (array_search($id, $this->_ids) !== false) { + if (in_array($id, $this->_ids)) { throw new \InvalidArgumentException('Item with id ' . $id . ' already exists'); } } diff --git a/app/code/Magento/Cms/Model/ResourceModel/Block.php b/app/code/Magento/Cms/Model/ResourceModel/Block.php index 30e817713755c..49fe1be0fd2e8 100644 --- a/app/code/Magento/Cms/Model/ResourceModel/Block.php +++ b/app/code/Magento/Cms/Model/ResourceModel/Block.php @@ -187,7 +187,7 @@ public function getIsUniqueBlockToStores(AbstractModel $object) $stores = (array)$object->getData('store_id'); $isDefaultStore = $this->_storeManager->isSingleStoreMode() - || array_search(Store::DEFAULT_STORE_ID, $stores) !== false; + || in_array(Store::DEFAULT_STORE_ID, $stores); if (!$isDefaultStore) { $stores[] = Store::DEFAULT_STORE_ID; diff --git a/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php b/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php index fffa4503e14a7..dcfbb2df2361b 100644 --- a/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php +++ b/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php @@ -182,7 +182,7 @@ private function getDependentIndexerIds(string $indexerId) $dependentIndexerIds = []; foreach (array_keys($this->getConfig()->getIndexers()) as $id) { $dependencies = $this->getDependencyInfoProvider()->getIndexerIdsToRunBefore($id); - if (array_search($indexerId, $dependencies) !== false) { + if (in_array($indexerId, $dependencies)) { $dependentIndexerIds = array_merge( $dependentIndexerIds, [$id], diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchAttributeTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchAttributeTest.php index b2a49a5543015..f7226baf41327 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchAttributeTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchAttributeTest.php @@ -29,7 +29,7 @@ public function processAssert( $availableAttributes = $advancedSearch->getForm()->getFormLabels(); if (isset($attributeForSearch['isVisible'])) { \PHPUnit\Framework\Assert::assertTrue( - (false !== array_search($attributeForSearch['name'], $availableAttributes)), + (in_array($attributeForSearch['name'], $availableAttributes)), 'Attribute ' . $attributeForSearch['name'] . 'was not found in Advanced Search Page.' ); } else { diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/Route/RouteMapper.php b/dev/tests/static/framework/Magento/TestFramework/Dependency/Route/RouteMapper.php index 315bb2ae26b02..f650b95d97baf 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/Route/RouteMapper.php +++ b/dev/tests/static/framework/Magento/TestFramework/Dependency/Route/RouteMapper.php @@ -306,7 +306,7 @@ private function getModuleActionsMapping(string $module, string $routerId, array { $subdirectoryPattern = str_replace('\\', DIRECTORY_SEPARATOR, $module); $subdirectoryPattern .= DIRECTORY_SEPARATOR . 'Controller/'; - if (array_search($routerId, [Area::AREA_ADMINHTML, Area::AREA_ADMIN], true) !== false) { + if (in_array($routerId, [Area::AREA_ADMINHTML, Area::AREA_ADMIN], true)) { $subdirectoryPattern .= ucfirst(Area::AREA_ADMINHTML) . DIRECTORY_SEPARATOR; } else { $subdirectoryPattern .= '(?!' . ucfirst(Area::AREA_ADMINHTML) . ')'; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Dependency/DeclarativeSchemaDependencyProvider.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Dependency/DeclarativeSchemaDependencyProvider.php index 965bc6184144b..796437eb26308 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Dependency/DeclarativeSchemaDependencyProvider.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Dependency/DeclarativeSchemaDependencyProvider.php @@ -194,7 +194,7 @@ private function filterSelfDependency(string $moduleName, array $dependencies):a $decodedId = $this->decodeDependencyId($id); $entityType = $decodedId['entityType']; if ($entityType === self::SCHEMA_ENTITY_TABLE || $entityType === "column") { - if (array_search($moduleName, $modules) !== false) { + if (in_array($moduleName, $modules)) { unset($dependencies[$id]); } } else { diff --git a/lib/internal/Magento/Framework/Data/Structure.php b/lib/internal/Magento/Framework/Data/Structure.php index b22395f1ba835..ae0061c0fc350 100644 --- a/lib/internal/Magento/Framework/Data/Structure.php +++ b/lib/internal/Magento/Framework/Data/Structure.php @@ -621,7 +621,7 @@ protected function _insertChild($targetParentId, $elementId, $offset, $alias) ) ); } - if (false !== array_search($alias, $children)) { + if (in_array($alias, $children)) { throw new LocalizedException( new \Magento\Framework\Phrase( 'The element "%1" can\'t have a child because "%1" already has a child with alias "%2".', diff --git a/lib/internal/Magento/Framework/Indexer/Config/DependencyInfoProvider.php b/lib/internal/Magento/Framework/Indexer/Config/DependencyInfoProvider.php index 661f9f9c0ff80..b6294cceadcee 100644 --- a/lib/internal/Magento/Framework/Indexer/Config/DependencyInfoProvider.php +++ b/lib/internal/Magento/Framework/Indexer/Config/DependencyInfoProvider.php @@ -46,7 +46,7 @@ public function getIndexerIdsToRunAfter(string $indexerId): array $this->getIndexerDataWithValidation($indexerId); $result = []; foreach ($this->config->getIndexers() as $id => $indexerData) { - if (array_search($indexerId, $indexerData['dependencies']) !== false) { + if (in_array($indexerId, $indexerData['dependencies'])) { $result[] = $id; } }