[CLEANUP] Replace count with empty in EXT:extbase 93/40693/4
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 27 Jun 2015 15:39:39 +0000 (17:39 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 3 Jul 2015 20:35:22 +0000 (22:35 +0200)
Resolves: #67786
Releases: master
Change-Id: I5b8e088c8a6d33117aca9189ff1f6606b2ca7592
Reviewed-on: http://review.typo3.org/40693
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Reviewed-by: Markus Sommer <markussom@posteo.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
27 files changed:
typo3/sysext/extbase/Classes/Command/HelpCommandController.php
typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php
typo3/sysext/extbase/Classes/Error/Result.php
typo3/sysext/extbase/Classes/Mvc/Cli/Command.php
typo3/sysext/extbase/Classes/Mvc/Cli/CommandManager.php
typo3/sysext/extbase/Classes/Mvc/Cli/RequestBuilder.php
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php
typo3/sysext/extbase/Classes/Mvc/Controller/MvcPropertyMappingConfigurationService.php
typo3/sysext/extbase/Classes/Mvc/RequestHandlerResolver.php
typo3/sysext/extbase/Classes/Mvc/Web/Response.php
typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php
typo3/sysext/extbase/Classes/Object/Container/ClassInfo.php
typo3/sysext/extbase/Classes/Object/Container/Container.php
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php
typo3/sysext/extbase/Classes/Property/PropertyMappingConfiguration.php
typo3/sysext/extbase/Classes/Reflection/DocCommentParser.php
typo3/sysext/extbase/Classes/Scheduler/Task.php
typo3/sysext/extbase/Classes/Service/ExtensionService.php
typo3/sysext/extbase/Classes/Service/FlexFormService.php
typo3/sysext/extbase/Classes/Utility/ArrayUtility.php
typo3/sysext/extbase/Classes/Utility/DebuggerUtility.php
typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php
typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php

index 66eaf17..373f6c2 100644 (file)
@@ -137,14 +137,14 @@ class HelpCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandCon
                                }
                        }
                }
-               if (count($argumentDescriptions) > 0) {
+               if (!empty($argumentDescriptions)) {
                        $this->outputLine();
                        $this->outputLine('ARGUMENTS:');
                        foreach ($argumentDescriptions as $argumentDescription) {
                                $this->outputLine($argumentDescription);
                        }
                }
-               if (count($optionDescriptions) > 0) {
+               if (!empty($optionDescriptions)) {
                        $this->outputLine();
                        $this->outputLine('OPTIONS:');
                        foreach ($optionDescriptions as $optionDescription) {
index a74a248..ab6f17a 100644 (file)
@@ -113,7 +113,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst
                                        $list[] = $this->contentObject->getTreeList($pid, $this->contentObject->data['recursive']);
                                }
                        }
-                       if (count($list) > 0) {
+                       if (!empty($list)) {
                                $pages = $pages . ',' . implode(',', $list);
                        }
                        \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($frameworkConfiguration, array(
@@ -160,7 +160,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst
                                $flexFormConfiguration = array();
                        }
                }
-               if (is_array($flexFormConfiguration) && count($flexFormConfiguration)) {
+               if (is_array($flexFormConfiguration) && !empty($flexFormConfiguration)) {
                        $frameworkConfiguration = $this->mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $flexFormConfiguration, 'settings');
                        $frameworkConfiguration = $this->mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $flexFormConfiguration, 'persistence');
                        $frameworkConfiguration = $this->mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $flexFormConfiguration, 'view');
@@ -211,7 +211,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst
                        }
                        $newSwitchableControllerActionsFromFlexForm[$controller][] = $action;
                }
