diff --git a/composer.json b/composer.json index 888d32a..1e5efac 100644 --- a/composer.json +++ b/composer.json @@ -21,9 +21,9 @@ "nyholm/nsa": "^1.1", "nyholm/symfony-bundle-test": "dev-master", "openspout/openspout": "^4.0", - "phpoffice/phpspreadsheet": "^1.18", + "phpoffice/phpspreadsheet": "^1.29", "phpunit/phpunit": "^9.6", - "sigwin/infra": "~1.5.0", + "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", diff --git a/infection.json.dist b/infection.json.dist index d522c95..235f6a9 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -14,9 +14,15 @@ "@default": true, "IdenticalEqual": false, "NotIdenticalNotEqual": false, + "IfNegation": { + "ignore": [ + "Xezilaires\\Bridge\\Symfony\\DependencyInjection\\XezilairesExtension::load::36", + "Xezilaires\\Bridge\\Symfony\\DependencyInjection\\XezilairesExtension::load::39" + ] + }, "MethodCallRemoval": { "ignore": [ - "Xezilaires\\Bridge\\Symfony\\DependencyInjection\\XezilairesExtension::load::45" + "Xezilaires\\Bridge\\Symfony\\DependencyInjection\\XezilairesExtension::load::43" ] } } diff --git a/src/Bridge/PhpSpreadsheet/RowIterator.php b/src/Bridge/PhpSpreadsheet/RowIterator.php index 1f4012d..51eebf0 100644 --- a/src/Bridge/PhpSpreadsheet/RowIterator.php +++ b/src/Bridge/PhpSpreadsheet/RowIterator.php @@ -30,49 +30,31 @@ public function __construct(PhpSpreadsheetRowIterator $iterator) $this->iterator = $iterator; } - /** - * {@inheritdoc} - */ public function current(): object { return $this->iterator->current(); } - /** - * {@inheritdoc} - */ public function next(): void { $this->iterator->next(); } - /** - * {@inheritdoc} - */ public function key(): int { return $this->iterator->key(); } - /** - * {@inheritdoc} - */ public function valid(): bool { return $this->iterator->valid(); } - /** - * {@inheritdoc} - */ public function rewind(): void { $this->iterator->rewind(); } - /** - * {@inheritdoc} - */ public function seek(int $rowIndex): void { try { @@ -82,9 +64,6 @@ public function seek(int $rowIndex): void } } - /** - * {@inheritdoc} - */ public function prev(): void { $this->iterator->prev(); diff --git a/src/Bridge/PhpSpreadsheet/Spreadsheet.php b/src/Bridge/PhpSpreadsheet/Spreadsheet.php index 5886ece..2cb7c4a 100644 --- a/src/Bridge/PhpSpreadsheet/Spreadsheet.php +++ b/src/Bridge/PhpSpreadsheet/Spreadsheet.php @@ -47,9 +47,6 @@ public static function fromFile(\SplFileObject $file): SpreadsheetInterface return new self($file); } - /** - * {@inheritdoc} - */ public function createIterator(int $startRowIndex): void { /** @psalm-suppress RedundantPropertyInitializationCheck */ @@ -62,9 +59,6 @@ public function createIterator(int $startRowIndex): void $this->iterator = new RowIterator($sheet->getRowIterator($startRowIndex)); } - /** - * {@inheritdoc} - */ public function getIterator(): Iterator { /** @psalm-suppress RedundantPropertyInitializationCheck */ @@ -75,9 +69,6 @@ public function getIterator(): Iterator return $this->iterator; } - /** - * {@inheritdoc} - */ public function getCurrentRow(): array { /** @var Row $row */ @@ -86,9 +77,6 @@ public function getCurrentRow(): array return $this->getRow($row->getRowIndex()); } - /** - * {@inheritdoc} - */ public function getRow(int $rowIndex): array { $data = []; @@ -103,9 +91,6 @@ public function getRow(int $rowIndex): array return $data; } - /** - * {@inheritdoc} - */ public function getHighestRow(): int { return $this->getActiveWorksheet()->getHighestRow(); diff --git a/src/Bridge/PhpSpreadsheet/Test/RowIteratorTest.php b/src/Bridge/PhpSpreadsheet/Test/RowIteratorTest.php index 4d25afe..cc3513d 100644 --- a/src/Bridge/PhpSpreadsheet/Test/RowIteratorTest.php +++ b/src/Bridge/PhpSpreadsheet/Test/RowIteratorTest.php @@ -89,7 +89,7 @@ private function mockIterator(?array $counts = null): PhpspreadsheetRowIterator $count = $spec['count']; $mocker = $iterator - ->expects(static::exactly($count)) + ->expects(self::exactly($count)) ->method($method) ->with(...(array) $spec['params']) ; diff --git a/src/Bridge/PhpSpreadsheet/composer.json b/src/Bridge/PhpSpreadsheet/composer.json index 6542038..1842f36 100644 --- a/src/Bridge/PhpSpreadsheet/composer.json +++ b/src/Bridge/PhpSpreadsheet/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": "^8.1", - "phpoffice/phpspreadsheet": "^1.18", + "phpoffice/phpspreadsheet": "^1.29", "sigwin/xezilaires": "^0.6" }, "require-dev": { diff --git a/src/Bridge/Spout/RowIterator.php b/src/Bridge/Spout/RowIterator.php index f1fb5aa..e58325f 100644 --- a/src/Bridge/Spout/RowIterator.php +++ b/src/Bridge/Spout/RowIterator.php @@ -39,9 +39,6 @@ public function __construct(RowIteratorInterface $iterator, int $firstRow) $this->firstRow = $firstRow; } - /** - * {@inheritdoc} - */ public function current(): object { /** @@ -57,17 +54,11 @@ public function current(): object return new \ArrayObject($current); } - /** - * {@inheritdoc} - */ public function next(): void { $this->iterator->next(); } - /** - * {@inheritdoc} - */ public function key(): int { /** @var int $key */ @@ -76,25 +67,16 @@ public function key(): int return $key; } - /** - * {@inheritdoc} - */ public function valid(): bool { return $this->iterator->valid(); } - /** - * {@inheritdoc} - */ public function rewind(): void { $this->seek($this->firstRow); } - /** - * {@inheritdoc} - */ public function seek(int $rowIndex): void { $currentIndex = $this->key(); @@ -111,9 +93,6 @@ public function seek(int $rowIndex): void } } - /** - * {@inheritdoc} - */ public function prev(): void { $this->seek($this->key() - 1); diff --git a/src/Bridge/Spout/Spreadsheet.php b/src/Bridge/Spout/Spreadsheet.php index 8af8cb6..a754872 100644 --- a/src/Bridge/Spout/Spreadsheet.php +++ b/src/Bridge/Spout/Spreadsheet.php @@ -54,9 +54,6 @@ public static function fromFile(\SplFileObject $file): SpreadsheetInterface return new self($file); } - /** - * {@inheritdoc} - */ public function createIterator(int $startRowIndex): void { /** @psalm-suppress RedundantPropertyInitializationCheck */ @@ -80,9 +77,6 @@ public function getIterator(): Iterator return $this->iterator; } - /** - * {@inheritdoc} - */ public function getRow(int $rowIndex): array { $iterator = $this->getIterator(); @@ -94,9 +88,6 @@ public function getRow(int $rowIndex): array return $row; } - /** - * {@inheritdoc} - */ public function getCurrentRow(): array { /** @var \ArrayObject $rowArrayObject */ @@ -117,9 +108,6 @@ public function getCurrentRow(): array return $row; } - /** - * {@inheritdoc} - */ public function getHighestRow(): int { /** @psalm-suppress RedundantPropertyInitializationCheck */ diff --git a/src/Bridge/Spout/Test/RowIteratorTest.php b/src/Bridge/Spout/Test/RowIteratorTest.php index 300f055..f9bfafc 100644 --- a/src/Bridge/Spout/Test/RowIteratorTest.php +++ b/src/Bridge/Spout/Test/RowIteratorTest.php @@ -29,7 +29,7 @@ final class RowIteratorTest extends TestCase /** * @return list */ - public function seekProvider(): array + public function provideCanSeekProperlyCases(): iterable { return [ [2, 2, 2, ['rewind' => 1, 'next' => 0, 'valid' => 0]], @@ -41,7 +41,7 @@ public function seekProvider(): array /** * @return list}}> */ - public function getHighestRowProvider(): array + public function provideCanDetermineHighestRowProperlyCases(): iterable { return [ [1, 1, 2, ['rewind' => 2, 'next' => 2], ['valid' => [true, true, false]]], @@ -49,7 +49,7 @@ public function getHighestRowProvider(): array } /** - * @dataProvider seekProvider + * @dataProvider provideCanSeekProperlyCases * * @param array $counts */ @@ -60,7 +60,7 @@ public function testCanSeekProperly(int $startRow, int $currentRow, int $seekToR } /** - * @dataProvider getHighestRowProvider + * @dataProvider provideCanDetermineHighestRowProperlyCases * * @param array $counts * @param array $calls @@ -71,7 +71,7 @@ public function testCanDetermineHighestRowProperly(int $startRow, int $currentRo ++$counts['rewind']; $iterator = new RowIterator($this->mockIterator($currentRow, $counts, $calls), $startRow); - static::assertSame($highestRow, $iterator->getHighestRow()); + self::assertSame($highestRow, $iterator->getHighestRow()); } /** @@ -93,7 +93,7 @@ private function mockIterator(int $currentRow, ?array $counts = null, ?array $ca if ($counts !== null) { foreach ($counts as $method => $count) { $iterator - ->expects(static::exactly($count)) + ->expects(self::exactly($count)) ->method($method) ; } @@ -102,7 +102,7 @@ private function mockIterator(int $currentRow, ?array $counts = null, ?array $ca if ($calls !== null) { foreach ($calls as $method => $return) { $iterator - ->expects(static::exactly(\count($return))) + ->expects(self::exactly(\count($return))) ->method($method) ->willReturnOnConsecutiveCalls(...$return) ; diff --git a/src/Bridge/Spout/Test/SpreadsheetTest.php b/src/Bridge/Spout/Test/SpreadsheetTest.php index eee7172..0057b0b 100644 --- a/src/Bridge/Spout/Test/SpreadsheetTest.php +++ b/src/Bridge/Spout/Test/SpreadsheetTest.php @@ -43,6 +43,6 @@ public function testCanCorrectlyCalculateColumns(): void $object = new Spreadsheet($this->invalidFixture('products.xlsx')); NSA::setProperty($object, 'iterator', new FakeIterator([(object) $row])); - static::assertSame(array_combine($values, $values), $object->getCurrentRow()); + self::assertSame(array_combine($values, $values), $object->getCurrentRow()); } } diff --git a/src/Bridge/Symfony/Command/SerializeCommand.php b/src/Bridge/Symfony/Command/SerializeCommand.php index eb5fe3c..a7070a7 100644 --- a/src/Bridge/Symfony/Command/SerializeCommand.php +++ b/src/Bridge/Symfony/Command/SerializeCommand.php @@ -41,9 +41,6 @@ public function __construct(IteratorFactory $iteratorFactory, Serializer $serial $this->serializer = $serializer; } - /** - * {@inheritdoc} - */ protected function configure(): void { $this diff --git a/src/Bridge/Symfony/Command/ValidateCommand.php b/src/Bridge/Symfony/Command/ValidateCommand.php index 6e0c319..fb7e00b 100644 --- a/src/Bridge/Symfony/Command/ValidateCommand.php +++ b/src/Bridge/Symfony/Command/ValidateCommand.php @@ -42,9 +42,6 @@ public function __construct(IteratorFactory $iteratorFactory, Validator $validat $this->validator = $validator; } - /** - * {@inheritdoc} - */ protected function configure(): void { $this diff --git a/src/Bridge/Symfony/DependencyInjection/CompilerPass/RegisterCommandsCompilerPass.php b/src/Bridge/Symfony/DependencyInjection/CompilerPass/RegisterCommandsCompilerPass.php index 9afa553..3b4dc91 100644 --- a/src/Bridge/Symfony/DependencyInjection/CompilerPass/RegisterCommandsCompilerPass.php +++ b/src/Bridge/Symfony/DependencyInjection/CompilerPass/RegisterCommandsCompilerPass.php @@ -22,9 +22,6 @@ */ final class RegisterCommandsCompilerPass implements CompilerPassInterface { - /** - * {@inheritdoc} - */ public function process(ContainerBuilder $container): void { /** @var array> $commands */ diff --git a/src/Bridge/Symfony/DependencyInjection/XezilairesExtension.php b/src/Bridge/Symfony/DependencyInjection/XezilairesExtension.php index 7874aa7..689e49e 100644 --- a/src/Bridge/Symfony/DependencyInjection/XezilairesExtension.php +++ b/src/Bridge/Symfony/DependencyInjection/XezilairesExtension.php @@ -21,8 +21,6 @@ final class XezilairesExtension extends Extension { /** - * {@inheritdoc} - * * @throws \Exception */ public function load(array $configs, ContainerBuilder $container): void diff --git a/src/Bridge/Symfony/Test/Functional/XezilairesBundleTest.php b/src/Bridge/Symfony/Test/Functional/XezilairesBundleTest.php index 903ac2e..415de88 100644 --- a/src/Bridge/Symfony/Test/Functional/XezilairesBundleTest.php +++ b/src/Bridge/Symfony/Test/Functional/XezilairesBundleTest.php @@ -60,8 +60,8 @@ public function testBundleHasValidator(): void $kernel = self::bootKernel(); $container = $kernel->getContainer(); - static::assertTrue($container->has(Validator::class)); - static::assertInstanceOf(\Xezilaires\Bridge\Symfony\Validator::class, $container->get(Validator::class)); + self::assertTrue($container->has(Validator::class)); + self::assertInstanceOf(\Xezilaires\Bridge\Symfony\Validator::class, $container->get(Validator::class)); } /** @@ -72,8 +72,8 @@ public function testBundleHasSerializer(): void $kernel = self::bootKernel(); $container = $kernel->getContainer(); - static::assertTrue($container->has(Serializer::class)); - static::assertInstanceOf(ObjectSerializer::class, $container->get(Serializer::class)); + self::assertTrue($container->has(Serializer::class)); + self::assertInstanceOf(ObjectSerializer::class, $container->get(Serializer::class)); } /** @@ -84,8 +84,8 @@ public function testBundleHasDenormalizer(): void $kernel = self::bootKernel(); $container = $kernel->getContainer(); - static::assertTrue($container->has(Denormalizer::class)); - static::assertInstanceOf(ObjectSerializer::class, $container->get(Denormalizer::class)); + self::assertTrue($container->has(Denormalizer::class)); + self::assertInstanceOf(ObjectSerializer::class, $container->get(Denormalizer::class)); } /** @@ -96,8 +96,8 @@ public function testBundleHasIteratorFactory(): void $kernel = self::bootKernel(); $container = $kernel->getContainer(); - static::assertTrue($container->has(IteratorFactory::class)); - static::assertInstanceOf(SpreadsheetIteratorFactory::class, $container->get(IteratorFactory::class)); + self::assertTrue($container->has(IteratorFactory::class)); + self::assertInstanceOf(SpreadsheetIteratorFactory::class, $container->get(IteratorFactory::class)); } /** @@ -118,7 +118,7 @@ public function testIteratorFactoryWorks(): void $mapping = new Mapping(Product::class, ['name' => new ColumnReference('A')]); $iterator = $iteratorFactory->fromFile($this->fixture('products.xlsx'), $mapping); - static::assertInstanceOf(SpreadsheetIterator::class, $iterator); + self::assertInstanceOf(SpreadsheetIterator::class, $iterator); } protected static function getKernelClass(): string diff --git a/src/Bridge/Symfony/infection.json.dist b/src/Bridge/Symfony/infection.json.dist index a830646..2e6409f 100644 --- a/src/Bridge/Symfony/infection.json.dist +++ b/src/Bridge/Symfony/infection.json.dist @@ -13,9 +13,15 @@ "@default": true, "IdenticalEqual": false, "NotIdenticalNotEqual": false, + "IfNegation": { + "ignore": [ + "Xezilaires\\Bridge\\Symfony\\DependencyInjection\\XezilairesExtension::load::36", + "Xezilaires\\Bridge\\Symfony\\DependencyInjection\\XezilairesExtension::load::39" + ] + }, "MethodCallRemoval": { "ignore": [ - "Xezilaires\\Bridge\\Symfony\\DependencyInjection\\XezilairesExtension::load::45" + "Xezilaires\\Bridge\\Symfony\\DependencyInjection\\XezilairesExtension::load::43" ] } } diff --git a/src/Xezilaires/FilterIterator.php b/src/Xezilaires/FilterIterator.php index 1f39309..41b6f74 100644 --- a/src/Xezilaires/FilterIterator.php +++ b/src/Xezilaires/FilterIterator.php @@ -32,17 +32,11 @@ public function __construct(Iterator $iterator, callable $filter) $this->filter = $filter; } - /** - * {@inheritdoc} - */ public function key(): int { return $this->key; } - /** - * {@inheritdoc} - */ public function accept(): bool { /** @var Iterator $iterator */ diff --git a/src/Xezilaires/Metadata/Annotation/AnnotationDriver.php b/src/Xezilaires/Metadata/Annotation/AnnotationDriver.php index d8dff3f..4060cc8 100644 --- a/src/Xezilaires/Metadata/Annotation/AnnotationDriver.php +++ b/src/Xezilaires/Metadata/Annotation/AnnotationDriver.php @@ -28,7 +28,7 @@ final class AnnotationDriver /** * @throws \RuntimeException if Doctrine's Annotations component is not available */ - public function __construct(AnnotationReader $reader = null) + public function __construct(?AnnotationReader $reader = null) { if (false === class_exists(AnnotationReader::class)) { throw new \RuntimeException('Xezilaires annotations support requires Doctrine Annotations component. Install "doctrine/annotations" to use it.'); diff --git a/src/Xezilaires/Metadata/Mapping.php b/src/Xezilaires/Metadata/Mapping.php index dfcc8de..c796868 100644 --- a/src/Xezilaires/Metadata/Mapping.php +++ b/src/Xezilaires/Metadata/Mapping.php @@ -39,7 +39,7 @@ final class Mapping /** * @param array $references */ - public function __construct(string $className, array $references, array $options = null) + public function __construct(string $className, array $references, ?array $options = null) { $this->setClassName($className); $this->setReferences($references); diff --git a/src/Xezilaires/ReverseIterator.php b/src/Xezilaires/ReverseIterator.php index 32b2d52..36cfffb 100644 --- a/src/Xezilaires/ReverseIterator.php +++ b/src/Xezilaires/ReverseIterator.php @@ -32,17 +32,11 @@ public function __construct(Iterator $iterator, int $startIndex, int $endIndex) $this->rewind(); } - /** - * {@inheritdoc} - */ public function current(): object { return $this->iterator->current(); } - /** - * {@inheritdoc} - */ public function seek(int $rowIndex = 1): void { $this->index = ($this->endIndex + 1) - $rowIndex; @@ -50,9 +44,6 @@ public function seek(int $rowIndex = 1): void $this->iterator->seek($this->index); } - /** - * {@inheritdoc} - */ public function prev(): void { --$this->index; @@ -60,9 +51,6 @@ public function prev(): void $this->iterator->next(); } - /** - * {@inheritdoc} - */ public function next(): void { ++$this->index; @@ -70,25 +58,16 @@ public function next(): void $this->iterator->prev(); } - /** - * {@inheritdoc} - */ public function key(): int { return $this->index; } - /** - * {@inheritdoc} - */ public function valid(): bool { return $this->index <= $this->endIndex - $this->startIndex; } - /** - * {@inheritdoc} - */ public function rewind(): void { $this->index = 0; diff --git a/src/Xezilaires/SpreadsheetIterator.php b/src/Xezilaires/SpreadsheetIterator.php index 003af3b..06cc221 100644 --- a/src/Xezilaires/SpreadsheetIterator.php +++ b/src/Xezilaires/SpreadsheetIterator.php @@ -53,9 +53,6 @@ public function __construct(Spreadsheet $spreadsheet, Mapping $mapping, Denormal $this->context = $context; } - /** - * {@inheritdoc} - */ public function current(): object { $row = $this->spreadsheet->getCurrentRow(); @@ -77,9 +74,6 @@ public function current(): object } } - /** - * {@inheritdoc} - */ public function prev(): void { --$this->index; @@ -87,9 +81,6 @@ public function prev(): void $this->getIterator()->prev(); } - /** - * {@inheritdoc} - */ public function next(): void { ++$this->index; @@ -97,9 +88,6 @@ public function next(): void $this->getIterator()->next(); } - /** - * {@inheritdoc} - */ public function key(): int { /** @var bool $sequential */ @@ -111,17 +99,11 @@ public function key(): int return $this->getIterator()->key(); } - /** - * {@inheritdoc} - */ public function valid(): bool { return $this->getIterator()->valid(); } - /** - * {@inheritdoc} - */ public function rewind(): void { $this->index = 0; @@ -129,9 +111,6 @@ public function rewind(): void $this->getIterator()->rewind(); } - /** - * {@inheritdoc} - */ public function seek(int $rowIndex): void { /** @var int $start */ diff --git a/src/Xezilaires/Test/ExampleBundle/Serializer/ProductNormalizer.php b/src/Xezilaires/Test/ExampleBundle/Serializer/ProductNormalizer.php index bafcfbf..4107d2a 100644 --- a/src/Xezilaires/Test/ExampleBundle/Serializer/ProductNormalizer.php +++ b/src/Xezilaires/Test/ExampleBundle/Serializer/ProductNormalizer.php @@ -18,7 +18,7 @@ final class ProductNormalizer implements DenormalizerInterface { - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): object + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): object { /** * @phpstan-ignore-next-line @@ -48,7 +48,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar return (object) $data; } - public function supportsDenormalization(mixed $data, string $type, string $format = null): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null): bool { return $type === Product::class; } diff --git a/src/Xezilaires/Test/FakeIterator.php b/src/Xezilaires/Test/FakeIterator.php index 863274d..36b7215 100644 --- a/src/Xezilaires/Test/FakeIterator.php +++ b/src/Xezilaires/Test/FakeIterator.php @@ -62,33 +62,21 @@ public static function toArray(\Iterator $iterator): array return $items; } - /** - * {@inheritdoc} - */ public function next(): void { $this->iterator->next(); } - /** - * {@inheritdoc} - */ public function valid(): bool { return $this->iterator->valid(); } - /** - * {@inheritdoc} - */ public function rewind(): void { $this->iterator->rewind(); } - /** - * {@inheritdoc} - */ public function current(): object { /** @var object $current */ @@ -97,9 +85,6 @@ public function current(): object return $current; } - /** - * {@inheritdoc} - */ public function key(): int { /** @var int|string $key */ @@ -112,17 +97,11 @@ public function key(): int return $key; } - /** - * {@inheritdoc} - */ public function seek(int $rowIndex): void { $this->iterator->seek($rowIndex); } - /** - * {@inheritdoc} - */ public function prev(): void { } diff --git a/src/Xezilaires/Test/FilterIteratorTest.php b/src/Xezilaires/Test/FilterIteratorTest.php index 73343c3..c3bbb13 100644 --- a/src/Xezilaires/Test/FilterIteratorTest.php +++ b/src/Xezilaires/Test/FilterIteratorTest.php @@ -39,7 +39,7 @@ public function testCanFilterOutIteratorItems(): void return $scalar % 2 === 0; }); - static::assertSame([2, 4], FakeIterator::toArray($filter)); + self::assertSame([2, 4], FakeIterator::toArray($filter)); } public function testCallbackReturnValueMustBeBool(): void @@ -56,6 +56,6 @@ public function testCallbackReturnValueMustBeBool(): void return false !== mb_strpos($scalar, 'ba'); }); - static::assertSame(['ba', 'abba', 'bae', 'nba', 'ban'], FakeIterator::toArray($filter)); + self::assertSame(['ba', 'abba', 'bae', 'nba', 'ban'], FakeIterator::toArray($filter)); } } diff --git a/src/Xezilaires/Test/Functional/FunctionalTestCase.php b/src/Xezilaires/Test/Functional/FunctionalTestCase.php index a719910..f1028a1 100644 --- a/src/Xezilaires/Test/Functional/FunctionalTestCase.php +++ b/src/Xezilaires/Test/Functional/FunctionalTestCase.php @@ -296,7 +296,7 @@ public function testCanFetchCurrentIteratorItem(): void ); $iterator->seek(1); - static::assertSame(3, $iterator->key()); + self::assertSame(3, $iterator->key()); $current = new Product(); $current->name = 'Brown Bear, Brown Bear, What Do You See?'; @@ -304,9 +304,9 @@ public function testCanFetchCurrentIteratorItem(): void $actual = $iterator->current(); - static::assertInstanceOf(Product::class, $actual); - static::assertSame($current->name, $actual->name); - static::assertSame($current->price, $actual->price); + self::assertInstanceOf(Product::class, $actual); + self::assertSame($current->name, $actual->name); + self::assertSame($current->price, $actual->price); } public function testCanRewindIterator(): void @@ -326,7 +326,7 @@ public function testCanRewindIterator(): void ); $iterator->seek(1); - static::assertSame(3, $iterator->key()); + self::assertSame(3, $iterator->key()); $iterator->rewind(); $actual = $iterator->current(); @@ -335,9 +335,9 @@ public function testCanRewindIterator(): void $current->name = 'The Very Hungry Caterpillar'; $current->price = 6.59; - static::assertInstanceOf(Product::class, $actual); - static::assertSame($current->name, $actual->name); - static::assertSame($current->price, $actual->price); + self::assertInstanceOf(Product::class, $actual); + self::assertSame($current->name, $actual->name); + self::assertSame($current->price, $actual->price); } /** diff --git a/src/Xezilaires/Test/Metadata/MappingTest.php b/src/Xezilaires/Test/Metadata/MappingTest.php index 10f4e3f..2532b7e 100644 --- a/src/Xezilaires/Test/Metadata/MappingTest.php +++ b/src/Xezilaires/Test/Metadata/MappingTest.php @@ -38,14 +38,14 @@ public function testMappingHasDefaultOptions(): void { $mapping = new Mapping(Product::class, ['name' => new ColumnReference('A')]); - static::assertSame(1, $mapping->getOption('start')); - static::assertNull($mapping->getOption('end')); - static::assertNull($mapping->getOption('header')); - static::assertFalse($mapping->getOption('reverse')); + self::assertSame(1, $mapping->getOption('start')); + self::assertNull($mapping->getOption('end')); + self::assertNull($mapping->getOption('header')); + self::assertFalse($mapping->getOption('reverse')); } /** - * @dataProvider getValidMappings + * @dataProvider provideCanCreateValidMappingCases * * @param class-string $className * @param array $columns @@ -55,18 +55,18 @@ public function testCanCreateValidMapping(string $className, array $columns, ?ar { $mapping = new Mapping($className, $columns, $options); - static::assertSame($className, $mapping->getClassName()); - static::assertSame($columns, $mapping->getReferences()); + self::assertSame($className, $mapping->getClassName()); + self::assertSame($columns, $mapping->getReferences()); if ($options !== null) { foreach ($options as $option => $value) { - static::assertSame($value, $mapping->getOption($option)); + self::assertSame($value, $mapping->getOption($option)); } } } /** - * @dataProvider getInvalidMappings + * @dataProvider provideCannotCreateInvalidMappingCases * * @psalm-suppress MixedArgumentTypeCoercion intentionally testing invalid mappings * @@ -89,7 +89,7 @@ public function testCannotCreateInvalidMapping( /** * @return iterable */ - public function getValidMappings(): iterable + public function provideCanCreateValidMappingCases(): iterable { yield [ Product::class, @@ -107,7 +107,7 @@ public function getValidMappings(): iterable /** * @return iterable, 3?: array}> */ - public function getInvalidMappings(): iterable + public function provideCannotCreateInvalidMappingCases(): iterable { yield ['Invalid class "foo"', 'foo', ['name' => new ColumnReference('A')]]; yield ['Invalid mapping, no references specified', Product::class, []]; diff --git a/src/Xezilaires/Test/SpreadsheetIteratorTest.php b/src/Xezilaires/Test/SpreadsheetIteratorTest.php index ce438e7..b8a395b 100644 --- a/src/Xezilaires/Test/SpreadsheetIteratorTest.php +++ b/src/Xezilaires/Test/SpreadsheetIteratorTest.php @@ -80,7 +80,7 @@ public function testCanPerformNextCorrectly(): void $key = $iterator->key(); $iterator->next(); - static::assertGreaterThan($key, $iterator->key()); + self::assertGreaterThan($key, $iterator->key()); } public function testCanPerformNextSequentially(): void @@ -104,7 +104,7 @@ public function testCanPerformNextSequentially(): void $key = $iterator->key(); $iterator->next(); - static::assertGreaterThan($key, $iterator->key()); + self::assertGreaterThan($key, $iterator->key()); } public function testCanPerformCurrentCorrectly(): void @@ -114,14 +114,14 @@ public function testCanPerformCurrentCorrectly(): void ->getMock() ; $spreadsheet - ->expects(static::once()) + ->expects(self::once()) ->method('getRow') ->willReturn( ['A' => 'One', 'B' => 'Two', 'C' => 'Three', 'D' => 'Four'], ) ; $spreadsheet - ->expects(static::once()) + ->expects(self::once()) ->method('getCurrentRow') ->willReturn( ['A' => 'Yes', 'B' => 'Nope', 'C' => 'Yeah', 'D' => 'Right'], @@ -133,7 +133,7 @@ public function testCanPerformCurrentCorrectly(): void ->getMock() ; $denormalizer - ->expects(static::once()) + ->expects(self::once()) ->method('denormalize') ->with( ['one' => 'Yes', 'two' => 'Nope', 'three' => ['Yeah', 'Right']], @@ -157,7 +157,7 @@ public function testWillOfferAnDidYouMeanForInvalidHeader(): void ->getMock() ; $spreadsheet - ->expects(static::once()) + ->expects(self::once()) ->method('getRow') ->with(1) ->willReturn(['Amen', 'Nope', 'Name']) @@ -208,7 +208,7 @@ private function mockIterator(?array $counts = null): Iterator $count = $spec['count']; $mocker = $iterator - ->expects(static::exactly($count)) + ->expects(self::exactly($count)) ->method($method) ->with(...(array) $spec['params']) ;