Skip to content

Commit

Permalink
Merge pull request #20 from IQ2i/php-8.1
Browse files Browse the repository at this point in the history
Add PHP 8.1 compatibility
  • Loading branch information
loicsapone authored Nov 29, 2021
2 parents 6686d71 + bb42f53 commit 4dfcd26
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 22 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
10 changes: 6 additions & 4 deletions Reader/CsvReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,16 @@ public function current(): array
/**
* {@inheritdoc}
*/
public function next()
public function next(): void
{
$this->iterator->next();
++$this->index;
}

/**
* {@inheritdoc}
*
* @return mixed
*/
public function key()
{
Expand All @@ -152,15 +154,15 @@ public function key()
/**
* {@inheritdoc}
*/
public function valid()
public function valid(): bool
{
return $this->iterator->valid();
}

/**
* {@inheritdoc}
*/
public function rewind()
public function rewind(): void
{
$this->iterator->rewind();

Expand All @@ -175,7 +177,7 @@ public function rewind()
/**
* {@inheritdoc}
*/
public function count()
public function count(): int
{
return $this->count;
}
Expand Down
11 changes: 7 additions & 4 deletions Reader/ReaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace IQ2i\DataImporter\Reader;

use ReturnTypeWillChange;

interface ReaderInterface extends \Iterator, \Countable
{
/**
Expand Down Expand Up @@ -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;
}
10 changes: 6 additions & 4 deletions Reader/XmlReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,16 @@ public function current(): array
/**
* {@inheritdoc}
*/
public function next()
public function next(): void
{
$this->iterator->next();
++$this->index;
}

/**
* {@inheritdoc}
*
* @return mixed
*/
public function key()
{
Expand All @@ -131,23 +133,23 @@ public function key()
/**
* {@inheritdoc}
*/
public function valid()
public function valid(): bool
{
return $this->iterator->valid();
}

/**
* {@inheritdoc}
*/
public function rewind()
public function rewind(): void
{
$this->iterator->rewind();
}

/**
* {@inheritdoc}
*/
public function count()
public function count(): int
{
return $this->iterator->count();
}
Expand Down

0 comments on commit 4dfcd26

Please sign in to comment.