-               if (count($newSwitchableControllerActionsFromFlexForm) > 0) {
+               if (!empty($newSwitchableControllerActionsFromFlexForm)) {
                        $this->overrideSwitchableControllerActions($frameworkConfiguration, $newSwitchableControllerActionsFromFlexForm);
                }
                return $frameworkConfiguration;
index e4fd1ce..3ac2ec7 100644 (file)
@@ -225,7 +225,7 @@ class Result {
         * @return \TYPO3\CMS\Extbase\Error\Result
         */
        public function recurseThroughResult(array $pathSegments) {
-               if (count($pathSegments) === 0) {
+               if (empty($pathSegments)) {
                        return $this;
                }
 
@@ -312,7 +312,7 @@ class Result {
         * @return bool
         */
        protected function hasProperty($propertyName, $checkerMethodName) {
-               if (count($this->{$propertyName}) > 0) {
+               if (!empty($this->{$propertyName})) {
                        return TRUE;
                }
                foreach ($this->propertyResults as $subResult) {
@@ -406,7 +406,7 @@ class Result {
         * @return void
         */
        public function flattenTree($propertyName, &$result, $level) {
-               if (count($this->$propertyName) > 0) {
+               if (!empty($this->$propertyName)) {
                        $result[implode('.', $level)] = $this->$propertyName;
                }
                foreach ($this->propertyResults as $subPropertyName => $subResult) {
index 3027520..41ebbfc 100644 (file)
@@ -129,7 +129,7 @@ class Command {
         */
        public function getShortDescription() {
                $lines = explode(LF, $this->getCommandMethodReflection()->getDescription());
-               return count($lines) > 0 ? trim($lines[0]) : '<no description available>';
+               return !empty($lines) ? trim($lines[0]) : '<no description available>';
        }
 
        /**
@@ -158,7 +158,7 @@ class Command {
         * @return bool
         */
        public function hasArguments() {
-               return count($this->getCommandMethodReflection()->getParameters()) > 0;
+               return !empty($this->getCommandMethodReflection()->getParameters());
        }
 
        /**
index 3ba9dda..be9f68a 100644 (file)
@@ -84,7 +84,7 @@ class CommandManager implements \TYPO3\CMS\Core\SingletonInterface {
                                $matchedCommands[] = $command;
                        }
                }
-               if (count($matchedCommands) === 0) {
+               if (empty($matchedCommands)) {
                        throw new \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException('No command could be found that matches the command identifier "' . $commandIdentifier . '".', 1310556663);
                }
                if (count($matchedCommands) > 1) {
index 0f6bb7e..c13bfe1 100644 (file)
@@ -61,7 +61,7 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface {
                $request->setCallingScript($callingScript);
                $request->setControllerObjectName(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
                $rawCommandLineArguments = is_array($commandLine) ? $commandLine : explode(' ', $commandLine);
-               if (count($rawCommandLineArguments) === 0) {
+               if (empty($rawCommandLineArguments)) {
                        $request->setControllerCommandName('helpStub');
                        return $request;
                }
@@ -113,7 +113,7 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface {
                $decidedToUseNamedArguments = FALSE;
                $decidedToUseUnnamedArguments = FALSE;
                $argumentIndex = 0;
-               while (count($rawCommandLineArguments) > 0) {
+               while (!empty($rawCommandLineArguments)) {
                        $rawArgument = array_shift($rawCommandLineArguments);
                        if ($rawArgument[0] === '-') {
                                if ($rawArgument[1] === '-') {
@@ -135,7 +135,7 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface {
                                        unset($requiredArguments[$argumentName]);
                                }
                        } else {
-                               if (count($requiredArguments) > 0) {
+                               if (!empty($requiredArguments)) {
                                        if ($decidedToUseNamedArguments) {
                                                throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentMixingException(sprintf('Unexpected unnamed argument "%s". If you use named arguments, all required arguments must be passed named.', $rawArgument), 1309971820);
                                        }
@@ -196,7 +196,7 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface {
                        $currentArgument .= $possibleValue;
                }
                $splitArgument = explode('=', $currentArgument, 2);
-               while ((!isset($splitArgument[1]) || trim($splitArgument[1]) === '') && count($rawCommandLineArguments) > 0) {
+               while ((!isset($splitArgument[1]) || trim($splitArgument[1]) === '') && !empty($rawCommandLineArguments)) {
                        $currentArgument .= array_shift($rawCommandLineArguments);
                        $splitArgument = explode('=', $currentArgument);
                }
index fe24cc8..72e7f62 100644 (file)
@@ -216,7 +216,7 @@ class ActionController extends AbstractController {
                        $validator = $parameterValidators[$argument->getName()];
 
                        $baseValidatorConjunction = $this->validatorResolver->getBaseValidatorConjunction($argument->getDataType());
-                       if (count($baseValidatorConjunction) > 0 && $validator instanceof AbstractCompositeValidator) {
+                       if (!empty($baseValidatorConjunction) && $validator instanceof AbstractCompositeValidator) {
                                $validator->addValidator($baseValidatorConjunction);
                        }
                        $argument->setValidator($validator);
index 86270b2..f1e1f3f 100644 (file)
@@ -54,13 +54,14 @@ class MvcPropertyMappingConfigurationService implements \TYPO3\CMS\Core\Singleto
                foreach ($formFieldNames as $formField) {
                        $formFieldParts = explode('[', $formField);
                        $currentPosition = &$formFieldArray;
-                       for ($i = 0; $i < count($formFieldParts); $i++) {
+                       $formFieldPartsCount = count($formFieldParts);
+                       for ($i = 0; $i < $formFieldPartsCount; $i++) {
                                $formFieldPart = $formFieldParts[$i];
                                $formFieldPart = rtrim($formFieldPart, ']');
                                if (!is_array($currentPosition)) {
                                        throw new \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException('The form field "' . $formField . '" is declared as array, but it collides with a previous form field of the same name which declared the field as string. This is an inconsistency you need to fix inside your Fluid form. (String overridden by Array)', 1255072196);
                                }
-                               if ($i === count($formFieldParts) - 1) {
+                               if ($i === $formFieldPartsCount - 1) {
                                        if (isset($currentPosition[$formFieldPart]) && is_array($currentPosition[$formFieldPart])) {
                                                throw new \TYPO3\CMS\Extbase\Security\Exception\InvalidArgumentForHashGenerationException('The form field "' . $formField . '" is declared as string, but it collides with a previous form field of the same name which declared the field as array. This is an inconsistency you need to fix inside your Fluid form. (Array overridden by String)', 1255072587);
                                        }
index 1c1fa59..a06e0a3 100644 (file)
@@ -57,7 +57,7 @@ class RequestHandlerResolver {
                                $suitableRequestHandlers[$priority] = $requestHandler;
                        }
                }
-               if (count($suitableRequestHandlers) === 0) {
+               if (empty($suitableRequestHandlers)) {
                        throw new \TYPO3\CMS\Extbase\Mvc\Exception('No suitable request handler found.', 1205414233);
                }
                ksort($suitableRequestHandlers);
index 56bbb6c..0ba317c 100644 (file)
@@ -282,7 +282,7 @@ class Response extends \TYPO3\CMS\Extbase\Mvc\Response {
         * @return null|string
         */
        public function shutdown() {
-               if (count($this->getAdditionalHeaderData()) > 0) {
+               if (!empty($this->getAdditionalHeaderData())) {
                        $this->getTypoScriptFrontendController()->additionalHeaderData[] = implode(LF, $this->getAdditionalHeaderData());
                }
                $this->sendHeaders();
index 183fb4e..b2e248b 100644 (file)
@@ -685,14 +685,14 @@ class UriBuilder {
                        $targetPageType = $this->extensionService->getTargetPageTypeByFormat($this->request->getControllerExtensionName(), $this->format);
                        $typolinkConfiguration['parameter'] .= ',' . $targetPageType;
                }
-               if (count($this->arguments) > 0) {
+               if (!empty($this->arguments)) {
                        $arguments = $this->convertDomainObjectsToIdentityArrays($this->arguments);
                        $this->lastArguments = $arguments;
                        $typolinkConfiguration['additionalParams'] = GeneralUtility::implodeArrayForUrl(NULL, $arguments);
                }
                if ($this->addQueryString === TRUE) {
                        $typolinkConfiguration['addQueryString'] = 1;
-                       if (count($this->argumentsToBeExcludedFromQueryString) > 0) {
+                       if (!empty($this->argumentsToBeExcludedFromQueryString)) {
                                $typolinkConfiguration['addQueryString.'] = array(
                                        'exclude' => implode(',', $this->argumentsToBeExcludedFromQueryString)
                                );
index fa126d6..31cca4a 100644 (file)
@@ -151,14 +151,14 @@ class ClassInfo {
         * @return bool
         */
        public function hasInjectMethods() {
-               return count($this->injectMethods) > 0;
+               return !empty($this->injectMethods);
        }
 
        /**
         * @return bool
         */
        public function hasInjectProperties() {
-               return count($this->injectProperties) > 0;
+               return !empty($this->injectProperties);
        }
 
 }
index 8d9147e..adb179e 100644 (file)
@@ -162,7 +162,7 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface {
                }
                $className = \TYPO3\CMS\Core\Core\ClassLoadingInformation::getClassNameForAlias($className);
                if (isset($this->singletonInstances[$className])) {
-                       if (count($givenConstructorArguments) > 0) {
+                       if (!empty($givenConstructorArguments)) {
                                throw new \TYPO3\CMS\Extbase\Object\Exception('Object "' . $className . '" fetched from singleton cache, thus, explicit constructor arguments are not allowed.', 1292857934);
                        }
                        return $this->singletonInstances[$className];
@@ -197,7 +197,7 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface {
        protected function instanciateObject(\TYPO3\CMS\Extbase\Object\Container\ClassInfo $classInfo, array $givenConstructorArguments) {
                $className = $classInfo->getClassName();
                $classIsSingleton = $classInfo->getIsSingleton();
-               if ($classIsSingleton && count($givenConstructorArguments) > 0) {
+               if ($classIsSingleton && !empty($givenConstructorArguments)) {
                        throw new \TYPO3\CMS\Extbase\Object\Exception('Object "' . $className . '" has explicit constructor arguments but is a singleton; this is not allowed.', 1292858051);
                }
                $constructorArguments = $this->getConstructorArguments($className, $classInfo, $givenConstructorArguments);
index 37e9799..cdc8797 100644 (file)
@@ -354,7 +354,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
                                $row[$columnMap->getColumnName()] = $this->dataMapper->getPlainValue($propertyValue, $columnMap);
                        }
                }
-               if (count($row) > 0) {
+               if (!empty($row)) {
                        $this->updateObject($object, $row);
                        $object->_memorizeCleanState();
                }
@@ -570,7 +570,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
                                        $row[$parentTableFieldName] = '';
                                }
                                $relationTableMatchFields = $parentColumnMap->getRelationTableMatchFields();
-                               if (is_array($relationTableMatchFields) && count($relationTableMatchFields)) {
+                               if (is_array($relationTableMatchFields) && !empty($relationTableMatchFields)) {
                                        $row = array_merge(array_fill_keys(array_keys($relationTableMatchFields), ''), $row);
                                }
                        }
@@ -578,7 +578,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
                        if (!empty($childSortByFieldName)) {
                                $row[$childSortByFieldName] = 0;
                        }
-                       if (count($row) > 0) {
+                       if (!empty($row)) {
                                $this->updateObject($object, $row);
                        }
                } elseif ($parentColumnMap->getTypeOfRelation() === \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
index 715700a..f6c2617 100644 (file)
@@ -312,7 +312,7 @@ class DataMapFactory implements \TYPO3\CMS\Core\SingletonInterface {
                        $fieldEvaluations = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $columnConfiguration['eval'], TRUE);
                        $dateTimeEvaluations = array('date', 'datetime');
 
-                       if (count(array_intersect($dateTimeEvaluations, $fieldEvaluations)) > 0 && !empty($columnConfiguration['dbType'])) {
+                       if (!empty(array_intersect($dateTimeEvaluations, $fieldEvaluations)) && !empty($columnConfiguration['dbType'])) {
                                $columnMap->setDateTimeStorageFormat($columnConfiguration['dbType']);
                        }
                }
index 9c507cd..7bcff55 100644 (file)
@@ -382,7 +382,7 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface {
                } else {
                        $constraint = $query->in('uid', \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $fieldValue));
                }
-               if (count($relationTableMatchFields) > 0) {
+               if (!empty($relationTableMatchFields)) {
                        foreach ($relationTableMatchFields as $relationTableMatchFieldName => $relationTableMatchFieldValue) {
                                $constraint = $query->logicalAnd($constraint, $query->equals($relationTableMatchFieldName, $relationTableMatchFieldValue));
                        }
index 3d04866..1310c73 100644 (file)
@@ -656,7 +656,7 @@ class Typo3DbBackend implements BackendInterface, \TYPO3\CMS\Core\SingletonInter
        protected function getFrontendConstraintStatement($tableName, $ignoreEnableFields, array $enableFieldsToBeIgnored = array(), $includeDeleted) {
                $statement = '';
                if ($ignoreEnableFields && !$includeDeleted) {
-                       if (count($enableFieldsToBeIgnored)) {
+                       if (!empty($enableFieldsToBeIgnored)) {
                                // array_combine() is necessary because of the way \TYPO3\CMS\Frontend\Page\PageRepository::enableFields() is implemented
                                $statement .= $this->getPageRepository()->enableFields($tableName, -1, array_combine($enableFieldsToBeIgnored, $enableFieldsToBeIgnored));
                        } else {
index a236820..71fac7c 100644 (file)
@@ -543,7 +543,7 @@ class Typo3DbQueryParser implements \TYPO3\CMS\Core\SingletonInterface {
        protected function getFrontendConstraintStatement($tableName, $ignoreEnableFields, array $enableFieldsToBeIgnored = array(), $includeDeleted) {
                $statement = '';
                if ($ignoreEnableFields && !$includeDeleted) {
-                       if (count($enableFieldsToBeIgnored)) {
+                       if (!empty($enableFieldsToBeIgnored)) {
                                // array_combine() is necessary because of the way \TYPO3\CMS\Frontend\Page\PageRepository::enableFields() is implemented
                                $statement .= $this->getPageRepository()->enableFields($tableName, -1, array_combine($enableFieldsToBeIgnored, $enableFieldsToBeIgnored));
                        } else {
index 9733888..95cdca0 100644 (file)
@@ -354,7 +354,7 @@ class PropertyMappingConfiguration implements PropertyMappingConfigurationInterf
         * @return \TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration (or a subclass thereof)
         */
        public function traverseProperties(array $splittedPropertyPath) {
-               if (count($splittedPropertyPath) === 0) {
+               if (empty($splittedPropertyPath)) {
                        return $this;
                }
 
index 81adeed..721ca9a 100644 (file)
@@ -44,7 +44,7 @@ class DocCommentParser {
                foreach ($lines as $line) {
                        if ($line !== '' && strpos($line, '@') !== FALSE) {
                                $this->parseTag(substr($line, strpos($line, '@')));
-                       } elseif (count($this->tags) === 0) {
+                       } elseif (empty($this->tags)) {
                                $this->description .= preg_replace('/\\s*\\/?[\\\\*]*(.*)$/', '$1', $line) . LF;
                        }
                }
index 68f2847..430436a 100644 (file)
@@ -160,7 +160,7 @@ class Task extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
         */
        public function getAdditionalInformation() {
                $label = $this->commandIdentifier;
-               if (count($this->arguments) > 0) {
+               if (!empty($this->arguments)) {
                        $arguments = array();
                        foreach ($this->arguments as $argumentName => $argumentValue) {
                                if ($argumentValue != $this->defaults[$argumentName]) {
index 93dfc61..ad0ec42 100644 (file)
@@ -100,7 +100,7 @@ class ExtensionService implements \TYPO3\CMS\Core\SingletonInterface {
                if (count($pluginNames) > 1) {
                        throw new \TYPO3\CMS\Extbase\Exception('There is more than one plugin that can handle this request (Extension: "' . $extensionName . '", Controller: "' . $controllerName . '", action: "' . $actionName . '"). Please specify "pluginName" argument', 1280825466);
                }
-               return count($pluginNames) > 0 ? $pluginNames[0] : NULL;
+               return !empty($pluginNames) ? $pluginNames[0] : NULL;
        }
 
        /**
@@ -144,7 +144,7 @@ class ExtensionService implements \TYPO3\CMS\Core\SingletonInterface {
                                if (count($pages) > 1) {
                                        throw new \TYPO3\CMS\Extbase\Exception('There is more than one "' . $pluginSignature . '" plugin in the current page tree. Please remove one plugin or set the TypoScript configuration "plugin.tx_' . $pluginSignature . '.view.defaultPid" to a fixed page id', 1280773643);
                                }
-                               $this->targetPidPluginCache[$pluginSignature] = count($pages) > 0 ? $pages[0]['pid'] : NULL;
+                               $this->targetPidPluginCache[$pluginSignature] = !empty($pages) ? $pages[0]['pid'] : NULL;
                        }
                        return $this->targetPidPluginCache[$pluginSignature];
 
index 8ce0b8b..45a6266 100644 (file)
@@ -86,7 +86,8 @@ class FlexFormService implements \TYPO3\CMS\Core\SingletonInterface {
                                if (strpos($nodeKey, '.')) {
                                        $nodeKeyParts = explode('.', $nodeKey);
                                        $currentNode = &$return;
-                                       for ($i = 0; $i < count($nodeKeyParts) - 1; $i++) {
+                                       $nodeKeyPartsCount = count($nodeKeyParts);
+                                       for ($i = 0; $i < $nodeKeyPartsCount - 1; $i++) {
                                                $currentNode = &$currentNode[$nodeKeyParts[$i]];
                                        }
                                        $newNode = array(next($nodeKeyParts) => $nodeValue);
index d5f333a..7fec3df 100644 (file)
@@ -127,7 +127,7 @@ class ArrayUtility {
         * @api
         */
        static public function containsMultipleTypes(array $array) {
-               if (count($array) > 0) {
+               if (!empty($array)) {
                        foreach ($array as $value) {
                                if (!isset($previousType)) {
                                        $previousType = gettype($value);
@@ -174,11 +174,10 @@ class ArrayUtility {
                }
                $key = array_shift($path);
                if (isset($array[$key])) {
-                       if (count($path) > 0) {
+                       if (!empty($path)) {
                                return is_array($array[$key]) ? self::getValueByPath($array[$key], $path) : NULL;
-                       } else {
-                               return $array[$key];
                        }
+                       return $array[$key];
                } else {
                        return NULL;
                }
@@ -203,7 +202,7 @@ class ArrayUtility {
                        throw new \InvalidArgumentException('setValueByPath() expects $path to be string or array, "' . gettype($path) . '" given.', 1305111499);
                }
                $key = array_shift($path);
-               if (count($path) === 0) {
+               if (empty($path)) {
                        $subject[$key] = $value;
                } else {
                        if (!isset($subject[$key]) || !is_array($subject[$key])) {
@@ -229,7 +228,7 @@ class ArrayUtility {
                        throw new \InvalidArgumentException('unsetValueByPath() expects $path to be string or array, "' . gettype($path) . '" given.', 1305111513);
                }
                $key = array_shift($path);
-               if (count($path) === 0) {
+               if (empty($path)) {
                        unset($array[$key]);
                } else {
                        if (!isset($array[$key]) || !is_array($array[$key])) {
index ff1fdf9..0741edf 100644 (file)
@@ -276,7 +276,7 @@ class DebuggerUtility {
                                $dump .= '<span class="debug-filtered">max depth</span>';
                        }
                } elseif ($level > 1 && !$object instanceof \DateTime && !$plainText) {
-                       if (($object instanceof \Countable && count($object) === 0) || (count($classReflection->getProperties()) === 0)) {
+                       if (($object instanceof \Countable && count($object) === 0) || empty($classReflection->getProperties())) {
                                $dump = '<span>' . $dump . '</span>';
                        } else {
                                $dump = '<input type="checkbox" id="' . spl_object_hash($object) . '" /><span class="debug-header">' . $dump . '</span>';
index 6b3fbd3..f0e8bde 100644 (file)
@@ -94,7 +94,7 @@ class LocalizationUtility {
                                if (!empty(self::$LOCAL_LANG_charset[$extensionName][self::$languageKey][$key])) {
                                        $value = self::convertCharset($value, self::$LOCAL_LANG_charset[$extensionName][self::$languageKey][$key]);
                                }
-                       } elseif (count(self::$alternativeLanguageKeys)) {
+                       } elseif (!empty(self::$alternativeLanguageKeys)) {
                                $languages = array_reverse(self::$alternativeLanguageKeys);
                                foreach ($languages as $language) {
                                        if (!empty(self::$LOCAL_LANG[$extensionName][$language][$key][0]['target'])
index c95eee3..9d75737 100644 (file)
@@ -143,7 +143,7 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface {
                if ($methodParameters === NULL) {
                        $methodParameters = $this->reflectionService->getMethodParameters($className, $methodName);
                }
-               if (count($methodParameters) === 0) {
+               if (empty($methodParameters)) {
                        return $validatorConjunctions;
                }
 
@@ -273,7 +273,7 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface {
                                                $objectValidator->addPropertyValidator($classPropertyName, $collectionValidator);
                                        } elseif (class_exists($propertyTargetClassName) && !TypeHandlingUtility::isCoreType($propertyTargetClassName) && $this->objectManager->isRegistered($propertyTargetClassName) && $this->objectManager->getScope($propertyTargetClassName) === \TYPO3\CMS\Extbase\Object\Container\Container::SCOPE_PROTOTYPE) {
                                                $validatorForProperty = $this->getBaseValidatorConjunction($propertyTargetClassName, $validationGroups);
-                                               if (count($validatorForProperty) > 0) {
+                                               if (!empty($validatorForProperty)) {
                                                        $objectValidator->addPropertyValidator($classPropertyName, $validatorForProperty);
                                                }
                                        }
@@ -305,7 +305,7 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface {
                                }
                        }
 
-                       if (count($objectValidator->getPropertyValidators()) > 0) {
+                       if (!empty($objectValidator->getPropertyValidators())) {
                                $conjunctionValidator->addValidator($objectValidator);
                        }
                }