Skip to content

Commit cf5b0bb

Browse files
authored
[FIX] Use a instead of A binary decoding in Protocol.php (#45)
* Use `a` instead of `A` binary decoding in `Protocol.php` * Fix `SchemaAttribute` failure for PHPStan
1 parent 4bfeb36 commit cf5b0bb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Objects/Schema/Generation/AnnotationReader.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function __construct(DoctrineAnnotationReader $reader)
2525
*/
2626
public function readClassAttributes(ReflectionClass $class): SchemaAttributes
2727
{
28+
/** @var SchemaAttribute[] $annotations */
2829
$annotations = $this->reader->getClassAnnotations($class);
2930
$attributes = \array_filter($annotations, [$this, 'onlySchemaAttributes']);
3031

@@ -33,6 +34,7 @@ public function readClassAttributes(ReflectionClass $class): SchemaAttributes
3334

3435
public function readPropertyAttributes(ReflectionProperty $property): SchemaAttributes
3536
{
37+
/** @var SchemaAttribute[] $annotations */
3638
$annotations = $this->reader->getPropertyAnnotations($property);
3739
$attributes = \array_filter($annotations, [$this, 'onlySchemaAttributes']);
3840

src/Protocol.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ function version(): int
3030
function encode(int $protocolVersion, int $schemaId, string $avroEncodedBinaryString): Either
3131
{
3232
/** @var bool|string $packed */
33-
$packed = @\pack('CNA*', $protocolVersion, $schemaId, $avroEncodedBinaryString);
33+
$packed = @\pack('CNa*', $protocolVersion, $schemaId, $avroEncodedBinaryString);
3434

3535
return false !== $packed
3636
? Right::of($packed)
3737
// @codeCoverageIgnoreStart
3838
: Left::of(
3939
new AvroEncodingException(
4040
\sprintf(
41-
'Could not pack message with format "CNA*", protocol version "%d" and schema id "%d"',
41+
'Could not pack message with format "CNa*", protocol version "%d" and schema id "%d"',
4242
$protocolVersion,
4343
$schemaId
4444
)

0 commit comments

Comments
 (0)