From 54e6857d5300047cd6bf6d6adedff5d06cab07ef Mon Sep 17 00:00:00 2001 From: Jindrich Pilar Date: Sat, 29 Jan 2022 18:19:39 +0100 Subject: [PATCH 1/2] PHP 8.1 CI --- .github/workflows/main.yml | 52 +++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 74665f1..1782b0b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,11 +12,13 @@ jobs: continue-on-error: ${{ matrix.experimental }} strategy: matrix: - php-versions: ['7.3', '7.4', '8.0'] + php-versions: ['7.3', '7.4', '8.0', '8.1'] experimental: [ false ] + composer-extra-flags: [ "" ] include: - - php-versions: '8.1' + - php-versions: '8.2' experimental: true + composer-extra-flags: "--ignore-platform-req=php+" name: Unit tests on PHP ${{ matrix.php-versions }} steps: - name: Checkout @@ -37,7 +39,7 @@ jobs: restore-keys: php-${{ matrix.php-version }} - name: Install Dependencies - run: composer update --no-interaction --prefer-dist -a -o + run: composer update ${{ matrix.composer-extra-flags }} --no-interaction --prefer-dist -a -o - name: Run Tests run: vendor/bin/phpunit @@ -79,15 +81,25 @@ jobs: validate-syntax: runs-on: ubuntu-20.04 - name: Checking coding standard + continue-on-error: ${{ matrix.experimental }} + strategy: + matrix: + php-versions: [ '7.3', '7.4', '8.0', '8.1' ] + experimental: [ false ] + composer-extra-flags: [ "" ] + include: + - php-versions: '8.2' + experimental: true + composer-extra-flags: "--ignore-platform-req=php+" + name: Checking coding standard for PHP ${{ matrix.php-versions }} steps: - name: Checkout uses: actions/checkout@v2 - - name: Install PHP + - name: Install PHP ${{ matrix.php-versions }} uses: shivammathur/setup-php@v2 with: - php-version: 7.4 + php-version: ${{ matrix.php-versions }} - name: Cache/Restore dependencies uses: actions/cache@v2 @@ -95,26 +107,36 @@ jobs: path: | ~/.composer/cache vendor - key: php-7.4 - restore-keys: php-7.4 + key: php-${{ matrix.php-versions }} + restore-keys: php-${{ matrix.php-versions }} - name: Install Dependencies - run: composer update --no-interaction --prefer-dist -a -o + run: composer update ${{ matrix.composer-extra-flags }} --no-interaction --prefer-dist -a -o - name: Check coding standard run: vendor/bin/parallel-lint --no-colors --no-progress src tests phpstan: runs-on: ubuntu-20.04 - name: Performing static analysis (PHPStan) + name: Performing static analysis (PHPStan) for PHP ${{ matrix.php-versions }} + continue-on-error: ${{ matrix.experimental }} + strategy: + matrix: + php-versions: [ '7.3', '7.4', '8.0', '8.1' ] + experimental: [ false ] + composer-extra-flags: [ "" ] + include: + - php-versions: '8.2' + experimental: true + composer-extra-flags: "--ignore-platform-req=php+" steps: - name: Checkout uses: actions/checkout@v2 - - name: Install PHP + - name: Install PHP ${{ matrix.php-versions }} uses: shivammathur/setup-php@v2 with: - php-version: 7.4 + php-version: ${{ matrix.php-versions }} - name: Cache/Restore dependencies uses: actions/cache@v2 @@ -122,11 +144,11 @@ jobs: path: | ~/.composer/cache vendor - key: php-7.4 - restore-keys: php-7.4 + key: php-${{ matrix.php-versions }} + restore-keys: php-${{ matrix.php-versions }} - name: Install Dependencies - run: composer update --no-interaction --prefer-dist -a -o + run: composer update ${{ matrix.composer-extra-flags }} --no-interaction --prefer-dist -a -o - name: Run PHPStan run: vendor/bin/phpstan analyze --no-progress From 89bd4b5cd1d69353d70448ad4895c4dd05e0edbd Mon Sep 17 00:00:00 2001 From: Jindrich Pilar Date: Sat, 29 Jan 2022 23:12:06 +0100 Subject: [PATCH 2/2] PHP 8.1 __serialize and __unserialize --- src/Wsdl/Event/RequestFailEvent.php | 31 ++++++++++++++++++++--------- src/Wsdl/Event/RequestPostEvent.php | 27 +++++++++++++++++++------ src/Wsdl/Event/RequestPreEvent.php | 27 +++++++++++++++++++------ 3 files changed, 64 insertions(+), 21 deletions(-) diff --git a/src/Wsdl/Event/RequestFailEvent.php b/src/Wsdl/Event/RequestFailEvent.php index 821a9a6..65effcc 100644 --- a/src/Wsdl/Event/RequestFailEvent.php +++ b/src/Wsdl/Event/RequestFailEvent.php @@ -64,24 +64,28 @@ public function __construct( $this->time = $duration; } - public function serialize(): string - { - $data = [ + /** + * @return array + */ + public function __serialize(): array { + return [ 'fname' => $this->fname, 'args' => $this->args, 'time' => $this->time, 'exception_class' => $this->exceptionClass, 'exception_string' => $this->exceptionString, ]; - return serialize($data); } - /** - * @param string $data - */ - public function unserialize($data): void + public function serialize(): string { - $data = unserialize($data, ['allowed_classes' => [self::class]]); + return serialize($this->__serialize()); + } + + /** + * @param array $data + */ + public function __unserialize(array $data): void { $this->fname = (string) $data['fname']; $this->args = (array) $data['args']; $this->time = (float) $data['time']; @@ -89,6 +93,15 @@ public function unserialize($data): void $this->exceptionString = (string) $data['exception_string']; } + /** + * @param string $data + */ + public function unserialize($data): void + { + $data = unserialize($data, ['allowed_classes' => [self::class]]); + $this->__unserialize($data); + } + /** * Vrati tridu exception * diff --git a/src/Wsdl/Event/RequestPostEvent.php b/src/Wsdl/Event/RequestPostEvent.php index 4d80962..af28cc7 100644 --- a/src/Wsdl/Event/RequestPostEvent.php +++ b/src/Wsdl/Event/RequestPostEvent.php @@ -49,29 +49,44 @@ public function __construct( $this->time = $duration; } - public function serialize(): string + /** + * @return array + */ + public function __serialize(): array { - $data = [ + return [ 'fname' => $this->fname, 'args' => $this->args, 'time' => $this->time, 'result' => $this->result, ]; - return serialize($data); + } + + public function serialize(): string + { + return serialize($this->__serialize()); } /** - * @param string $data + * @param array $data */ - public function unserialize($data): void + public function __unserialize(array $data): void { - $data = unserialize($data, ['allowed_classes' => [self::class, stdClass::class]]); $this->fname = (string) $data['fname']; $this->args = (array) $data['args']; $this->time = (float) $data['time']; $this->result = (array) $data['result']; } + /** + * @param string $data + */ + public function unserialize($data): void + { + $data = unserialize($data, ['allowed_classes' => [self::class, stdClass::class]]); + $this->__unserialize($data); + } + public function getFname(): string { return $this->fname; diff --git a/src/Wsdl/Event/RequestPreEvent.php b/src/Wsdl/Event/RequestPreEvent.php index c4be2a7..05dda8d 100644 --- a/src/Wsdl/Event/RequestPreEvent.php +++ b/src/Wsdl/Event/RequestPreEvent.php @@ -57,24 +57,30 @@ public function __construct( $this->trace = $trace; } - public function serialize(): string + /** + * @return array + */ + public function __serialize(): array { - $data = [ + return [ 'fname' => $this->fname, 'args' => $this->args, 'options' => $this->options, 'inputHeaders' => $this->inputHeaders, 'trace' => $this->trace, ]; - return serialize($data); + } + + public function serialize(): string + { + return serialize($this->__serialize()); } /** - * @param string $data + * @param array $data */ - public function unserialize($data): void + public function __unserialize(array $data): void { - $data = unserialize($data, ['allowed_classes' => [self::class]]); $this->fname = (string) $data['fname']; $this->args = (array) $data['args']; $this->options = (array) $data['options']; @@ -82,6 +88,15 @@ public function unserialize($data): void $this->trace = (array) $data['trace']; } + /** + * @param string $data + */ + public function unserialize($data): void + { + $data = unserialize($data, ['allowed_classes' => [self::class]]); + $this->__unserialize($data); + } + public function getFname(): string { return $this->fname;