Explorar el Código

added simple quoted string support

tags/0.1.11
Robin Thoni hace 8 años
padre
commit
dff6010a3a
Se han modificado 2 ficheros con 4 adiciones y 4 borrados
  1. 2
    2
      src/Utils/Business/LuDocParser.php
  2. 2
    2
      tests/LuDocParserTest.php

+ 2
- 2
src/Utils/Business/LuDocParser.php Ver fichero

@@ -133,10 +133,10 @@ class LuDocParser
133 133
                         $constraint->setMethod($methodName);
134 134
                         $args = [];
135 135
                         $argMatches = [];
136
-                        if (preg_match_all('/ *(-?(?:\d*\.\d+|\d+|true|false|"[^"]*"))/', $line, $argMatches) !== false) {
136
+                        if (preg_match_all('/ *(-?(?:\d*\.\d+|\d+|true|false|"[^"]*"|\'[^\']*\'))/', $line, $argMatches) !== false) {
137 137
                             $args = $argMatches[1];
138 138
                             foreach ($args as $key => $arg) {
139
-                                if ($arg[0] == '"') {
139
+                                if ($arg[0] == '"' || $arg[0] == "'") {
140 140
                                     $args[$key] = substr($arg, 1, count($arg) - 2);
141 141
                                 }
142 142
                             }

+ 2
- 2
tests/LuDocParserTest.php Ver fichero

@@ -91,7 +91,7 @@ class LuDocParserTest extends \PHPUnit_Framework_TestCase
91 91
      * @min 42
92 92
      * @max 42
93 93
      * @between 0 42
94
-     * @another 1 2 42.42 true false "a string"
94
+     * @another 1 2 42.42 true false "a string" \'string\'
95 95
      * and another
96 96
      * @return AnotherType
97 97
      */');
@@ -112,7 +112,7 @@ class LuDocParserTest extends \PHPUnit_Framework_TestCase
112 112
                     ["Method" => "min", "Arguments" => ["42"]],
113 113
                     ["Method" => "max", "Arguments" => ["42"]],
114 114
                     ["Method" => "between", "Arguments" => ["0", "42"]],
115
-                    ["Method" => "another", "Arguments" => ["1", "2", "42.42", "true", "false", "a string"]]
115
+                    ["Method" => "another", "Arguments" => ["1", "2", "42.42", "true", "false", "a string", "string"]]
116 116
                 ]
117 117
             ]
118 118
         ];

Loading…
Cancelar
Guardar