11<?php
22
3- /*
4- * This file is part of the JsonSchema package.
5- *
6- * For the full copyright and license information, please view the LICENSE
7- * file that was distributed with this source code.
8- */
3+ declare (strict_types=1 );
94
105namespace JsonSchema \Tests \Constraints ;
116
@@ -15,10 +10,9 @@ class AdditionalPropertiesTest extends BaseTestCase
1510{
1611 protected $ validateSchema = true ;
1712
18- public function getInvalidTests (): array
13+ public function getInvalidTests (): \ Generator
1914 {
20- return [
21- [
15+ yield [
2216 '{
2317 "prop":"1",
2418 "patternProp":"3",
@@ -49,8 +43,8 @@ public function getInvalidTests(): array
4943 'context ' => Validator::ERROR_DOCUMENT_VALIDATION
5044 ]
5145 ]
52- ],
53- [
46+ ];
47+ yield [
5448 '{
5549 "prop":"1",
5650 "additionalProp":"2"
@@ -62,8 +56,8 @@ public function getInvalidTests(): array
6256 },
6357 "additionalProperties": false
6458 } '
65- ],
66- [
59+ ];
60+ yield [
6761 '{
6862 "prop":"1",
6963 "additionalProp":2
@@ -75,8 +69,8 @@ public function getInvalidTests(): array
7569 },
7670 "additionalProperties": {"type":"string"}
7771 } '
78- ],
79- [
72+ ];
73+ yield [
8074 '{
8175 "prop":"1",
8276 "additionalProp":2
@@ -88,8 +82,8 @@ public function getInvalidTests(): array
8882 },
8983 "additionalProperties": {"type":"string"}
9084 } '
91- ],
92- [
85+ ];
86+ yield [
9387 '{
9488 "prop1": "a",
9589 "prop2": "b"
@@ -100,8 +94,8 @@ public function getInvalidTests(): array
10094 "type": "boolean"
10195 }
10296 } '
103- ],
104- [
97+ ];
98+ yield [
10599 '{
106100 "prop1": "a",
107101 "prop2": "b"
@@ -110,14 +104,12 @@ public function getInvalidTests(): array
110104 "type": "object",
111105 "additionalProperties": false
112106 } '
113- ],
114- ];
107+ ];
115108 }
116109
117- public function getValidTests (): array
110+ public function getValidTests (): \ Generator
118111 {
119- return [
120- [
112+ yield [
121113 '{
122114 "prop":"1",
123115 "additionalProp":"2"
@@ -128,8 +120,8 @@ public function getValidTests(): array
128120 "prop":{"type":"string"}
129121 }
130122 } '
131- ],
132- [
123+ ];
124+ yield [
133125 '{
134126 "prop":"1",
135127 "additionalProp":"2"
@@ -140,8 +132,8 @@ public function getValidTests(): array
140132 "prop":{"type":"string"}
141133 }
142134 } '
143- ],
144- [
135+ ];
136+ yield [
145137 '{
146138 "prop":"1",
147139 "additionalProp":"2"
@@ -153,8 +145,8 @@ public function getValidTests(): array
153145 },
154146 "additionalProperties": {"type":"string"}
155147 } '
156- ],
157- [
148+ ];
149+ yield [
158150 '{
159151 "prop":"1",
160152 "additionalProp":[]
@@ -166,8 +158,8 @@ public function getValidTests(): array
166158 },
167159 "additionalProperties": true
168160 } '
169- ],
170- [
161+ ];
162+ yield [
171163 '{
172164 "prop1": "a",
173165 "prop2": "b"
@@ -178,8 +170,8 @@ public function getValidTests(): array
178170 "type": "string"
179171 }
180172 } '
181- ],
182- [
173+ ];
174+ yield [
183175 '{
184176 "prop1": "a",
185177 "prop2": "b"
@@ -188,8 +180,8 @@ public function getValidTests(): array
188180 "type": "object",
189181 "additionalProperties": true
190182 } '
191- ],
192- 'additional property casted into int when actually is numeric string (#784) ' => [
183+ ];
184+ yield 'additional property casted into int when actually is numeric string (#784) ' => [
193185 '{
194186 "prop1": {
195187 "123": "a"
@@ -206,7 +198,6 @@ public function getValidTests(): array
206198 }
207199 }
208200 } '
209- ],
210- ];
201+ ];
211202 }
212203}
0 commit comments