Test case
1 generated file · +3 −0test/inputs/schema/optional-constraints.schema
Mschema-phpdefault / TopLevel.php+3 −0
| @@ -178,6 +178,9 @@ class TopLevel { | ||
| 178 | 178 | */ |
| 179 | 179 | public static function validateOptPattern(?string $value): bool { |
| 180 | 180 | if (!is_null($value)) { |
| 181 | + if (preg_match('~^[a-z]+$~u', $value) !== 1) { | |
| 182 | + throw new Exception("Attribute Error"); | |
| 183 | + } | |
| 181 | 184 | } |
| 182 | 185 | return true; |
| 183 | 186 | } |
Test case
1 generated file · +9 −0test/inputs/schema/pattern.schema
Mschema-phpdefault / TopLevel.php+9 −0
| @@ -45,6 +45,9 @@ class TopLevel { | ||
| 45 | 45 | * @throws Exception |
| 46 | 46 | */ |
| 47 | 47 | public static function validatePattern1(string $value): bool { |
| 48 | + if (preg_match('~a[.]*~u', $value) !== 1) { | |
| 49 | + throw new Exception("Attribute Error"); | |
| 50 | + } | |
| 48 | 51 | return true; |
| 49 | 52 | } |
| 50 | 53 | |
| @@ -92,6 +95,9 @@ class TopLevel { | ||
| 92 | 95 | * @throws Exception |
| 93 | 96 | */ |
| 94 | 97 | public static function validatePattern2(string $value): bool { |
| 98 | + if (preg_match('~b[.]*~u', $value) !== 1) { | |
| 99 | + throw new Exception("Attribute Error"); | |
| 100 | + } | |
| 95 | 101 | return true; |
| 96 | 102 | } |
| 97 | 103 | |
| @@ -139,6 +145,9 @@ class TopLevel { | ||
| 139 | 145 | * @throws Exception |
| 140 | 146 | */ |
| 141 | 147 | public static function validateUnion(string $value): bool { |
| 148 | + if (preg_match('~(b[.]*)|(c[.]*)~u', $value) !== 1) { | |
| 149 | + throw new Exception("Attribute Error"); | |
| 150 | + } | |
| 142 | 151 | return true; |
| 143 | 152 | } |
Test case
1 generated file · +3 −0test/inputs/schema/renaming-bug.schema
Mschema-phpdefault / TopLevel.php+3 −0
| @@ -54,6 +54,9 @@ class TopLevel { | ||
| 54 | 54 | */ |
| 55 | 55 | public static function validateVersion(?string $value): bool { |
| 56 | 56 | if (!is_null($value)) { |
| 57 | + if (preg_match('~^\\d{1,5}.{1}\\d{1,5}.{1}\\d{1,5}$~u', $value) !== 1) { | |
| 58 | + throw new Exception("Attribute Error"); | |
| 59 | + } | |
| 57 | 60 | } |
| 58 | 61 | return true; |
| 59 | 62 | } |
No generated files match these filters.