Skip to content

Commit 38607ec

Browse files
authored
It is better to use "[]" instead of "array()". (#88)
- "array ()" declaration is not required in function parameters. It will be detected automatically when declared as "Array" type.
1 parent 9a092c1 commit 38607ec

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/CorsService.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ class CorsService
1818
{
1919
private $options;
2020

21-
public function __construct(array $options = array())
21+
public function __construct(array $options)
2222
{
2323
$this->options = $this->normalizeOptions($options);
2424
}
2525

26-
private function normalizeOptions(array $options = array()): array
26+
private function normalizeOptions(array $options): array
2727
{
28-
$options += array(
29-
'allowedOrigins' => array(),
30-
'allowedOriginsPatterns' => array(),
28+
$options += [
29+
'allowedOrigins' => [],
30+
'allowedOriginsPatterns' => [],
3131
'supportsCredentials' => false,
32-
'allowedHeaders' => array(),
33-
'exposedHeaders' => array(),
34-
'allowedMethods' => array(),
32+
'allowedHeaders' => [],
33+
'exposedHeaders' => [],
34+
'allowedMethods' => [],
3535
'maxAge' => 0,
36-
);
36+
];
3737

3838
// normalize array('*') to true
3939
if (in_array('*', $options['allowedOrigins'])) {

0 commit comments

Comments
 (0)