Skip to content

Commit

Permalink
php 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikzogg committed Dec 3, 2023
1 parent bc91031 commit 3732a91
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 71 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ on:
- cron: '0 0 * * *'

jobs:
php80:
name: PHP 8.0
runs-on: ubuntu-20.04
php81:
name: PHP 8.1
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v3
- name: composer test
uses: docker://chubbyphp/ci-php80:latest
uses: docker://chubbyphp/ci-php81:latest
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
php81:
name: PHP 8.1
runs-on: ubuntu-20.04
php82:
name: PHP 8.2
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v3
- name: composer test
uses: docker://chubbyphp/ci-php81:latest
uses: docker://chubbyphp/ci-php82:latest
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
php82:
name: PHP 8.2
runs-on: ubuntu-20.04
php83:
name: PHP 8.3
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v3
- name: composer test
uses: docker://chubbyphp/ci-php82:latest
uses: docker://chubbyphp/ci-php83:latest
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DS_Store
.idea/
.phpunit.cache
.vscode/
build/
composer.lock
vendor/
.phpunit.result.cache
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CI](https://github.com/chubbyphp/chubbyphp-workerman-request-handler/workflows/CI/badge.svg?branch=master)](https://github.com/chubbyphp/chubbyphp-workerman-request-handler/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/github/chubbyphp/chubbyphp-workerman-request-handler/badge.svg?branch=master)](https://coveralls.io/github/chubbyphp/chubbyphp-workerman-request-handler?branch=master)
[![Infection MSI](https://badge.stryker-mutator.io/github.com/chubbyphp/chubbyphp-workerman-request-handler/master)](https://dashboard.stryker-mutator.io/reports/github.com/chubbyphp/chubbyphp-workerman-request-handler/master)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fchubbyphp%2Fchubbyphp-workerman-request-handler%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/chubbyphp/chubbyphp-workerman-request-handler/master)[![Latest Stable Version](https://poser.pugx.org/chubbyphp/chubbyphp-workerman-request-handler/v/stable.png)](https://packagist.org/packages/chubbyphp/chubbyphp-workerman-request-handler)
[![Latest Stable Version](https://poser.pugx.org/chubbyphp/chubbyphp-workerman-request-handler/v/stable.png)](https://packagist.org/packages/chubbyphp/chubbyphp-workerman-request-handler)
[![Total Downloads](https://poser.pugx.org/chubbyphp/chubbyphp-workerman-request-handler/downloads.png)](https://packagist.org/packages/chubbyphp/chubbyphp-workerman-request-handler)
[![Monthly Downloads](https://poser.pugx.org/chubbyphp/chubbyphp-workerman-request-handler/d/monthly)](https://packagist.org/packages/chubbyphp/chubbyphp-workerman-request-handler)
Expand All @@ -25,19 +25,19 @@ A request handler adapter for workerman, using PSR-7, PSR-15 and PSR-17.

## Requirements

* php: ^8.0
* [psr/http-factory][2]: ^1.0.1
* [psr/http-message][3]: ^1.0.1
* [psr/http-server-handler][4]: ^1.0.1
* [psr/log][5]: ^1.1.4|^2.0|^3.0
* [workerman/workerman][6]: ^4.0.30
* php: ^8.1
* [psr/http-factory][2]: ^1.0.2
* [psr/http-message][3]: ^1.1|^2.0
* [psr/http-server-handler][4]: ^1.0.2
* [psr/log][5]: ^2.0|^3.0
* [workerman/workerman][6]: ^4.1.13

## Installation

Through [Composer](http://getcomposer.org) as [chubbyphp/chubbyphp-workerman-request-handler][1].

```sh
composer require chubbyphp/chubbyphp-workerman-request-handler "^2.0"
composer require chubbyphp/chubbyphp-workerman-request-handler "^2.1"
```

## Usage
Expand Down
31 changes: 14 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,22 @@
}
],
"require": {
"php": "^8.0",
"psr/http-factory": "^1.0.1",
"psr/http-message": "^1.0.1|^2.0",
"psr/http-server-handler": "^1.0.1",
"psr/log": "^1.1.4|^2.0|^3.0",
"workerman/workerman": "^4.0.30"
"php": "^8.1",
"psr/http-factory": "^1.0.2",
"psr/http-message": "^1.1|^2.0",
"psr/http-server-handler": "^1.0.2",
"psr/log": "^2.0|^3.0",
"workerman/workerman": "^4.1.13"
},
"require-dev": {
"blackfire/php-sdk": "^1.29",
"blackfire/php-sdk": "^2.3.5",
"chubbyphp/chubbyphp-dev-helper": "dev-master",
"chubbyphp/chubbyphp-mock": "^1.6.1",
"infection/infection": "^0.26.5",
"php-coveralls/php-coveralls": "^2.5.2",
"phploc/phploc": "^7.0.2",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.4.8",
"phpunit/phpunit": "^9.5.17"
"chubbyphp/chubbyphp-mock": "^1.7",
"infection/infection": "^0.27.8",
"php-coveralls/php-coveralls": "^2.7",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.45",
"phpunit/phpunit": "^10.4.2"
},
"autoload": {
"psr-4": { "Chubbyphp\\WorkermanRequestHandler\\": "src/" }
Expand All @@ -50,7 +49,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "2.1-dev"
}
},
"scripts": {
Expand All @@ -61,14 +60,12 @@
"@test:integration",
"@test:infection",
"@test:static-analysis",
"@test:loc",
"@test:cs"
],
"test:cs": "mkdir -p build && PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --cache-file=build/phpcs.cache",
"test:infection": "vendor/bin/infection --threads=$(nproc) --min-msi=100 --verbose --coverage=build/phpunit",
"test:integration": "vendor/bin/phpunit --testsuite=Integration --cache-result-file=build/phpunit/result.cache",
"test:lint": "mkdir -p build && find src tests -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php -l | tee build/phplint.log",
"test:loc": "mkdir -p build && vendor/bin/phploc src | tee build/phploc.log",
"test:static-analysis": "mkdir -p build && bash -c 'vendor/bin/phpstan analyse src --no-progress --level=7 --error-format=junit | tee build/phpstan.junit.xml; if [ ${PIPESTATUS[0]} -ne \"0\" ]; then exit 1; fi'",
"test:unit": "vendor/bin/phpunit --testsuite=Unit --coverage-text --coverage-clover=build/phpunit/clover.xml --coverage-html=build/phpunit/coverage-html --coverage-xml=build/phpunit/coverage-xml --log-junit=build/phpunit/junit.xml --cache-result-file=build/phpunit/result.cache"
}
Expand Down
39 changes: 15 additions & 24 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="random"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Integration">
<directory>./tests/Integration</directory>
</testsuite>
<testsuite name="Unit">
<directory>./tests/Unit</directory>
</testsuite>
</testsuites>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" colors="true" executionOrder="random" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage/>
<testsuites>
<testsuite name="Integration">
<directory>./tests/Integration</directory>
</testsuite>
<testsuite name="Unit">
<directory>./tests/Unit</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>./src</directory>
</include>
</source>
</phpunit>
4 changes: 1 addition & 3 deletions src/Adapter/NewRelicOnMessageAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

final class NewRelicOnMessageAdapter implements OnMessageInterface
{
public function __construct(private OnMessageInterface $onRequest, private string $appname)
{
}
public function __construct(private OnMessageInterface $onRequest, private string $appname) {}

public function __invoke(WorkermanTcpConnection $workermanTcpConnection, WorkermanRequest $workermanRequest): void
{
Expand Down
3 changes: 1 addition & 2 deletions src/OnMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function __construct(
private PsrRequestFactoryInterface $psrRequestFactory,
private WorkermanResponseEmitterInterface $workermanResponseEmitter,
private RequestHandlerInterface $requestHander
) {
}
) {}

public function __invoke(WorkermanTcpConnection $workermanTcpConnection, WorkermanRequest $workermanRequest): void
{
Expand Down
3 changes: 1 addition & 2 deletions src/PsrRequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public function __construct(
private ServerRequestFactoryInterface $serverRequestFactory,
private StreamFactoryInterface $streamFactory,
private UploadedFileFactoryInterface $uploadedFileFactory
) {
}
) {}

public function create(WorkermanTcpConnection $workermanTcpConnection, WorkermanRequest $workermanRequest): ServerRequestInterface
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Adapter/NewRelicOnMessageAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function newrelic_end_transaction(bool $ignore = false): void
*
* @internal
*/
final class NewRelicRouteMiddlewareTest extends TestCase
final class NewRelicOnMessageAdapterTest extends TestCase
{
use MockByCallsTrait;

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/PsrRequestFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ final class PsrRequestFactoryTest extends TestCase

public function testInvoke(): void
{
$bodyString = 'This is the body.';

/** @var MockObject|WorkermanRequest $workermanRequest */
$workermanRequest = $this->getMockByCalls(WorkermanRequest::class, [
Call::create('method')->with()->willReturn('POST'),
Expand Down Expand Up @@ -79,7 +81,7 @@ public function testInvoke(): void

/** @var MockObject|StreamInterface $requestBody */
$requestBody = $this->getMockByCalls(StreamInterface::class, [
Call::create('write')->with('This is the body.'),
Call::create('write')->with($bodyString)->willReturn(\strlen($bodyString)),
]);

/** @var MockObject|StreamInterface $uploadedFileStream1 */
Expand Down

0 comments on commit 3732a91

Please sign in to comment.