Skip to content

Commit

Permalink
bump: Symfony 7, Infra (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarlovi authored Jan 26, 2024
1 parent 2065fe0 commit c85fee3
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 70 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
PHP_VERSION: ${{ matrix.php }}
strategy:
matrix:
php: [ "8.1", "8.2" ]
php: [ "8.2", "8.3" ]
dependencies: [ lowest, highest ]
steps:
-
Expand All @@ -29,7 +29,7 @@ jobs:
PHP_VERSION: ${{ matrix.php }}
strategy:
matrix:
php: [ "8.1", "8.2" ]
php: [ "8.2", "8.3" ]
dependencies: [ lowest, highest ]
steps:
-
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-json": "*",
"symfony/options-resolver": "^5.4 || ^6.0",
"symfony/serializer": "^5.4 || ^6.0"
"symfony/options-resolver": "^6.4 || ^7.0",
"symfony/serializer": "^6.4 || ^7.0"
},
"require-dev": {
"doctrine/annotations": "^1.12",
Expand All @@ -23,13 +23,13 @@
"openspout/openspout": "^4.0",
"phpoffice/phpspreadsheet": "^1.29",
"phpunit/phpunit": "^9.6",
"sigwin/infra": "~1.6.0",
"symfony/console": "^5.4 || ^6.0",
"symfony/framework-bundle": "^5.4 || ^6.0",
"symfony/phpunit-bridge": "^5.4 || ^6.0",
"symfony/property-access": "^5.4 || ^6.0",
"symfony/property-info": "^5.4 || ^6.0",
"symfony/validator": "^5.4 || ^6.0"
"sigwin/infra": "~1.9.0",
"symfony/console": "^6.4 || ^7.0",
"symfony/framework-bundle": "^6.4 || ^7.0",
"symfony/phpunit-bridge": "^6.4 || ^7.0",
"symfony/property-access": "^6.4 || ^7.0",
"symfony/property-info": "^6.4 || ^7.0",
"symfony/validator": "^6.4 || ^7.0"
},
"replace": {
"sigwin/xezilaires-core": "self.version",
Expand Down
5 changes: 1 addition & 4 deletions src/Bridge/PhpSpreadsheet/Spreadsheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ private function getActiveWorksheet(): Worksheet
}
}

