Skip to content

Commit

Permalink
Fix compatibility with PHP 8.1 (#59)
Browse files Browse the repository at this point in the history
* Fix PHP 8.1

* Update ci

* Fix
  • Loading branch information
Yurunsoft committed Jan 10, 2022
1 parent d776938 commit f154746
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
1 change: 0 additions & 1 deletion .github/docker-compose.yml
Expand Up @@ -75,7 +75,6 @@ services:
dockerfile: ./swoole.dockerfile
args:
SWOOLE_VERSION: ${SWOOLE_VERSION}
PHP_VERSION: ${PHP_VERSION}
depends_on:
- zookeeper
- kafka1
Expand Down
3 changes: 1 addition & 2 deletions .github/swoole.dockerfile
@@ -1,6 +1,5 @@
ARG SWOOLE_VERSION
ARG PHP_VERSION
FROM phpswoole/swoole:${SWOOLE_VERSION}-php${PHP_VERSION}
FROM phpswoole/swoole:${SWOOLE_VERSION}

# apt
RUN apt update
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Expand Up @@ -9,13 +9,19 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.1, 7.2, 7.3, 7.4, "8.0"]
swoole: [
4.5-php7.1,
4.5-php7.2,
4.5-php7.3,
4.5-php7.4,
4.5-php8.0,
php8.1,
]
kafka: [1.0.0, 2.11-1.1.1, 2.13-2.6.0, 2.13-2.7.0]

env:
PHP_VERSION: ${{ matrix.php }}
SWOOLE_VERSION: ${{ matrix.swoole }}
KAFKA_VERSION: ${{ matrix.kafka }}
SWOOLE_VERSION: "4.5"
KAFKA_HOST: kafka1
KAFKA_PLAINTEXT_PORT: 9092
KAFKA_SASL_PLAINTEXT_PORT: 9093
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/phpcs.yml
Expand Up @@ -9,13 +9,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.4]
swoole: [4.5-php7.1]
kafka: [2.13-2.7.0]

env:
PHP_VERSION: ${{ matrix.php }}
SWOOLE_VERSION: ${{ matrix.swoole }}
KAFKA_VERSION: ${{ matrix.kafka }}
SWOOLE_VERSION: 4.5

steps:
- uses: actions/checkout@v2
Expand All @@ -34,4 +33,4 @@ jobs:
docker exec swoole composer update
- name: Test
run: docker exec swoole ./vendor/bin/php-cs-fixer fix --dry-run
run: docker exec swoole ./vendor/bin/php-cs-fixer fix --dry-run --diff
5 changes: 2 additions & 3 deletions .github/workflows/phpstan.yml
Expand Up @@ -9,13 +9,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.4]
swoole: [4.5-php7.1]
kafka: [2.13-2.7.0]

env:
PHP_VERSION: ${{ matrix.php }}
SWOOLE_VERSION: ${{ matrix.swoole }}
KAFKA_VERSION: ${{ matrix.kafka }}
SWOOLE_VERSION: 4.5

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Expand Up @@ -6,7 +6,8 @@
"php": ">=7.1",
"google/crc32": "^0.1.0",
"exussum12/xxhash": "^1.0.0",
"chdemko/sorted-collections": "^1.0"
"chdemko/sorted-collections": "^1.0",
"symfony/polyfill-php81": "^1.23"
},
"require-dev": {
"phpunit/phpunit": "^7.5|^8.0|^9.0",
Expand All @@ -30,4 +31,4 @@
"swoole-test": "export KAFKA_CLIENT_CLASS=\"\\longlang\\phpkafka\\Client\\SwooleClient\" && ./swoole-phpunit",
"test-coverage": "php -dzend_extension=xdebug ./vendor/bin/phpunit"
}
}
}
1 change: 1 addition & 0 deletions src/Protocol/AbstractStruct.php
Expand Up @@ -205,6 +205,7 @@ public function getFlexibleVersions(): array
*
* @return array
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->toArray();
Expand Down

0 comments on commit f154746

Please sign in to comment.