浏览代码

Bugfix: *really* exclude parameters from examples.

shalvah 5 年之前
父节点
当前提交
762e2e1003

+ 1 - 1
src/Strategies/BodyParameters/GetFromBodyParamTag.php

@@ -60,7 +60,7 @@ class GetFromBodyParamTag extends Strategy
             })
             ->mapWithKeys(function ($tag) {
                 preg_match('/(.+?)\s+(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
-                $content = preg_replace('/\s?No-example.?/', '', $content);
+                $content = preg_replace('/Example:\s*No-example.?/', '', $content);
                 if (empty($content)) {
                     // this means only name and type were supplied
                     list($name, $type) = preg_split('/\s+/', $tag->getContent());

+ 1 - 1
src/Strategies/QueryParameters/GetFromQueryParamTag.php

@@ -61,7 +61,7 @@ class GetFromQueryParamTag extends Strategy
             })
             ->mapWithKeys(function ($tag) {
                 preg_match('/(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
-                $content = preg_replace('/\s?No-example.?/', '', $content);
+                $content = preg_replace('/Example:\s*No-example.?/', '', $content);
                 if (empty($content)) {
                     // this means only name was supplied
                     list($name) = preg_split('/\s+/', $tag->getContent());

+ 1 - 1
src/Tools/Traits/DocBlockParamHelpers.php

@@ -33,7 +33,7 @@ trait DocBlockParamHelpers
     protected function parseParamDescription(string $description, string $type)
     {
         $example = null;
-        if (preg_match('/(.*)\s+Example:\s*(.*)\s*/', $description, $content)) {
+        if (preg_match('/(.*)\s+Example:\s*(.+)\s*/', $description, $content)) {
             $description = $content[1];
 
             // examples are parsed as strings by default, we need to cast them properly