Skip to content

Commit 3627d27

Browse files
committed
chore: implemented some hints from CI
1 parent e9423d6 commit 3627d27

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/BinariableTrait.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44

55
namespace PetrKnap\Binary;
66

7+
/**
8+
* @psalm-require-implements BinariableInterface
9+
*/
710
trait BinariableTrait
811
{
912
/**
1013
* Unfortunately PHP uses string for binary data, so the magic clashes.
1114
*/
1215
public function __toString(): string
1316
{
14-
/** @var BinariableInterface $this */
1517
$binary = $this->toBinary();
1618
trigger_error(
1719
'Returned binary string',

src/Coder/Zlib.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ final class Zlib extends Coder
1818
public const LEVEL = -1;
1919
public const MAX_LENGTH = 0;
2020

21+
private int $encoding;
22+
private int $level;
23+
private int $maxLength;
24+
2125
public function __construct()
2226
{
2327
self::checkRequirements(
@@ -31,10 +35,6 @@ functions: [
3135
);
3236
}
3337

34-
private int $encoding;
35-
private int $level;
36-
private int $maxLength;
37-
3838
public function encode(string $decoded, ?int $encoding = null, ?int $level = null): string
3939
{
4040
$this->encoding = $encoding ?? self::ENCODING;

src/Serializer/SelfSerializerTrait.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
/**
1010
* If your {@see self::__construct()} argument is an instance of {@see SelfSerializerInterface} then
1111
* accept it as a union type `YourClass|string` and call {@see SelfSerializerInterface::fromBinary()} if it is a string.
12+
*
13+
* @psalm-require-implements SelfSerializerInterface
1214
*/
1315
trait SelfSerializerTrait
1416
{

0 commit comments

Comments
 (0)