Skip to content

Commit

Permalink
Merge pull request #100 from JindrichPilar/php-8.1
Browse files Browse the repository at this point in the history
PHP 8.1 CI
  • Loading branch information
sinacek committed Apr 10, 2022
2 parents 76f56ab + 89bd4b5 commit 207eab3
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 36 deletions.
52 changes: 37 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -79,54 +81,74 @@ 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
with:
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
with:
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
31 changes: 22 additions & 9 deletions src/Wsdl/Event/RequestFailEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,44 @@ public function __construct(
$this->time = $duration;
}

public function serialize(): string
{
$data = [
/**
* @return array<mixed>
*/
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<mixed> $data
*/
public function __unserialize(array $data): void {
$this->fname = (string) $data['fname'];
$this->args = (array) $data['args'];
$this->time = (float) $data['time'];
$this->exceptionClass = (string) $data['exception_class'];
$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
*
Expand Down
27 changes: 21 additions & 6 deletions src/Wsdl/Event/RequestPostEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,44 @@ public function __construct(
$this->time = $duration;
}

public function serialize(): string
/**
* @return array<mixed>
*/
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<mixed> $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;
Expand Down
27 changes: 21 additions & 6 deletions src/Wsdl/Event/RequestPreEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,46 @@ public function __construct(
$this->trace = $trace;
}

public function serialize(): string
/**
* @return array<mixed>
*/
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<mixed> $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'];
$this->inputHeaders = (array) $data['inputHeaders'];
$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;
Expand Down

0 comments on commit 207eab3

Please sign in to comment.