Skip to content

Commit 4dbdc3c

Browse files
mihaileumihai.leu
andauthored
fixing php 8.4 deprecations (#88)
Co-authored-by: mihai.leu <[email protected]>
1 parent ffeab36 commit 4dbdc3c

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/Common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function inflectRecord($record): Maybe
4848
*
4949
* @return mixed|null
5050
*/
51-
function memoize(callable $callback = null, array $arguments = [], $key = null)
51+
function memoize(?callable $callback = null, array $arguments = [], $key = null)
5252
{
5353
static $storage = [];
5454

src/Objects/Exceptions/Exceptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ final class Exceptions
1212
/**
1313
* @param mixed $record
1414
*/
15-
public static function forEncode($record, \AvroSchema $schema, \Exception $previous = null): AvroEncodingException
15+
public static function forEncode($record, \AvroSchema $schema, ?\Exception $previous = null): AvroEncodingException
1616
{
1717
$exportedRecord = \var_export($record, true);
1818

@@ -29,7 +29,7 @@ public static function forEncode($record, \AvroSchema $schema, \Exception $previ
2929
return new AvroEncodingException($message, self::ERROR_ENCODING, $previous);
3030
}
3131

32-
public static function forDecode(string $binaryMessage, \Exception $previous = null): AvroDecodingException
32+
public static function forDecode(string $binaryMessage, ?\Exception $previous = null): AvroDecodingException
3333
{
3434
$convertedMessage = \bin2hex($binaryMessage);
3535
$message = <<<MESSAGE

src/Objects/RecordSerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function encodeRecord(string $subject, AvroSchema $schema, $record): stri
131131
* @throws \Exception
132132
* @throws \FlixTech\SchemaRegistryApi\Exception\SchemaRegistryException
133133
*/
134-
public function decodeMessage(string $binaryMessage, AvroSchema $readersSchema = null)
134+
public function decodeMessage(string $binaryMessage, ?AvroSchema $readersSchema = null)
135135
{
136136
$decoded = decode($binaryMessage);
137137
$schemaId = valueOf($decoded->bind($this->schemaIdGetter));

src/Objects/Schema/Generation/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Type
1616
*/
1717
private $attributes;
1818

19-
public function __construct(string $typeName, SchemaAttributes $attributes = null)
19+
public function __construct(string $typeName, ?SchemaAttributes $attributes = null)
2020
{
2121
$this->typeName = $typeName;
2222
$this->attributes = $attributes ?? new SchemaAttributes();

test/Objects/SchemaResolvers/DefinitionInterfaceResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function it_should_fail_for_records_not_implementing_the_interface_for_ke
6565
$definitionInterfaceResolver->keySchemaFor([]);
6666
}
6767

68-
private function createAnonymousDefinitionInterface(string $valueSchema, string $keySchema = null): HasSchemaDefinitionInterface
68+
private function createAnonymousDefinitionInterface(string $valueSchema, ?string $keySchema = null): HasSchemaDefinitionInterface
6969
{
7070
$class = new class() implements HasSchemaDefinitionInterface {
7171
/**

0 commit comments

Comments
 (0)