diff --git a/src/JSONSchemaGenerator/Generator.php b/src/JSONSchemaGenerator/Generator.php index 309b22b..708494a 100644 --- a/src/JSONSchemaGenerator/Generator.php +++ b/src/JSONSchemaGenerator/Generator.php @@ -26,7 +26,7 @@ abstract class Generator * @return string * @throws \JSONSchemaGenerator\Parsers\Exceptions\UnmappableException */ - public static function from($object, array $config = null): string + public static function from($object, ?array $config = null): string { return (new BaseParser($config))->parse($object)->json(); } @@ -38,7 +38,7 @@ public static function from($object, array $config = null): string * @return string * @throws \JSONSchemaGenerator\Parsers\Exceptions\UnmappableException */ - public static function fromJson(string $jsonString, array $config = null): string + public static function fromJson(string $jsonString, ?array $config = null): string { return (new BaseParser($config))->parse(json_decode($jsonString))->json(); } diff --git a/src/JSONSchemaGenerator/Parsers/BaseParser.php b/src/JSONSchemaGenerator/Parsers/BaseParser.php index 87a1601..a88236c 100644 --- a/src/JSONSchemaGenerator/Parsers/BaseParser.php +++ b/src/JSONSchemaGenerator/Parsers/BaseParser.php @@ -42,7 +42,7 @@ class BaseParser /** * @param array|null $config */ - public function __construct(array $config = null) + public function __construct(?array $config = null) { $this->config = array_merge([ 'schema_id' => null,