diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 5e5932c..93eb1f0 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -15,14 +15,16 @@ jobs: strategy: matrix: operating-system: ['ubuntu-latest', 'macos-latest'] - php-version: ['7.2.5', '7.3', '7.4', '8.0'] + php-version: ['7.2.5', '7.3', '7.4', '8.0', '8.1'] steps: - - name: "Checkout" - uses: "actions/checkout@v2" + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 2 - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" + - name: Install PHP + uses: shivammathur/setup-php@v2 with: php-version: "${{ matrix.php-version }}" tools: composer:v2, php-cs-fixer, phpstan @@ -41,11 +43,17 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress --no-suggest - - name: Test PHPUnit - run: ./vendor/bin/phpunit - - name: Test PHP-CS-Fixer - run: php-cs-fixer fix --dry-run --diff --no-ansi + if: matrix.php-version != '8.1' + run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --no-ansi - name: Test PHPStan - run: phpstan analyse + run: ./vendor/bin/phpstan analyse + + - name: Test PHPUnit + run: ./vendor/bin/phpunit --coverage-clover=coverage.clover + + - name: Upload coverage to Scrutinizer + run: | + composer global require scrutinizer/ocular + ~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover diff --git a/Reader/CsvReader.php b/Reader/CsvReader.php index c693c55..84d3f10 100644 --- a/Reader/CsvReader.php +++ b/Reader/CsvReader.php @@ -135,7 +135,7 @@ public function current(): array /** * {@inheritdoc} */ - public function next() + public function next(): void { $this->iterator->next(); ++$this->index; @@ -143,6 +143,8 @@ public function next() /** * {@inheritdoc} + * + * @return mixed */ public function key() { @@ -152,7 +154,7 @@ public function key() /** * {@inheritdoc} */ - public function valid() + public function valid(): bool { return $this->iterator->valid(); } @@ -160,7 +162,7 @@ public function valid() /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->iterator->rewind(); @@ -175,7 +177,7 @@ public function rewind() /** * {@inheritdoc} */ - public function count() + public function count(): int { return $this->count; } diff --git a/Reader/ReaderInterface.php b/Reader/ReaderInterface.php index d99075d..4708a49 100644 --- a/Reader/ReaderInterface.php +++ b/Reader/ReaderInterface.php @@ -11,6 +11,8 @@ namespace IQ2i\DataImporter\Reader; +use ReturnTypeWillChange; + interface ReaderInterface extends \Iterator, \Countable { /** @@ -41,25 +43,26 @@ public function current(): array; /** * {@inheritdoc} */ - public function next(); + public function next(): void; /** * {@inheritdoc} */ + #[ReturnTypeWillChange] public function key(); /** * {@inheritdoc} */ - public function valid(); + public function valid(): bool; /** * {@inheritdoc} */ - public function rewind(); + public function rewind(): void; /** * {@inheritdoc} */ - public function count(); + public function count(): int; } diff --git a/Reader/XmlReader.php b/Reader/XmlReader.php index 2dc9e33..b725822 100644 --- a/Reader/XmlReader.php +++ b/Reader/XmlReader.php @@ -114,7 +114,7 @@ public function current(): array /** * {@inheritdoc} */ - public function next() + public function next(): void { $this->iterator->next(); ++$this->index; @@ -122,6 +122,8 @@ public function next() /** * {@inheritdoc} + * + * @return mixed */ public function key() { @@ -131,7 +133,7 @@ public function key() /** * {@inheritdoc} */ - public function valid() + public function valid(): bool { return $this->iterator->valid(); } @@ -139,7 +141,7 @@ public function valid() /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->iterator->rewind(); } @@ -147,7 +149,7 @@ public function rewind() /** * {@inheritdoc} */ - public function count() + public function count(): int { return $this->iterator->count(); }