[TASK] Make TextfieldViewHelperTest notice free 42/56242/4
authorJan Helke <typo3@helke.de>
Fri, 16 Mar 2018 16:39:19 +0000 (17:39 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 16 Mar 2018 19:25:43 +0000 (20:25 +0100)
Releases: master
Resolves: #84365
Change-Id: I09df5639ba60d7532dd5b8d7dddb1298086fe010
Reviewed-on: https://review.typo3.org/56242
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/TextfieldViewHelper.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/TextfieldViewHelperTest.php

index 977d781..981caa8 100644 (file)
@@ -118,17 +118,17 @@ abstract class AbstractFormFieldViewHelper extends AbstractFormViewHelper
                 'formObjectName'
             );
             if (!empty($formObjectName)) {
-                $propertySegments = explode('.', $this->arguments['property']);
+                $propertySegments = explode('.', $this->arguments['property'] ?? '');
                 $propertyPath = '';
                 foreach ($propertySegments as $segment) {
                     $propertyPath .= '[' . $segment . ']';
                 }
                 $name = $formObjectName . $propertyPath;
             } else {
-                $name = $this->arguments['property'];
+                $name = $this->arguments['property'] ?? '';
             }
         } else {
-            $name = $this->arguments['name'];
+            $name = $this->arguments['name'] ?? '';
         }
         if ($this->hasArgument('value') && is_object($this->arguments['value'])) {
             // @todo Use  $this->persistenceManager->isNewObject() once it is implemented
index 6bf35c2..005664f 100644 (file)
@@ -65,8 +65,8 @@ class TextfieldViewHelper extends AbstractFormFieldViewHelper
      */
     public function render()
     {
-        $required = $this->arguments['required'];
-        $type = $this->arguments['type'];
+        $required = $this->arguments['required'] ?? false;
+        $type = $this->arguments['type'] ?? null;
 
         $name = $this->getName();
         $this->registerFieldNameForFormTokenGeneration($name);
index bdc7e0b..1a8d090 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
 
 /*
@@ -24,11 +25,6 @@ use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;
 class TextfieldViewHelperTest extends ViewHelperBaseTestcase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var TextfieldViewHelper
      */
     protected $viewHelper;