REST: HeaderContainer should start empty not null
authorTim Starling <tstarling@wikimedia.org>
Mon, 10 Jun 2019 21:01:39 +0000 (07:01 +1000)
committerTim Starling <tstarling@wikimedia.org>
Fri, 14 Jun 2019 07:01:15 +0000 (17:01 +1000)
Change-Id: I30b68862307f2b44e4f5708c06464e0a218c1ed5

includes/Rest/HeaderContainer.php
tests/phpunit/includes/Rest/HeaderContainerTest.php

index 50f4355..a71f6a6 100644 (file)
@@ -10,9 +10,9 @@ namespace MediaWiki\Rest;
  * Unlike PSR-7, the container is mutable.
  */
 class HeaderContainer {
-       private $headerLists;
-       private $headerLines;
-       private $headerNames;
+       private $headerLists = [];
+       private $headerLines = [];
+       private $headerNames = [];
 
        /**
         * Erase any existing headers and replace them with the specified
index d0fae9f..e0dbfdf 100644 (file)
@@ -42,6 +42,7 @@ class HeaderContainerTest extends MediaWikiTestCase {
                                [ 'tesT' => [ 'bar' ] ],
                                [ 'tesT' => 'bar' ]
                        ],
+                       'empty' => [ [], [], [] ],
                ];
        }