Skip to content

Commit 7b1570d

Browse files
committed
Allow options to be ArrayAccess
1 parent e15d84b commit 7b1570d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/JsPhpize/JsPhpizeOptions.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace JsPhpize;
44

5+
use ArrayAccess;
56
use JsPhpize\Lexer\Pattern;
67

78
class JsPhpizeOptions
@@ -25,9 +26,9 @@ class JsPhpizeOptions
2526
*
2627
* @param array $options list of options.
2728
*/
28-
public function __construct(array $options = array())
29+
public function __construct($options = array())
2930
{
30-
$this->options = $options;
31+
$this->options = is_array($options) || $options instanceof ArrayAccess ? $options : array();
3132
if (!isset($this->options['patterns'])) {
3233
$this->options['patterns'] = array(
3334
new Pattern(10, 'newline', '\n'),

0 commit comments

Comments
 (0)