Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 3.4.0
### Added
- PHP 8.4 support, removed implicitly nullable parameter declarations.

## 3.3.0
### Added
- Symfony 6 support.
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "paysera/lib-serializer",
"description": "Library can (de)serialize various data types",
"version": "3.4.0",
"autoload": {
"psr-4": {
"Paysera\\Component\\Serializer\\": "src/"
Expand Down
26 changes: 13 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
Expand All @@ -10,20 +11,19 @@
stopOnFailure="false"
bootstrap="vendor/autoload.php">

<coverage>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>

<testsuites>
<testsuite name="Evp Serializer Component Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>

</phpunit>
2 changes: 1 addition & 1 deletion src/Entity/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Result implements \IteratorAggregate, ResultInterface
protected $items;


public function __construct(Filter $filter = null)
public function __construct(?Filter $filter = null)
{
$this->filter = $filter;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidDataException.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class InvalidDataException extends Exception
*/
private $violations;

public function __construct($message = '', $customCode = null, \Exception $previous = null)
public function __construct($message = '', $customCode = null, ?Exception $previous = null)
{
$this->customCode = $customCode;
$this->violations = [];
Expand Down
4 changes: 2 additions & 2 deletions src/Filter/FieldsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public function __construct(FieldsParser $fieldsParser)

/**
* @param array $data
* @param array $fields
* @param null|array $fields
* @param array $scope
*
* @return array
*/
public function filter($data, array $fields = null, array $scope = array())
public function filter($data, ?array $fields = null, array $scope = [])
{
$fieldsConfig = $this->fieldsParser->parseFields($fields, $scope);

Expand Down
10 changes: 5 additions & 5 deletions src/Filter/FieldsParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ class FieldsParser
{

/**
* @param array $fields
* @param null|array $fields
* @param array $scope
*
* @return FieldsConfig
*/
public function parseFields(array $fields = null, array $scope = array())
public function parseFields(?array $fields = null, array $scope = [])
{
$fieldsConfig = $this->parseUnscopedFields($fields);
foreach ($scope as $fieldName) {
Expand All @@ -21,12 +21,12 @@ public function parseFields(array $fields = null, array $scope = array())
}

/**
* @param array $fields
* @param null|array $fields
*
* @throws \InvalidArgumentException
* @return FieldsConfig
*/
public function parseUnscopedFields(array $fields = null)
public function parseUnscopedFields(?array $fields = null)
{
if ($fields === null) {
return $this->createWithDefaultsIncluded();
Expand Down Expand Up @@ -65,4 +65,4 @@ protected function createWithDefaultsIncluded()
{
return new FieldsConfig(true, array(), array());
}
}
}
2 changes: 1 addition & 1 deletion src/Normalizer/ArrayNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function mapToEntity($data)
return $result;
}

public function mapFromEntity($entity, NormalizationContextInterface $context = null)
public function mapFromEntity($entity, ?NormalizationContextInterface $context = null)
{
$result = array();
if ($entity !== null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/ContextAwareDenormalizerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ interface ContextAwareDenormalizerInterface extends DenormalizerInterface
*
* @return mixed
*/
public function mapToEntity($data, NormalizationContextInterface $context = null);
public function mapToEntity($data, ?NormalizationContextInterface $context = null);
}
6 changes: 3 additions & 3 deletions src/Normalizer/ContextAwareNormalizerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ interface ContextAwareNormalizerInterface extends NormalizerInterface
/**
* Maps some structure to raw data. Usually entity object to array
*
* @param mixed $entity
* @param \Paysera\Component\Serializer\Entity\NormalizationContextInterface $context
* @param mixed $entity
* @param null|NormalizationContextInterface $context
*
* @return mixed
*/
public function mapFromEntity($entity, NormalizationContextInterface $context = null);
public function mapFromEntity($entity, ?NormalizationContextInterface $context = null);

}
6 changes: 3 additions & 3 deletions src/Normalizer/DistributedNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ public function mapToEntity($data)
/**
* Maps some structure to raw data. Usually entity object to array
*
* @param mixed $entity
* @param \Paysera\Component\Serializer\Entity\NormalizationContextInterface $context
* @param mixed $entity
* @param null|NormalizationContextInterface $context
*
* @return mixed
*/
public function mapFromEntity($entity, NormalizationContextInterface $context = null)
public function mapFromEntity($entity, ?NormalizationContextInterface $context = null)
{
if ($this->normalizer instanceof ContextAwareNormalizerInterface) {
$data = $this->normalizer->mapFromEntity($entity, $context);
Expand Down
6 changes: 3 additions & 3 deletions src/Normalizer/ResultNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public function setMetadataNormalizer($metadataNormalizer)
* Maps some structure to raw data. Usually entity object to array
*
* @param mixed $entity
* @param \Paysera\Component\Serializer\Entity\NormalizationContextInterface $context
* @param null|NormalizationContextInterface $context
*
* @return mixed
*/
public function mapFromEntity($entity, NormalizationContextInterface $context = null)
public function mapFromEntity($entity, ?NormalizationContextInterface $context = null)
{
return array(
$this->itemsKey => $this->mapItemsFromEntity(
Expand Down Expand Up @@ -128,7 +128,7 @@ protected function mapMetadataFromEntity(Result $result)
return $this->metadataNormalizer->mapFromEntity($result);
}

protected function mapItemsFromEntity($items, NormalizationContextInterface $context = null)
protected function mapItemsFromEntity($items, ?NormalizationContextInterface $context = null)
{
return $this->itemsNormalizer->mapFromEntity($items, $context);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Validation/PropertiesAwareValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class PropertiesAwareValidator

/**
* @param ValidatorInterface $validator
* @param PropertyPathConverterInterface $propertyPathConverter
* @param null|PropertyPathConverterInterface $propertyPathConverter
*/
public function __construct(
$validator,
PropertyPathConverterInterface $propertyPathConverter = null
?PropertyPathConverterInterface $propertyPathConverter = null
) {
$this->validator = $validator;
$this->propertyPathConverter = $propertyPathConverter;
Expand Down
Loading