/**
* @return null|float|int|string
*/
private function fetchCell(string $columnName, int $rowIndex)
private function fetchCell(string $columnName, int $rowIndex): null|float|int|string
{
$worksheet = $this->getActiveWorksheet();

Expand Down
8 changes: 4 additions & 4 deletions src/Bridge/PhpSpreadsheet/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"phpoffice/phpspreadsheet": "^1.29",
"sigwin/xezilaires": "^0.6"
},
"require-dev": {
"doctrine/annotations": "^1.11",
"phpunit/phpunit": "^9.6",
"symfony/phpunit-bridge": "^5.4 || ^6.0",
"symfony/property-access": "^5.4 || ^6.0",
"symfony/property-info": "^5.4 || ^6.0"
"symfony/phpunit-bridge": "^6.4 || ^7.0",
"symfony/property-access": "^6.4 || ^7.0",
"symfony/property-info": "^6.4 || ^7.0"
},
"conflict": {
"nikic/php-parser": "< 4.14"
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Spout/Spreadsheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private function getReader(): ReaderInterface
try {
$this->reader = new Reader();
$this->reader->open($path);
} catch (UnsupportedTypeException|IOException $exception) {
} catch (IOException|UnsupportedTypeException $exception) {
throw SpreadsheetException::invalidSpreadsheet($exception);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/Bridge/Spout/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"openspout/openspout": "^4.0",
"sigwin/xezilaires": "^0.6"
},
"require-dev": {
"doctrine/annotations": "^1.11",
"nyholm/nsa": "^1.1",
"phpunit/phpunit": "^9.6",
"symfony/phpunit-bridge": "^5.4 || ^6.0",
"symfony/property-access": "^5.4 || ^6.0",
"symfony/property-info": "^5.4 || ^6.0"
"symfony/phpunit-bridge": "^6.4 || ^7.0",
"symfony/property-access": "^6.4 || ^7.0",
"symfony/property-info": "^6.4 || ^7.0"
},
"conflict": {
"nikic/php-parser": "< 4.14"
Expand Down
11 changes: 6 additions & 5 deletions src/Bridge/Symfony/Command/SerializeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Xezilaires\Bridge\Symfony\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -23,19 +24,19 @@
use Xezilaires\Metadata\Annotation\AnnotationDriver;
use Xezilaires\Serializer;

#[AsCommand(
name: 'xezilaires:serialize',
description: 'Serialize Excel files into JSON, XML, CSV',
)]
final class SerializeCommand extends Command
{
protected static $defaultName = 'xezilaires:serialize';

private IteratorFactory $iteratorFactory;

private Serializer $serializer;

public function __construct(IteratorFactory $iteratorFactory, Serializer $serializer)
{
parent::__construct('xezilaires:serialize');

$this->setDescription('Serialize Excel files into JSON, XML, CSV');
parent::__construct();

$this->iteratorFactory = $iteratorFactory;
$this->serializer = $serializer;
Expand Down
11 changes: 6 additions & 5 deletions src/Bridge/Symfony/Command/ValidateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Xezilaires\Bridge\Symfony\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -24,19 +25,19 @@
use Xezilaires\Metadata\Annotation\AnnotationDriver;
use Xezilaires\Validator;

#[AsCommand(
name: 'xezilaires:validate',
description: 'Validate the input file',
)]
final class ValidateCommand extends Command
{
protected static $defaultName = 'xezilaires:validate';

private IteratorFactory $iteratorFactory;

private Validator $validator;

public function __construct(IteratorFactory $iteratorFactory, Validator $validator)
{
parent::__construct('xezilaires:validate');

$this->setDescription('Validate the input file');
parent::__construct();

$this->iteratorFactory = $iteratorFactory;
$this->validator = $validator;
Expand Down
14 changes: 7 additions & 7 deletions src/Bridge/Symfony/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"sigwin/xezilaires": "^0.6",
"symfony/console": "^5.4 || ^6.0",
"symfony/framework-bundle": "^5.4 || ^6.0",
"symfony/property-access": "^5.4 || ^6.0",
"symfony/property-info": "^5.4 || ^6.0",
"symfony/validator": "^5.4 || ^6.0"
"symfony/console": "^6.4 || ^7.0",
"symfony/framework-bundle": "^6.4 || ^7.0",
"symfony/property-access": "^6.4 || ^7.0",
"symfony/property-info": "^6.4 || ^7.0",
"symfony/validator": "^6.4 || ^7.0"
},
"require-dev": {
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"nyholm/symfony-bundle-test": "dev-master",
"phpunit/phpunit": "^9.6",
"sigwin/xezilaires-phpspreadsheet": "^0.6",
"sigwin/xezilaires-spout": "^0.6",
"symfony/phpunit-bridge": "^5.4 || ^6.0"
"symfony/phpunit-bridge": "^6.4 || ^7.0"
},
"conflict": {
"nikic/php-parser": "< 4.14"
Expand Down
1 change: 0 additions & 1 deletion src/Xezilaires/Annotation/ArrayReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

/**
* @Annotation
*
* @Target({"PROPERTY"})
*/
#[\Attribute(\Attribute::TARGET_PROPERTY)]
Expand Down
2 changes: 0 additions & 2 deletions src/Xezilaires/Annotation/ColumnReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

/**
* @Annotation
*
* @Target({"ANNOTATION", "PROPERTY"})
*
* @NamedArgumentConstructor
*/
#[\Attribute(\Attribute::TARGET_PROPERTY)]
Expand Down
2 changes: 0 additions & 2 deletions src/Xezilaires/Annotation/HeaderReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

/**
* @Annotation
*
* @Target({"ANNOTATION", "PROPERTY"})
*
* @NamedArgumentConstructor
*/
#[\Attribute(\Attribute::TARGET_PROPERTY)]
Expand Down
2 changes: 0 additions & 2 deletions src/Xezilaires/Annotation/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

/**
* @Annotation
*
* @Target({"CLASS"})
*
* @NamedArgumentConstructor
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
Expand Down
5 changes: 1 addition & 4 deletions src/Xezilaires/Metadata/Annotation/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ private function getOptions(\ReflectionClass $reflectionClass, ?array $additiona
return array_filter($options);
}

/**
* @return ColumnReference|HeaderReference
*/
private function createReference(Annotation\Reference $annotation)
private function createReference(Annotation\Reference $annotation): ColumnReference|HeaderReference
{
switch (true) {
case $annotation instanceof Annotation\ColumnReference:
Expand Down
5 changes: 1 addition & 4 deletions src/Xezilaires/Metadata/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ public function getReferences(): array
return $this->references;
}

/**
* @return null|bool|int|string
*/
public function getOption(string $option)
public function getOption(string $option): null|bool|int|string
{
return $this->options[$option];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Xezilaires/Metadata/Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ interface Reference
/**
* @return Reference[]|string
*/
public function getReference();
public function getReference(): array|string;
}
4 changes: 1 addition & 3 deletions src/Xezilaires/SpreadsheetIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,8 @@ private function readArrayReference(array $row, ArrayReference $reference): arra

/**
* @param array<string, null|float|int|string> $row
*
* @return null|float|int|string
*/
private function readReference(array $row, Reference $reference)
private function readReference(array $row, Reference $reference): null|float|int|string
{
switch (true) {
case $reference instanceof ColumnReference:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a
return (object) $data;
}

public function supportsDenormalization(mixed $data, string $type, ?string $format = null): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === Product::class;
}

public function getSupportedTypes(?string $format): array
{
return [Product::class => true];
}

private function cast(string $price): float
{
return (float) filter_var($price, \FILTER_SANITIZE_NUMBER_FLOAT, \FILTER_FLAG_ALLOW_FRACTION);
Expand Down
16 changes: 8 additions & 8 deletions src/Xezilaires/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
}
],
"require": {
"php": "^8.1",
"symfony/options-resolver": "^5.4 || ^6.0",
"symfony/serializer": "^5.4 || ^6.0"
"php": "^8.2",
"symfony/options-resolver": "^6.4 || ^7.0",
"symfony/serializer": "^6.4 || ^7.0"
},
"require-dev": {
"doctrine/annotations": "^1.12",
"nyholm/nsa": "^1.1",
"openspout/openspout": "^4.0",
"phpunit/phpunit": "^9.6",
"symfony/console": "^5.4 || ^6.0",
"symfony/phpunit-bridge": "^5.4 || ^6.0",
"symfony/property-access": "^5.4 || ^6.0",
"symfony/property-info": "^5.4 || ^6.0",
"symfony/validator": "^5.4 || ^6.0"
"symfony/console": "^6.4 || ^7.0",
"symfony/phpunit-bridge": "^6.4 || ^7.0",
"symfony/property-access": "^6.4 || ^7.0",
"symfony/property-info": "^6.4 || ^7.0",
"symfony/validator": "^6.4 || ^7.0"
},
"conflict": {
"nikic/php-parser": "< 4.14"
Expand Down

0 comments on commit c85fee3

Please sign in to comment.