Browse Source

Applied array_values to all tagbased strategies

Jean Le Clerc 6 years ago
parent
commit
f75c436e78

+ 5 - 3
src/Tools/ResponseStrategies/ResponseTagStrategy.php

@@ -32,9 +32,11 @@ class ResponseTagStrategy
      */
      */
     protected function getDocBlockResponses(array $tags)
     protected function getDocBlockResponses(array $tags)
     {
     {
-        $responseTags = array_filter($tags, function ($tag) {
-            return $tag instanceof Tag && strtolower($tag->getName()) === 'response';
-        });
+        $responseTags = array_values(
+            array_filter($tags, function ($tag) {
+                return $tag instanceof Tag && strtolower($tag->getName()) === 'response';
+            })
+        );
 
 
         if (empty($responseTags)) {
         if (empty($responseTags)) {
             return;
             return;

+ 5 - 3
src/Tools/ResponseStrategies/TransformerTagsStrategy.php

@@ -127,9 +127,11 @@ class TransformerTagsStrategy
      */
      */
     private function getTransformerTag(array $tags)
     private function getTransformerTag(array $tags)
     {
     {
-        $transFormerTags = array_filter($tags, function ($tag) {
-            return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['transformer', 'transformercollection']);
-        });
+        $transFormerTags = array_values(
+            array_filter($tags, function ($tag) {
+                return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['transformer', 'transformercollection']);
+            })
+        );
 
 
         return array_first($transFormerTags);
         return array_first($transFormerTags);
     }
     }