Skip to content

Commit 55a9b39

Browse files
author
RJ Garcia
committed
Adding tests, upgrading compatibility
Signed-off-by: RJ Garcia <rj@stadiumgoods.com>
1 parent 886f5d4 commit 55a9b39

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

composer.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,32 @@
66
"keywords": [
77
"enum",
88
"enum-normalizer",
9-
"symfony",
10-
"symfony4"
9+
"symfony"
1110
],
1211
"license": "MIT",
1312
"authors": [
1413
{
1514
"name": "RJ Garcia",
16-
"email": "rj@bighead.net"
15+
"email": "ragboyjr@icloud.com"
1716
}
1817
],
1918
"autoload": {
2019
"psr-4": {
2120
"Krak\\EnumNormalizer\\": "src"
2221
}
2322
},
23+
"autoload-dev": {
24+
"psr-4": {
25+
"Krak\\EnumNormalizer\\": "tests"
26+
}
27+
},
2428
"require": {
25-
"symfony/serializer": "^3.4|^4.1"
29+
"symfony/serializer": "^4.4|^5.4|^6.0"
2630
},
2731
"require-dev": {
28-
"symfony/dependency-injection": "^4.0",
29-
"symfony/http-kernel": "^4.0"
32+
"phpunit/phpunit": "^10"
33+
},
34+
"scripts": {
35+
"test": "phpunit --testdox --colors tests"
3036
}
3137
}

src/EnumDenormalizer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
class EnumDenormalizer implements DenormalizerInterface
99
{
10-
public function denormalize($data, $class, $format = null, array $context = array()) {
11-
return new $class($data);
10+
public function denormalize($data, string $type, string $format = null, array $context = array()) {
11+
return new $type($data);
1212
}
1313

14-
public function supportsDenormalization($data, $type, $format = null) {
14+
public function supportsDenormalization($data, string $type, string $format = null) {
1515
return \is_subclass_of($type, Enum::class);
1616
}
1717
}

tests/EnumDenormalizerTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Krak\EnumNormalizer;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
final class EnumDenormalizerTest extends TestCase
8+
{
9+
public function test_compatability_with_symfony() {
10+
$this->assertInstanceOf(EnumDenormalizer::class, new EnumDenormalizer());
11+
}
12+
}

0 commit comments

Comments
 (0)