Skip to content

Commit

Permalink
Support DBAL v4 and ORM v3
Browse files Browse the repository at this point in the history
  • Loading branch information
norkunas committed Feb 5, 2024
1 parent 2c0be0e commit 61e4112
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
],
"require": {
"php": ">=8.1",
"doctrine/orm": "^2.6.3",
"doctrine/orm": "^2.6.3 || ^3.0.0",
"symfony/property-access": "^5.4 || ^6.0 || ^7.0",
"symfony/property-info": "^5.4 || ^6.0 || ^7.0",
"symfony/serializer": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"doctrine/annotations": "^1.0",
"doctrine/annotations": "^1.0 || ^2.0.0",
"doctrine/doctrine-bundle": "^1.12.13 || ^2.2",
"doctrine/dbal": "^2.7 || ^3.3",
"doctrine/dbal": "^2.7 || ^3.3 || ^4.0.0",
"symfony/finder": "^5.4 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^6.0 || ^7.0",
Expand Down
33 changes: 7 additions & 26 deletions src/Type/JsonDocumentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,13 @@ final class JsonDocumentType extends JsonType
{
public const NAME = 'json_document';

/**
* @var SerializerInterface
*/
private $serializer;
private SerializerInterface $serializer;

/**
* @var string
*/
private $format = 'json';
private string $format = 'json';

/**
* @var array
*/
private $serializationContext = [];
private array $serializationContext = [];

/**
* @var array
*/
private $deserializationContext = [];
private array $deserializationContext = [];

/**
* Sets the serializer to use.
Expand Down Expand Up @@ -88,10 +76,7 @@ public function setDeserializationContext(array $deserializationContext): void
$this->deserializationContext = $deserializationContext;
}

/**
* @param mixed $value
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string
public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform): ?string
{
if (null === $value) {
return null;
Expand All @@ -100,12 +85,8 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?str
return $this->getSerializer()->serialize($value, $this->format, $this->serializationContext);
}

/**
* @param mixed $value
*
* @return mixed
*/
public function convertToPHPValue($value, AbstractPlatform $platform)

public function convertToPHPValue(mixed $value, AbstractPlatform $platform): mixed
{
if (null === $value || $value === '') {
return null;
Expand Down

0 comments on commit 61e4112

Please sign in to comment.