diff --git a/src/Common.php b/src/Common.php index 20bf43e..93a3f69 100644 --- a/src/Common.php +++ b/src/Common.php @@ -48,7 +48,7 @@ function inflectRecord($record): Maybe * * @return mixed|null */ -function memoize(callable $callback = null, array $arguments = [], $key = null) +function memoize(?callable $callback = null, array $arguments = [], $key = null) { static $storage = []; diff --git a/src/Objects/Exceptions/Exceptions.php b/src/Objects/Exceptions/Exceptions.php index 0b2a96b..b85908b 100644 --- a/src/Objects/Exceptions/Exceptions.php +++ b/src/Objects/Exceptions/Exceptions.php @@ -12,7 +12,7 @@ final class Exceptions /** * @param mixed $record */ - public static function forEncode($record, \AvroSchema $schema, \Exception $previous = null): AvroEncodingException + public static function forEncode($record, \AvroSchema $schema, ?\Exception $previous = null): AvroEncodingException { $exportedRecord = \var_export($record, true); @@ -29,7 +29,7 @@ public static function forEncode($record, \AvroSchema $schema, \Exception $previ return new AvroEncodingException($message, self::ERROR_ENCODING, $previous); } - public static function forDecode(string $binaryMessage, \Exception $previous = null): AvroDecodingException + public static function forDecode(string $binaryMessage, ?\Exception $previous = null): AvroDecodingException { $convertedMessage = \bin2hex($binaryMessage); $message = <<bind($this->schemaIdGetter)); diff --git a/src/Objects/Schema/Generation/Type.php b/src/Objects/Schema/Generation/Type.php index 75a6035..08f3f19 100644 --- a/src/Objects/Schema/Generation/Type.php +++ b/src/Objects/Schema/Generation/Type.php @@ -16,7 +16,7 @@ class Type */ private $attributes; - public function __construct(string $typeName, SchemaAttributes $attributes = null) + public function __construct(string $typeName, ?SchemaAttributes $attributes = null) { $this->typeName = $typeName; $this->attributes = $attributes ?? new SchemaAttributes(); diff --git a/test/Objects/SchemaResolvers/DefinitionInterfaceResolverTest.php b/test/Objects/SchemaResolvers/DefinitionInterfaceResolverTest.php index 56c56b9..5d40c71 100644 --- a/test/Objects/SchemaResolvers/DefinitionInterfaceResolverTest.php +++ b/test/Objects/SchemaResolvers/DefinitionInterfaceResolverTest.php @@ -65,7 +65,7 @@ public function it_should_fail_for_records_not_implementing_the_interface_for_ke $definitionInterfaceResolver->keySchemaFor([]); } - private function createAnonymousDefinitionInterface(string $valueSchema, string $keySchema = null): HasSchemaDefinitionInterface + private function createAnonymousDefinitionInterface(string $valueSchema, ?string $keySchema = null): HasSchemaDefinitionInterface { $class = new class() implements HasSchemaDefinitionInterface { /**