Skip to content

Commit

Permalink
Merge branch 'master' of github.com:swoole/library
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed May 29, 2024
2 parents b1dfd92 + 8aa2425 commit 2a97eef
Show file tree
Hide file tree
Showing 39 changed files with 243 additions and 428 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-swoole.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0", "8.1", "8.2", "8.3"]
php: ["8.1", "8.2", "8.3"]

name: PHP ${{ matrix.php }} - Swoole

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 5
command: composer require phpstan/phpstan=^1.11.x-dev -n -q --no-progress
command: composer require phpstan/phpstan=~1.11.0 -n -q --no-progress

- name: Run Static Analysis
run: ./vendor/bin/phpstan analyse --no-progress --memory-limit 2G
2 changes: 1 addition & 1 deletion .github/workflows/syntax_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: ["8.0", "8.1", "8.2", "8.3"]
php: ["8.1", "8.2", "8.3"]

name: Syntax Checks Under PHP ${{ matrix.php }}

Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ name: Unit Tests
on: [ push, pull_request, workflow_dispatch ]

jobs:
# Run unit tests with Swoole 5.0, Swoole 5.1, and latest code of Swoole.
# Run unit tests with Swoole 5.1+.
unit-tests:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
php: ["8.0", "8.1", "8.2", "8.3"]
swoole-prefix: ["5.0-", "5.1-", ""]
exclude:
- php: "8.3"
swoole-prefix: "5.0-"
php: ["8.1", "8.2", "8.3"]
swoole-prefix: ["5.1-", ""]

name: Run Tests Using Image ${{ matrix.swoole-prefix }}php${{ matrix.php }}

Expand Down
14 changes: 4 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM phpswoole/swoole
RUN apt update \
&& apt install -y libaio-dev libc-ares-dev libaio1 supervisor wget git \
&& wget -nv https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip \
&& unzip instantclient-basiclite-linuxx64.zip && rm instantclient-basiclite-linuxx64.zip \
&& unzip instantclient-basiclite-linuxx64.zip && rm -rf META-INF instantclient-basiclite-linuxx64.zip \
&& wget -nv https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip \
&& unzip instantclient-sdk-linuxx64.zip && rm instantclient-sdk-linuxx64.zip \
&& unzip instantclient-sdk-linuxx64.zip && rm -rf META-INF instantclient-sdk-linuxx64.zip \
&& mv instantclient_*_* ./instantclient \
&& rm ./instantclient/sdk/include/ldap.h \
&& echo DISABLE_INTERRUPT=on > ./instantclient/network/admin/sqlnet.ora \
Expand All @@ -15,14 +15,8 @@ RUN apt update \
&& export ORACLE_HOME=instantclient,/usr/local/instantclient \
&& apt install -y sqlite3 libsqlite3-dev libpq-dev \
&& pecl update-channels \
&& docker-php-ext-install mysqli \
&& docker-php-ext-enable mysqli \
&& docker-php-ext-install pdo_pgsql \
&& docker-php-ext-enable pdo_pgsql \
&& docker-php-ext-install pdo_oci \
&& docker-php-ext-enable pdo_oci \
&& docker-php-ext-install pdo_sqlite \
&& docker-php-ext-enable pdo_sqlite \
&& docker-php-ext-install mysqli pdo_oci pdo_pgsql pdo_sqlite \
&& docker-php-ext-enable mysqli pdo_oci pdo_pgsql pdo_sqlite \
&& git clone https://github.com/swoole/swoole-src.git \
&& cd ./swoole-src \
&& phpize \
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
"issues": "https://github.com/swoole/library"
},
"require": {
"php": ">=8.0",
"ext-swoole": ">=5.0"
"php": ">=8.1",
"ext-swoole": ">=5.1"
},
"require-dev": {
"ext-sockets": "*",
"ext-json": "*",
"ext-redis": "*",
"ext-curl": "*",
"phpunit/phpunit": "~9.0 || ~10.0",
"phpunit/phpunit": "~10.0 || ~11.0",
"swoole/ide-helper": "dev-master"
},
"suggest": {
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.2'

services:
app:
build: .
Expand Down
2 changes: 1 addition & 1 deletion src/core/Coroutine/Barrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function make(): self
/**
* @throws Exception
*/
public static function wait(Barrier &$barrier, float $timeout = -1)
public static function wait(Barrier &$barrier, float $timeout = -1): void
{
if ($barrier->cid !== -1) {
throw new Exception('The barrier is waiting, cannot wait again.');
Expand Down
2 changes: 1 addition & 1 deletion src/core/Server/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Admin

private static string $accessToken = '';

public static function init(Server $server)
public static function init(Server $server): void
{
$accepted_process_types = SWOOLE_SERVER_COMMAND_MASTER |
SWOOLE_SERVER_COMMAND_MANAGER |
Expand Down
8 changes: 4 additions & 4 deletions src/core/Server/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Helper
'admin_server' => true,
];

public static function checkOptions(array $input_options)
public static function checkOptions(array $input_options): void
{
$const_options = self::GLOBAL_OPTIONS + self::SERVER_OPTIONS + self::PORT_OPTIONS
+ self::AIO_OPTIONS + self::COROUTINE_OPTIONS + self::HELPER_OPTIONS;
Expand All @@ -215,7 +215,7 @@ public static function checkOptions(array $input_options)
}
}

public static function onBeforeStart(Server $server)
public static function onBeforeStart(Server $server): void
{
if (!empty($server->setting['admin_server'])) {
Admin::init($server);
Expand All @@ -230,7 +230,7 @@ public static function onBeforeShutdown(Server $server): void
}
}

public static function onWorkerStart(Server $server, int $workerId)
public static function onWorkerStart(Server $server, int $workerId): void
{
if (!empty($server->setting['stats_file']) and $workerId == 0) {
$interval_ms = empty($server->setting['stats_timer_interval']) ? self::STATS_TIMER_INTERVAL_TIME : intval($server->setting['stats_timer_interval']);
Expand All @@ -254,7 +254,7 @@ public static function onWorkerStart(Server $server, int $workerId)
}
}

public static function onWorkerExit(Server $server, int $workerId)
public static function onWorkerExit(Server $server, int $workerId): void
{
if ($server->stats_timer) {
Timer::clear($server->stats_timer);
Expand Down
Loading

0 comments on commit 2a97eef

Please sign in to comment.