Bladeren bron

added simple quoted string support

tags/0.1.11
Robin Thoni 8 jaren geleden
bovenliggende
commit
dff6010a3a
2 gewijzigde bestanden met toevoegingen van 4 en 4 verwijderingen
  1. 2
    2
      src/Utils/Business/LuDocParser.php
  2. 2
    2
      tests/LuDocParserTest.php

+ 2
- 2
src/Utils/Business/LuDocParser.php Bestand weergeven

133
                         $constraint->setMethod($methodName);
133
                         $constraint->setMethod($methodName);
134
                         $args = [];
134
                         $args = [];
135
                         $argMatches = [];
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
                             $args = $argMatches[1];
137
                             $args = $argMatches[1];
138
                             foreach ($args as $key => $arg) {
138
                             foreach ($args as $key => $arg) {
139
-                                if ($arg[0] == '"') {
139
+                                if ($arg[0] == '"' || $arg[0] == "'") {
140
                                     $args[$key] = substr($arg, 1, count($arg) - 2);
140
                                     $args[$key] = substr($arg, 1, count($arg) - 2);
141
                                 }
141
                                 }
142
                             }
142
                             }

+ 2
- 2
tests/LuDocParserTest.php Bestand weergeven

91
      * @min 42
91
      * @min 42
92
      * @max 42
92
      * @max 42
93
      * @between 0 42
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
      * and another
95
      * and another
96
      * @return AnotherType
96
      * @return AnotherType
97
      */');
97
      */');
112
                     ["Method" => "min", "Arguments" => ["42"]],
112
                     ["Method" => "min", "Arguments" => ["42"]],
113
                     ["Method" => "max", "Arguments" => ["42"]],
113
                     ["Method" => "max", "Arguments" => ["42"]],
114
                     ["Method" => "between", "Arguments" => ["0", "42"]],
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
         ];

Laden…
Annuleren
Opslaan