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
88
88
$ exposedHeaders = $ options ['exposedHeaders ' ] ?? $ options ['exposed_headers ' ] ?? $ this ->exposedHeaders ;
89
89
$ this ->exposedHeaders = $ exposedHeaders === false ? [] : $ exposedHeaders ;
90
90
91
- $ this ->validateOptions ();
92
91
$ this ->normalizeOptions ();
93
92
}
94
93
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
-
111
94
private function normalizeOptions (): void
112
95
{
113
96
// Normalize case
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ public function itAllowsZeroMaxAge(): void
201
201
*/
202
202
public function itThrowsExceptionOnInvalidExposedHeaders (): void
203
203
{
204
- $ this ->expectException (InvalidOptionException ::class);
204
+ $ this ->expectException (\TypeError ::class);
205
205
206
206
/** @phpstan-ignore-next-line */
207
207
$ service = new CorsService (['exposedHeaders ' => true ]);
@@ -212,7 +212,7 @@ public function itThrowsExceptionOnInvalidExposedHeaders(): void
212
212
*/
213
213
public function itThrowsExceptionOnInvalidOriginsArray (): void
214
214
{
215
- $ this ->expectException (InvalidOptionException ::class);
215
+ $ this ->expectException (\TypeError ::class);
216
216
217
217
/** @phpstan-ignore-next-line */
218
218
$ service = new CorsService (['allowedOrigins ' => 'string ' ]);
You can’t perform that action at this time.
0 commit comments