[TASK] Optimization in AbstractViewHelper 91/25491/3
authorWouter Wolters <typo3@wouterwolters.nl>
Mon, 18 Nov 2013 21:27:22 +0000 (22:27 +0100)
committerThomas Maroschik <tmaroschik@dfau.de>
Mon, 18 Nov 2013 22:58:07 +0000 (23:58 +0100)
Small optimization in AbstractViewHelper to fetch the type
after the check for the default value of the argument.

Change-Id: Ie9b68d892f4a20521606709b8fdfba83099c3d70
Resolves: #53746
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/25491
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Thomas Maroschik
Tested-by: Thomas Maroschik
typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php

index 8f46174..0da2c38 100644 (file)
@@ -382,10 +382,11 @@ abstract class AbstractViewHelper {
                }
                foreach ($argumentDefinitions as $argumentName => $registeredArgument) {
                        if ($this->hasArgument($argumentName)) {
-                               $type = $registeredArgument->getType();
                                if ($this->arguments[$argumentName] === $registeredArgument->getDefaultValue()) {
                                        continue;
                                }
+
+                               $type = $registeredArgument->getType();
                                if ($type === 'array') {
                                        if (!is_array($this->arguments[$argumentName]) && !$this->arguments[$argumentName] instanceof \ArrayAccess && !$this->arguments[$argumentName] instanceof \Traversable) {
                                                throw new \InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "array", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '"', 1237900529);