diff --git a/README.md b/README.md
index 8ad9b6b..f17b8ef 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ An OEM *(Object Excel Manager)*, if you will.
## Example usage
-### Without annotations
+### Without attributes
```php
class Product
@@ -54,19 +54,16 @@ $iterator = $iteratorFactory->fromFile(
);
```
-### With annotations
+### With attributes
```php
-use Xezilaires\Annotation as XLS;
+use Xezilaires\Attribute as XLS;
-/**
- * @XLS\Options(header=1, start=2)
- */
+
+#[XLS\Options(header=1, start=2)]
class Product
{
- /**
- * @XLS\HeaderReference(header="Name")
- */
+ #[@XLS\HeaderReference(header="Name")]
private $name;
}
@@ -77,12 +74,12 @@ $normalizer = new \Xezilaires\Bridge\Symfony\Serializer\ObjectSerializer($symfon
$iteratorFactory = new \Xezilaires\SpreadsheetIteratorFactory($normalizer, [
\Xezilaires\Bridge\PhpSpreadsheet\Spreadsheet::class,
]);
-$annotationDriver = new \Xezilaires\Metadata\Annotation\AnnotationDriver();
+$attributeDriver = new \Xezilaires\Metadata\Attribute\AttributeDriver();
$iterator = $iteratorFactory->fromFile(
// https://github.com/sigwinhq/xezilaires-dev/raw/master/src/Xezilaires/Test/resources/fixtures/products.xlsx
new \SplFileObject(__DIR__.'/../../src/Xezilaires/Test/resources/fixtures/products.xlsx'),
- $annotationDriver->getMetadataMapping(Product::class, ['reverse' => true])
+ $attributeDriver->getMetadataMapping(Product::class, ['reverse' => true])
);
```
@@ -107,8 +104,7 @@ Features included:
*(using either `phpoffice/PhpSpreadsheet` or `openspout/openspout`)*
- **Denormalization / normalization** support
*(using `symfony/serializer`, from / to all supported formats)*
-- **Annotations** support
-*(using `doctrine/annotations`)*
+- Attributes support
- mapping via **column names** or **header labels**
*(saying "Map header label `PrdctEN` to property `product`")*
- **A Symfony bundle**
diff --git a/composer.json b/composer.json
index e030347..df0fe9f 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,6 @@
"symfony/serializer": "^6.4 || ^7.0"
},
"require-dev": {
- "doctrine/annotations": "^1.12",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"nyholm/nsa": "^1.1",
"nyholm/symfony-bundle-test": "dev-master",
diff --git a/docs/examples/annotations.php b/docs/examples/attributes.php
similarity index 88%
rename from docs/examples/annotations.php
rename to docs/examples/attributes.php
index 07c6a2b..ce0f981 100644
--- a/docs/examples/annotations.php
+++ b/docs/examples/attributes.php
@@ -26,13 +26,13 @@
$iteratorFactory = new \Xezilaires\SpreadsheetIteratorFactory($normalizer, [
\Xezilaires\Bridge\PhpSpreadsheet\Spreadsheet::class,
]);
-$annotationDriver = new \Xezilaires\Metadata\Annotation\AnnotationDriver();
+$attributeDriver = new \Xezilaires\Metadata\Attribute\AttributeDriver();
//
$iterator = $iteratorFactory->fromFile(
// https://github.com/sigwinhq/xezilaires/raw/master/resources/fixtures/products.xlsx
new \SplFileObject(__DIR__.'/../../src/Xezilaires/Test/resources/fixtures/products.xlsx'),
- $annotationDriver->getMetadataMapping(Product::class)
+ $attributeDriver->getMetadataMapping(Product::class)
);
$out = iterator_to_array($iterator);
diff --git a/docs/examples/reverse.php b/docs/examples/reverse.php
index af199a5..80942f4 100644
--- a/docs/examples/reverse.php
+++ b/docs/examples/reverse.php
@@ -26,13 +26,13 @@
$iteratorFactory = new \Xezilaires\SpreadsheetIteratorFactory($normalizer, [
\Xezilaires\Bridge\PhpSpreadsheet\Spreadsheet::class,
]);
-$annotationDriver = new \Xezilaires\Metadata\Annotation\AnnotationDriver();
+$attributeDriver = new \Xezilaires\Metadata\Attribute\AttributeDriver();
//
$iterator = $iteratorFactory->fromFile(
// https://github.com/sigwinhq/xezilaires/raw/master/resources/fixtures/products.xlsx
new \SplFileObject(__DIR__.'/../../src/Xezilaires/Test/resources/fixtures/products.xlsx'),
- $annotationDriver->getMetadataMapping(Product::class, ['reverse' => true])
+ $attributeDriver->getMetadataMapping(Product::class, ['reverse' => true])
);
$out = iterator_to_array($iterator);
diff --git a/psalm.xml.dist b/psalm.xml.dist
index 364d7af..9c433db 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -34,7 +34,7 @@
-
+
@@ -46,7 +46,7 @@
-
+
diff --git a/src/Bridge/PhpSpreadsheet/composer.json b/src/Bridge/PhpSpreadsheet/composer.json
index bd3940f..b212f0b 100644
--- a/src/Bridge/PhpSpreadsheet/composer.json
+++ b/src/Bridge/PhpSpreadsheet/composer.json
@@ -12,10 +12,9 @@
"require": {
"php": "^8.2",
"phpoffice/phpspreadsheet": "^1.29",
- "sigwin/xezilaires": "^0.6"
+ "sigwin/xezilaires": "^1.0"
},
"require-dev": {
- "doctrine/annotations": "^1.11",
"phpunit/phpunit": "^9.6",
"symfony/phpunit-bridge": "^6.4 || ^7.0",
"symfony/property-access": "^6.4 || ^7.0",
diff --git a/src/Bridge/Spout/composer.json b/src/Bridge/Spout/composer.json
index 92322c3..fc74df4 100644
--- a/src/Bridge/Spout/composer.json
+++ b/src/Bridge/Spout/composer.json
@@ -12,10 +12,9 @@
"require": {
"php": "^8.2",
"openspout/openspout": "^4.0",
- "sigwin/xezilaires": "^0.6"
+ "sigwin/xezilaires": "^1.0"
},
"require-dev": {
- "doctrine/annotations": "^1.11",
"nyholm/nsa": "^1.1",
"phpunit/phpunit": "^9.6",
"symfony/phpunit-bridge": "^6.4 || ^7.0",
diff --git a/src/Bridge/Symfony/Command/SerializeCommand.php b/src/Bridge/Symfony/Command/SerializeCommand.php
index db331e0..2200c71 100644
--- a/src/Bridge/Symfony/Command/SerializeCommand.php
+++ b/src/Bridge/Symfony/Command/SerializeCommand.php
@@ -21,7 +21,7 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Serializer\Encoder\CsvEncoder;
use Xezilaires\IteratorFactory;
-use Xezilaires\Metadata\Annotation\AnnotationDriver;
+use Xezilaires\Metadata\Attribute\AttributeDriver;
use Xezilaires\Serializer;
#[AsCommand(
@@ -122,7 +122,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
break;
}
- $driver = new AnnotationDriver();
+ $driver = new AttributeDriver();
$iterator = $this->iteratorFactory->fromFile(
new \SplFileObject($path),
$driver->getMetadataMapping($class, ['reverse' => $reverse, 'sequential' => true])
diff --git a/src/Bridge/Symfony/Command/ValidateCommand.php b/src/Bridge/Symfony/Command/ValidateCommand.php
index 3b6494b..450006d 100644
--- a/src/Bridge/Symfony/Command/ValidateCommand.php
+++ b/src/Bridge/Symfony/Command/ValidateCommand.php
@@ -22,7 +22,7 @@
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Validator\ConstraintViolationInterface;
use Xezilaires\IteratorFactory;
-use Xezilaires\Metadata\Annotation\AnnotationDriver;
+use Xezilaires\Metadata\Attribute\AttributeDriver;
use Xezilaires\Validator;
#[AsCommand(
@@ -79,7 +79,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$style = new SymfonyStyle($input, $output);
$style->title('Xezilaires validate');
- $driver = new AnnotationDriver();
+ $driver = new AttributeDriver();
$totalCount = 0;
$totalInvalid = 0;
diff --git a/src/Bridge/Symfony/composer.json b/src/Bridge/Symfony/composer.json
index 4660357..6caf109 100644
--- a/src/Bridge/Symfony/composer.json
+++ b/src/Bridge/Symfony/composer.json
@@ -11,7 +11,7 @@
],
"require": {
"php": "^8.2",
- "sigwin/xezilaires": "^0.6",
+ "sigwin/xezilaires": "^1.0",
"symfony/console": "^6.4 || ^7.0",
"symfony/framework-bundle": "^6.4 || ^7.0",
"symfony/property-access": "^6.4 || ^7.0",
@@ -22,8 +22,8 @@
"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",
+ "sigwin/xezilaires-phpspreadsheet": "^1.0",
+ "sigwin/xezilaires-spout": "^1.0",
"symfony/phpunit-bridge": "^6.4 || ^7.0"
},
"conflict": {
diff --git a/src/Xezilaires/Annotation/ArrayReference.php b/src/Xezilaires/Attribute/ArrayReference.php
similarity index 86%
rename from src/Xezilaires/Annotation/ArrayReference.php
rename to src/Xezilaires/Attribute/ArrayReference.php
index c22eceb..7d1ae2a 100644
--- a/src/Xezilaires/Annotation/ArrayReference.php
+++ b/src/Xezilaires/Attribute/ArrayReference.php
@@ -11,12 +11,8 @@
* with this source code in the file LICENSE.
*/
-namespace Xezilaires\Annotation;
+namespace Xezilaires\Attribute;
-/**
- * @Annotation
- * @Target({"PROPERTY"})
- */
#[\Attribute(\Attribute::TARGET_PROPERTY)]
final class ArrayReference
{
diff --git a/src/Xezilaires/Annotation/ColumnReference.php b/src/Xezilaires/Attribute/ColumnReference.php
similarity index 78%
rename from src/Xezilaires/Annotation/ColumnReference.php
rename to src/Xezilaires/Attribute/ColumnReference.php
index 1a59e30..652e9b6 100644
--- a/src/Xezilaires/Annotation/ColumnReference.php
+++ b/src/Xezilaires/Attribute/ColumnReference.php
@@ -11,13 +11,8 @@
* with this source code in the file LICENSE.
*/
-namespace Xezilaires\Annotation;
+namespace Xezilaires\Attribute;
-/**
- * @Annotation
- * @Target({"ANNOTATION", "PROPERTY"})
- * @NamedArgumentConstructor
- */
#[\Attribute(\Attribute::TARGET_PROPERTY)]
final class ColumnReference implements Reference
{
diff --git a/src/Xezilaires/Annotation/HeaderReference.php b/src/Xezilaires/Attribute/HeaderReference.php
similarity index 78%
rename from src/Xezilaires/Annotation/HeaderReference.php
rename to src/Xezilaires/Attribute/HeaderReference.php
index 25e0e33..a1c820f 100644
--- a/src/Xezilaires/Annotation/HeaderReference.php
+++ b/src/Xezilaires/Attribute/HeaderReference.php
@@ -11,13 +11,8 @@
* with this source code in the file LICENSE.
*/
-namespace Xezilaires\Annotation;
+namespace Xezilaires\Attribute;
-/**
- * @Annotation
- * @Target({"ANNOTATION", "PROPERTY"})
- * @NamedArgumentConstructor
- */
#[\Attribute(\Attribute::TARGET_PROPERTY)]
final class HeaderReference implements Reference
{
diff --git a/src/Xezilaires/Annotation/Options.php b/src/Xezilaires/Attribute/Options.php
similarity index 85%
rename from src/Xezilaires/Annotation/Options.php
rename to src/Xezilaires/Attribute/Options.php
index 8d148cf..204e704 100644
--- a/src/Xezilaires/Annotation/Options.php
+++ b/src/Xezilaires/Attribute/Options.php
@@ -11,13 +11,8 @@
* with this source code in the file LICENSE.
*/
-namespace Xezilaires\Annotation;
+namespace Xezilaires\Attribute;
-/**
- * @Annotation
- * @Target({"CLASS"})
- * @NamedArgumentConstructor
- */
#[\Attribute(\Attribute::TARGET_CLASS)]
final class Options
{
diff --git a/src/Xezilaires/Annotation/Reference.php b/src/Xezilaires/Attribute/Reference.php
similarity index 91%
rename from src/Xezilaires/Annotation/Reference.php
rename to src/Xezilaires/Attribute/Reference.php
index abc3ea3..871d6fe 100644
--- a/src/Xezilaires/Annotation/Reference.php
+++ b/src/Xezilaires/Attribute/Reference.php
@@ -11,7 +11,7 @@
* with this source code in the file LICENSE.
*/
-namespace Xezilaires\Annotation;
+namespace Xezilaires\Attribute;
/**
* Marker interface Reference.
diff --git a/src/Xezilaires/Exception/AnnotationException.php b/src/Xezilaires/Exception/AnnotationException.php
deleted file mode 100644
index b370d77..0000000
--- a/src/Xezilaires/Exception/AnnotationException.php
+++ /dev/null
@@ -1,38 +0,0 @@
- $references
- */
- public static function tooManyReferencesDefined(\ReflectionProperty $property, array $references): self
- {
- return new self('Too many references defined for '.$property->getName());
- }
-
- public static function failedCreatingAnnotationReader(DoctrineAnnotationException $exception): self
- {
- return new self('Failed creating annotation reader', 0, $exception);
- }
-}
diff --git a/src/Xezilaires/Exception/AttributeException.php b/src/Xezilaires/Exception/AttributeException.php
new file mode 100644
index 0000000..e4755f3
--- /dev/null
+++ b/src/Xezilaires/Exception/AttributeException.php
@@ -0,0 +1,32 @@
+ $references
+ */
+ public static function tooManyReferencesDefined(\ReflectionProperty $property, array $references): self
+ {
+ return new self('Too many references defined for '.$property->getName());
+ }
+}
diff --git a/src/Xezilaires/Metadata/Annotation/AnnotationDriver.php b/src/Xezilaires/Metadata/Annotation/AnnotationDriver.php
deleted file mode 100644
index 3664349..0000000
--- a/src/Xezilaires/Metadata/Annotation/AnnotationDriver.php
+++ /dev/null
@@ -1,167 +0,0 @@
-reader = $reader ?? new AnnotationReader();
- } catch (\Doctrine\Common\Annotations\AnnotationException $exception) {
- throw AnnotationException::failedCreatingAnnotationReader($exception);
- }
- }
-
- /**
- * @throws \ReflectionException
- *
- * @psalm-param class-string $className
- */
- public function getMetadataMapping(string $className, ?array $options = null): Mapping
- {
- $reflectionClass = new \ReflectionClass($className);
-
- return new Mapping($className, $this->getColumns($reflectionClass), $this->getOptions($reflectionClass, $options));
- }
-
- /**
- * @return array
- */
- private function getColumns(\ReflectionClass $reflectionClass): array
- {
- $columns = [];
- foreach ($reflectionClass->getProperties() as $reflectionProperty) {
- $arrayAnnotation = $this->getPropertyAnnotationOrAttribute(
- $reflectionProperty,
- Annotation\ArrayReference::class
- );
- $columnAnnotation = $this->getPropertyAnnotationOrAttribute(
- $reflectionProperty,
- Annotation\ColumnReference::class
- );
- $headerAnnotation = $this->getPropertyAnnotationOrAttribute(
- $reflectionProperty,
- Annotation\HeaderReference::class
- );
-
- if ($arrayAnnotation === null && $columnAnnotation === null && $headerAnnotation === null) {
- // property not managed, skip
- continue;
- }
-
- if (($arrayAnnotation xor $columnAnnotation xor $headerAnnotation) === false) {
- // if any is set, only one is allowed
- throw AnnotationException::tooManyReferencesDefined($reflectionProperty, [$arrayAnnotation, $columnAnnotation, $headerAnnotation]);
- }
-
- switch (true) {
- case $columnAnnotation !== null:
- $reference = $this->createReference($columnAnnotation);
- break;
- case $headerAnnotation !== null:
- $reference = $this->createReference($headerAnnotation);
- break;
- case $arrayAnnotation !== null:
- $references = [];
- foreach ($arrayAnnotation->references as $annotation) {
- $references[] = $this->createReference($annotation);
- }
- $reference = new ArrayReference($references);
- break;
- default:
- throw AnnotationException::unsupportedAnnotation();
- }
-
- $columns[$reflectionProperty->getName()] = $reference;
- }
-
- return $columns;
- }
-
- private function getOptions(\ReflectionClass $reflectionClass, ?array $additionalOptions = null): array
- {
- $options = $this->getClassAnnotationOrAttribute($reflectionClass, Annotation\Options::class);
- if ($additionalOptions !== null) {
- $options = array_replace($options, $additionalOptions);
- }
-
- return array_filter($options);
- }
-
- private function createReference(Annotation\Reference $annotation): ColumnReference|HeaderReference
- {
- switch (true) {
- case $annotation instanceof Annotation\ColumnReference:
- $reference = new ColumnReference($annotation->column);
- break;
- case $annotation instanceof Annotation\HeaderReference:
- $reference = new HeaderReference($annotation->header);
- break;
- default:
- throw AnnotationException::unsupportedAnnotation();
- }
-
- return $reference;
- }
-
- /**
- * @template T
- *
- * @param class-string $name
- */
- private function getClassAnnotationOrAttribute(\ReflectionClass $reflection, string $name): array
- {
- $attribute = current($reflection->getAttributes($name));
- if ($attribute !== false) {
- return $attribute->getArguments();
- }
-
- return (array) $this->reader->getClassAnnotation($reflection, $name);
- }
-
- /**
- * @template T
- *
- * @param class-string $name
- *
- * @phpstan-return T|null
- */
- private function getPropertyAnnotationOrAttribute(\ReflectionProperty $reflection, string $name)
- {
- $attribute = current($reflection->getAttributes($name));
- if ($attribute !== false) {
- return $attribute->newInstance();
- }
-
- return $this->reader->getPropertyAnnotation($reflection, $name);
- }
-}
diff --git a/src/Xezilaires/Metadata/Attribute/AttributeDriver.php b/src/Xezilaires/Metadata/Attribute/AttributeDriver.php
new file mode 100644
index 0000000..1fda1de
--- /dev/null
+++ b/src/Xezilaires/Metadata/Attribute/AttributeDriver.php
@@ -0,0 +1,141 @@
+getColumns($reflectionClass), $this->getOptions($reflectionClass, $options));
+ }
+
+ /**
+ * @return array
+ */
+ private function getColumns(\ReflectionClass $reflectionClass): array
+ {
+ $columns = [];
+ foreach ($reflectionClass->getProperties() as $reflectionProperty) {
+ $arrayAttribute = $this->getPropertyAttribute(
+ $reflectionProperty,
+ Attribute\ArrayReference::class
+ );
+ $columnAttribute = $this->getPropertyAttribute(
+ $reflectionProperty,
+ Attribute\ColumnReference::class
+ );
+ $headerAttribute = $this->getPropertyAttribute(
+ $reflectionProperty,
+ Attribute\HeaderReference::class
+ );
+
+ if ($arrayAttribute === null && $columnAttribute === null && $headerAttribute === null) {
+ // property not managed, skip
+ continue;
+ }
+
+ if (($arrayAttribute xor $columnAttribute xor $headerAttribute) === false) {
+ // if any is set, only one is allowed
+ throw AttributeException::tooManyReferencesDefined($reflectionProperty, [$arrayAttribute, $columnAttribute, $headerAttribute]);
+ }
+
+ switch (true) {
+ case $columnAttribute !== null:
+ $reference = $this->createReference($columnAttribute);
+ break;
+ case $headerAttribute !== null:
+ $reference = $this->createReference($headerAttribute);
+ break;
+ case $arrayAttribute !== null:
+ $references = [];
+ foreach ($arrayAttribute->references as $attribute) {
+ $references[] = $this->createReference($attribute);
+ }
+ $reference = new ArrayReference($references);
+ break;
+ default:
+ throw AttributeException::unsupportedAttribute();
+ }
+
+ $columns[$reflectionProperty->getName()] = $reference;
+ }
+
+ return $columns;
+ }
+
+ private function getOptions(\ReflectionClass $reflectionClass, ?array $additionalOptions = null): array
+ {
+ $options = $this->getClassAttribute($reflectionClass, Attribute\Options::class);
+ if ($additionalOptions !== null) {
+ $options = array_replace($options, $additionalOptions);
+ }
+
+ return array_filter($options);
+ }
+
+ private function createReference(Attribute\Reference $attribute): ColumnReference|HeaderReference
+ {
+ return match (true) {
+ $attribute instanceof Attribute\ColumnReference => new ColumnReference($attribute->column),
+ $attribute instanceof Attribute\HeaderReference => new HeaderReference($attribute->header),
+ default => throw AttributeException::unsupportedAttribute(),
+ };
+ }
+
+ /**
+ * @template T
+ *
+ * @param class-string $name
+ */
+ private function getClassAttribute(\ReflectionClass $reflection, string $name): array
+ {
+ $attribute = current($reflection->getAttributes($name));
+ if ($attribute !== false) {
+ return $attribute->getArguments();
+ }
+
+ return [];
+ }
+
+ /**
+ * @template T
+ *
+ * @param class-string $name
+ *
+ * @phpstan-return T|null
+ */
+ private function getPropertyAttribute(\ReflectionProperty $reflection, string $name)
+ {
+ $attribute = current($reflection->getAttributes($name));
+ if ($attribute !== false) {
+ return $attribute->newInstance();
+ }
+
+ return null;
+ }
+}
diff --git a/src/Xezilaires/Test/Functional/FunctionalTestCase.php b/src/Xezilaires/Test/Functional/FunctionalTestCase.php
index f1028a1..86d7a7e 100644
--- a/src/Xezilaires/Test/Functional/FunctionalTestCase.php
+++ b/src/Xezilaires/Test/Functional/FunctionalTestCase.php
@@ -18,8 +18,8 @@
use Symfony\Component\Serializer\Serializer;
use Xezilaires\Exception\MappingException;
use Xezilaires\Exception\SpreadsheetException;
-use Xezilaires\Metadata\Annotation\AnnotationDriver;
use Xezilaires\Metadata\ArrayReference;
+use Xezilaires\Metadata\Attribute\AttributeDriver;
use Xezilaires\Metadata\ColumnReference;
use Xezilaires\Metadata\HeaderReference;
use Xezilaires\Metadata\Mapping;
@@ -113,7 +113,7 @@ public function testCanLoadFlatFixtureWithArrayReference(): void
}
/**
- * @uses \Xezilaires\Annotation\HeaderReference
+ * @uses \Xezilaires\Attribute\HeaderReference
*/
public function testCanLoadSparseFixtureWithHeaderReference(): void
{
@@ -140,19 +140,19 @@ public function testCanLoadSparseFixtureWithHeaderReference(): void
}
/**
- * @uses \Xezilaires\Annotation\ArrayReference
- * @uses \Xezilaires\Annotation\ColumnReference
- * @uses \Xezilaires\Annotation\HeaderReference
- * @uses \Xezilaires\Annotation\Options
- * @uses \Xezilaires\Metadata\Annotation\AnnotationDriver
- *
* @throws \ReflectionException
* @throws \RuntimeException
* @throws \ReflectionException
+ *
+ * @uses \Xezilaires\Attribute\ArrayReference
+ * @uses \Xezilaires\Attribute\ColumnReference
+ * @uses \Xezilaires\Attribute\HeaderReference
+ *@uses \Xezilaires\Attribute\Options
+ * @uses \Xezilaires\Metadata\Attribute\AttributeDriver
*/
- public function testCanLoadSparseFixtureWithAnnotations(): void
+ public function testCanLoadSparseFixtureWithAttributes(): void
{
- $driver = new AnnotationDriver();
+ $driver = new AttributeDriver();
$mapping = $driver->getMetadataMapping(Product::class);
$iterator = $this->createIterator(
@@ -168,18 +168,18 @@ public function testCanLoadSparseFixtureWithAnnotations(): void
}
/**
- * @uses \Xezilaires\Annotation\ColumnReference
- * @uses \Xezilaires\Annotation\HeaderReference
- * @uses \Xezilaires\Annotation\Options
- * @uses \Xezilaires\Metadata\Annotation\AnnotationDriver
- *
* @throws \ReflectionException
* @throws \RuntimeException
* @throws \ReflectionException
+ *
+ * @uses \Xezilaires\Attribute\ColumnReference
+ * @uses \Xezilaires\Attribute\HeaderReference
+ * @uses \Xezilaires\Attribute\Options
+ *@uses \Xezilaires\Metadata\Attribute\AttributeDriver
*/
public function testCanLoadSparseFixtureWithNativeAttributes(): void
{
- $driver = new AnnotationDriver();
+ $driver = new AttributeDriver();
$mapping = $driver->getMetadataMapping(ProductWithAttributes::class);
$iterator = $this->createIterator(
diff --git a/src/Xezilaires/Test/Model/Product.php b/src/Xezilaires/Test/Model/Product.php
index 0b9ec56..3014073 100644
--- a/src/Xezilaires/Test/Model/Product.php
+++ b/src/Xezilaires/Test/Model/Product.php
@@ -13,9 +13,9 @@
namespace Xezilaires\Test\Model;
-use Symfony\Component\Serializer\Annotation as Serializer;
+use Symfony\Component\Serializer\Attribute as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
-use Xezilaires\Annotation as XLS;
+use Xezilaires\Attribute as XLS;
#[XLS\Options(start: 2, header: 1)]
final class Product
diff --git a/src/Xezilaires/Test/Model/ProductWithAttributes.php b/src/Xezilaires/Test/Model/ProductWithAttributes.php
index fedaf36..701d608 100644
--- a/src/Xezilaires/Test/Model/ProductWithAttributes.php
+++ b/src/Xezilaires/Test/Model/ProductWithAttributes.php
@@ -13,7 +13,7 @@
namespace Xezilaires\Test\Model;
-use Xezilaires\Annotation as XLS;
+use Xezilaires\Attribute as XLS;
#[XLS\Options(header: 1, start: 2)]
final class ProductWithAttributes
diff --git a/src/Xezilaires/composer.json b/src/Xezilaires/composer.json
index 2b4e904..81be64d 100644
--- a/src/Xezilaires/composer.json
+++ b/src/Xezilaires/composer.json
@@ -15,7 +15,6 @@
"symfony/serializer": "^6.4 || ^7.0"
},
"require-dev": {
- "doctrine/annotations": "^1.12",
"nyholm/nsa": "^1.1",
"openspout/openspout": "^4.0",
"phpunit/phpunit": "^9.6",
diff --git a/src/Xezilaires/psalm.xml.dist b/src/Xezilaires/psalm.xml.dist
index e845a10..dddd175 100644
--- a/src/Xezilaires/psalm.xml.dist
+++ b/src/Xezilaires/psalm.xml.dist
@@ -24,7 +24,7 @@
-
+
@@ -36,7 +36,7 @@
-
+