mirror of
https://github.com/cerbero90/json-parser.git
synced 2025-06-10 10:25:29 +02:00
Set default configuration if none is provided
This commit is contained in:
parent
0e8130aabf
commit
a3a63d36e8
@ -13,6 +13,13 @@ use Traversable;
|
||||
*/
|
||||
abstract class Source implements IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* The configuration.
|
||||
*
|
||||
* @var Config
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The cached size of the JSON source.
|
||||
*
|
||||
@ -47,9 +54,9 @@ abstract class Source implements IteratorAggregate
|
||||
* @param mixed $source
|
||||
* @param Config|null $config
|
||||
*/
|
||||
final public function __construct(protected mixed $source, protected Config $config = null)
|
||||
final public function __construct(protected mixed $source, Config $config = null)
|
||||
{
|
||||
$this->config ??= new Config();
|
||||
$this->config = $config ?: new Config();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user