File tree Expand file tree Collapse file tree 2 files changed +2
-19
lines changed
Expand file tree Collapse file tree 2 files changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -88,26 +88,9 @@ public function setOptions(array $options): void
8888 $ exposedHeaders = $ options ['exposedHeaders ' ] ?? $ options ['exposed_headers ' ] ?? $ this ->exposedHeaders ;
8989 $ this ->exposedHeaders = $ exposedHeaders === false ? [] : $ exposedHeaders ;
9090
91- $ this ->validateOptions ();
9291 $ this ->normalizeOptions ();
9392 }
9493
95- private function validateOptions (): void
96- {
97- $ arrayHeaders = [
98- 'allowedOrigins ' ,
99- 'allowedOriginsPatterns ' ,
100- 'allowedHeaders ' ,
101- 'allowedMethods ' ,
102- 'exposedHeaders ' ,
103- ];
104- foreach ($ arrayHeaders as $ key ) {
105- if (!is_array ($ this ->{$ key })) {
106- throw new InvalidOptionException ("CORS option ` {$ key }` should be an array " );
107- }
108- }
109- }
110-
11194 private function normalizeOptions (): void
11295 {
11396 // Normalize case
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ public function itAllowsZeroMaxAge(): void
201201 */
202202 public function itThrowsExceptionOnInvalidExposedHeaders (): void
203203 {
204- $ this ->expectException (InvalidOptionException ::class);
204+ $ this ->expectException (\TypeError ::class);
205205
206206 /** @phpstan-ignore-next-line */
207207 $ service = new CorsService (['exposedHeaders ' => true ]);
@@ -212,7 +212,7 @@ public function itThrowsExceptionOnInvalidExposedHeaders(): void
212212 */
213213 public function itThrowsExceptionOnInvalidOriginsArray (): void
214214 {
215- $ this ->expectException (InvalidOptionException ::class);
215+ $ this ->expectException (\TypeError ::class);
216216
217217 /** @phpstan-ignore-next-line */
218218 $ service = new CorsService (['allowedOrigins ' => 'string ' ]);
You can’t perform that action at this time.
0 commit comments