Skip to content

Commit b32ae72

Browse files
committed
Fix some weak warnings
1 parent e6dfa4c commit b32ae72

12 files changed

+20
-23
lines changed

src/Json/PropertyJsonSerializer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Aternos\Serializer\Json;
44

55
use Aternos\Serializer\ArraySerializer;
6-
use Aternos\Serializer\Exceptions\SerializationException;
76
use Aternos\Serializer\Exceptions\IncorrectTypeException;
87
use Aternos\Serializer\Exceptions\InvalidInputException;
98
use Aternos\Serializer\Exceptions\MissingPropertyException;

tests/src/ArrayTests.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
class ArrayTests
88
{
9+
/** @noinspection PhpMissingFieldTypeInspection */
910
#[Serialize(itemType: BuiltInTypeTestClass::class)]
1011
public $untypedArray = [];
1112

tests/src/IntersectionTestClass.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
namespace Aternos\Serializer\Test\Src;
44

55
use Aternos\Serializer\Serialize;
6+
use Iterator;
7+
use Throwable;
68

79
class IntersectionTestClass
810
{
911
#[Serialize]
10-
protected \Throwable&\Iterator $x;
12+
protected Throwable&Iterator $x;
1113
}

tests/src/SerializerTestClass.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
use Aternos\Serializer\Json\PropertyJsonSerializer;
66
use Aternos\Serializer\Serialize;
7+
use JsonSerializable;
78

8-
class SerializerTestClass implements \JsonSerializable
9+
class SerializerTestClass implements JsonSerializable
910
{
1011
use PropertyJsonSerializer;
1112

@@ -15,6 +16,7 @@ class SerializerTestClass implements \JsonSerializable
1516
#[Serialize(required: true)]
1617
protected int $age = 0;
1718

19+
/** @noinspection PhpUnused */
1820
protected string $notAJsonField = "test";
1921

2022
#[Serialize(allowNull: false)]
@@ -44,11 +46,6 @@ public function getAge(): int
4446
return $this->age;
4547
}
4648

47-
public function setAge(int $age): void
48-
{
49-
$this->age = $age;
50-
}
51-
5249
public function getNotNullable(): ?string
5350
{
5451
return $this->notNullable;
@@ -69,11 +66,6 @@ public function setSecondTestClass(?SecondTestClass $secondTestClass): void
6966
$this->secondTestClass = $secondTestClass;
7067
}
7168

72-
public function getTestClass(): ?TestClass
73-
{
74-
return $this->testClass;
75-
}
76-
7769
public function setTestClass(?TestClass $testClass): void
7870
{
7971
$this->testClass = $testClass;

tests/src/TestClass.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
use Aternos\Serializer\Json\PropertyJsonSerializer;
66
use Aternos\Serializer\Serialize;
7+
use JsonSerializable;
78

8-
class TestClass implements \JsonSerializable
9+
class TestClass implements JsonSerializable
910
{
1011
use PropertyJsonSerializer;
1112

tests/src/UnionIntersectionTestClass.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
namespace Aternos\Serializer\Test\Src;
44

55
use Aternos\Serializer\Serialize;
6+
use Iterator;
7+
use Throwable;
68

79
class UnionIntersectionTestClass
810
{
911
#[Serialize]
10-
protected bool|(\Throwable&\Iterator) $x;
12+
protected bool|(Throwable&Iterator) $x;
1113
}

tests/tests/DeserializerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php /** @noinspection PhpUnhandledExceptionInspection */
22

33
namespace Aternos\Serializer\Test\Tests;
44

@@ -38,9 +38,9 @@ public function testDeserialize(): void
3838

3939
public function testDeserializeInvalidClass(): void
4040
{
41-
$deserializer = new ArrayDeserializer("non-existant-class");
41+
$deserializer = new ArrayDeserializer("non-existent-class");
4242
$this->expectException(InvalidArgumentException::class);
43-
$this->expectExceptionMessage("Class 'non-existant-class' does not exist.");
43+
$this->expectExceptionMessage("Class 'non-existent-class' does not exist.");
4444
$deserializer->deserialize([]);
4545
}
4646

tests/tests/Json/JsonDeserializerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php /** @noinspection PhpUnhandledExceptionInspection */
22

33
namespace Aternos\Serializer\Test\Tests\Json;
44

tests/tests/Json/JsonSerializerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php /** @noinspection PhpUnhandledExceptionInspection */
22

33
namespace Aternos\Serializer\Test\Tests\Json;
44

tests/tests/Json/PropertyJsonSerializerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php /** @noinspection PhpUnhandledExceptionInspection */
22

33
namespace Aternos\Serializer\Test\Tests\Json;
44

0 commit comments

Comments
 (0)