Skip to content

Commit 06bf418

Browse files
authored
Merge pull request #54 from nutgram/php8.5
Support PHP 8.5
2 parents 653704d + b6e6a0e commit 06bf418

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

phpunit.xml.dist

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
<?xml version="1.0"?>
2-
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
5-
>
6-
<coverage>
7-
<include>
8-
<directory>./src</directory>
9-
</include>
10-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd">
114
<testsuites>
125
<testsuite name="SergiX44/hydrator">
136
<directory>./tests/</directory>
147
</testsuite>
158
</testsuites>
9+
<source>
10+
<include>
11+
<directory>./src</directory>
12+
</include>
13+
</source>
1614
</phpunit>

src/Annotation/ConcreteResolver.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
namespace SergiX44\Hydrator\Annotation;
44

55
use Attribute;
6+
use RuntimeException;
67

78
/**
89
* @Annotation
910
* @Target({"CLASS"})
1011
*/
1112
#[Attribute(Attribute::TARGET_CLASS)]
12-
abstract class ConcreteResolver
13+
class ConcreteResolver
1314
{
1415
protected array $concretes = [];
1516

@@ -19,7 +20,10 @@ abstract class ConcreteResolver
1920
*
2021
* @return string|null
2122
*/
22-
abstract public function concreteFor(array $data, array $all): ?string;
23+
public function concreteFor(array $data, array $all): ?string
24+
{
25+
throw new RuntimeException('This class is meant to be extended to provide your own ConcreteResolver logic.');
26+
}
2327

2428
/**
2529
* @return array

src/Annotation/UnionResolver.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
use ReflectionException;
77
use ReflectionNamedType;
88
use ReflectionType;
9+
use RuntimeException;
910

1011
/**
1112
* @Annotation
1213
* @Target({"PROPERTY"})
1314
*/
1415
#[Attribute(Attribute::TARGET_PROPERTY)]
15-
abstract class UnionResolver
16+
class UnionResolver
1617
{
1718
/**
1819
* @param string $propertyName
@@ -23,5 +24,8 @@ abstract class UnionResolver
2324
*
2425
* @return ReflectionType
2526
*/
26-
abstract public function resolve(string $propertyName, array $propertyTypes, array $data): ReflectionType;
27+
public function resolve(string $propertyName, array $propertyTypes, array $data): ReflectionType
28+
{
29+
throw new RuntimeException('This class is meant to be extended to provide your own UnionResolver logic.');
30+
}
2731
}

src/Exception/InvalidValueException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public function __construct(
3232
) {
3333
parent::__construct($message, $code, $previous);
3434

35-
$property->setAccessible(false);
3635
$this->property = $property;
3736
}
3837

tests/HydratorTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function testHydrateBooleanProperty($value, $expected): void
246246
$this->assertSame($expected, $object->value);
247247
}
248248

249-
public function booleanValueProvider(): array
249+
public static function booleanValueProvider(): array
250250
{
251251
return [
252252
[true, true],
@@ -280,7 +280,7 @@ public function testHydrateIntegerProperty($value, $expected): void
280280
$this->assertSame($expected, $object->value);
281281
}
282282

283-
public function integerValueProvider(): array
283+
public static function integerValueProvider(): array
284284
{
285285
return [
286286
[42, 42],
@@ -306,7 +306,7 @@ public function testHydrateNumberProperty($value, $expected): void
306306
$this->assertSame($expected, $object->value);
307307
}
308308

309-
public function numberValueProvider(): array
309+
public static function numberValueProvider(): array
310310
{
311311
return [
312312
[42, 42.0],
@@ -438,7 +438,7 @@ public function testHydrateDateTimeImmutableProperty($value, $expected): void
438438
$this->assertSame($expected, $object->value->format('Y-m-d'));
439439
}
440440

441-
public function timestampValueProvider(): array
441+
public static function timestampValueProvider(): array
442442
{
443443
return [
444444
[1262304000, '2010-01-01'],
@@ -577,7 +577,7 @@ public function testHydrateStringableEnumProperty($value, $expected): void
577577
$this->assertSame($expected, $object->value);
578578
}
579579

580-
public function stringableEnumValueProvider(): array
580+
public static function stringableEnumValueProvider(): array
581581
{
582582
return [
583583
['c1200a7e-136e-4a11-9bc3-cc937046e90f', Fixtures\StringableEnum::foo],
@@ -615,7 +615,7 @@ public function testHydrateNumerableEnumProperty($value, $expected): void
615615
$this->assertSame($expected, $object->value);
616616
}
617617

618-
public function numerableEnumValueProvider(): array
618+
public static function numerableEnumValueProvider(): array
619619
{
620620
return [
621621
[1, Fixtures\NumerableEnum::foo],

0 commit comments

Comments
 (0)