Skip to content

Commit 4ceba76

Browse files
authored
Upgrade to v2.2 (#67)
1 parent 1e3750f commit 4ceba76

File tree

16 files changed

+426
-109
lines changed

16 files changed

+426
-109
lines changed

.github/workflows/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
77

8-
FROM hyperf/hyperf:7.4-alpine-v3.11-swoole
8+
FROM hyperf/hyperf:8.0-alpine-v3.12-swoole
99
LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MIT" app.name="Hyperf"
1010

1111
##
@@ -25,7 +25,7 @@ RUN set -ex \
2525
&& php -m \
2626
&& php --ri swoole \
2727
# ---------- some config ----------
28-
&& cd /etc/php7 \
28+
&& cd /etc/php8 \
2929
# - config PHP
3030
&& { \
3131
echo "upload_max_filesize=128M"; \

.php_cs renamed to .php-cs-fixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
1010
EOF;
1111

12-
return PhpCsFixer\Config::create()
12+
return (new PhpCsFixer\Config())
1313
->setRiskyAllowed(true)
1414
->setRules([
1515
'@PSR2' => true,
1616
'@Symfony' => true,
1717
'@DoctrineAnnotation' => true,
1818
'@PhpCsFixer' => true,
1919
'header_comment' => [
20-
'commentType' => 'PHPDoc',
20+
'comment_type' => 'PHPDoc',
2121
'header' => $header,
2222
'separate' => 'none',
2323
'location' => 'after_declare_strict',

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
77

8-
FROM hyperf/hyperf:7.4-alpine-v3.11-swoole
8+
FROM hyperf/hyperf:8.0-alpine-v3.12-swoole
99
LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MIT" app.name="Hyperf"
1010

1111
##
@@ -25,7 +25,7 @@ RUN set -ex \
2525
&& php -m \
2626
&& php --ri swoole \
2727
# ---------- some config ----------
28-
&& cd /etc/php7 \
28+
&& cd /etc/php8 \
2929
# - config PHP
3030
&& { \
3131
echo "upload_max_filesize=128M"; \

composer.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,25 @@
1313
"license": "Apache-2.0",
1414
"require": {
1515
"php": ">=7.3",
16-
"hyperf/cache": "~2.1.0",
17-
"hyperf/command": "~2.1.0",
18-
"hyperf/config": "~2.1.0",
19-
"hyperf/db-connection": "~2.1.0",
20-
"hyperf/framework": "~2.1.0",
21-
"hyperf/guzzle": "~2.1.0",
22-
"hyperf/http-server": "~2.1.0",
23-
"hyperf/logger": "~2.1.0",
24-
"hyperf/memory": "~2.1.0",
25-
"hyperf/process": "~2.1.0"
16+
"hyperf/cache": "~2.2.0",
17+
"hyperf/command": "~2.2.0",
18+
"hyperf/config": "~2.2.0",
19+
"hyperf/db-connection": "~2.2.0",
20+
"hyperf/framework": "~2.2.0",
21+
"hyperf/guzzle": "~2.2.0",
22+
"hyperf/http-server": "~2.2.0",
23+
"hyperf/logger": "~2.2.0",
24+
"hyperf/memory": "~2.2.0",
25+
"hyperf/process": "~2.2.0"
2626
},
2727
"require-dev": {
28-
"swoole/ide-helper": "^4.5",
2928
"friendsofphp/php-cs-fixer": "^3.0",
29+
"hyperf/devtool": "~2.2.0",
30+
"hyperf/ide-helper": "~2.2.0",
31+
"hyperf/testing": "~2.2.0",
3032
"mockery/mockery": "^1.0",
3133
"phpstan/phpstan": "^0.12",
32-
"hyperf/devtool": "~2.1.0",
33-
"hyperf/testing": "~2.1.0"
34+
"swoole/ide-helper": "^4.5"
3435
},
3536
"suggest": {
3637
"ext-openssl": "Required to use HTTPS.",
@@ -68,7 +69,7 @@
6869
"post-autoload-dump": [
6970
"rm -rf runtime/container"
7071
],
71-
"test": "co-phpunit -c phpunit.xml --colors=always",
72+
"test": "co-phpunit --prepend test/bootstrap.php -c phpunit.xml --colors=always",
7273
"cs-fix": "php-cs-fixer fix $1",
7374
"analyse": "phpstan analyse --memory-limit 300M -l 0 -c phpstan.neon ./app ./config",
7475
"start": [

installer/config.php

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,61 +12,61 @@
1212
return [
1313
'packages' => [
1414
'hyperf/amqp' => [
15-
'version' => '~2.1.0',
15+
'version' => '~2.2.0',
1616
],
1717
'hyperf/async-queue' => [
18-
'version' => '~2.1.0',
18+
'version' => '~2.2.0',
1919
],
2020
'hyperf/database' => [
21-
'version' => '~2.1.0',
21+
'version' => '~2.2.0',
2222
],
2323
'hyperf/db-connection' => [
24-
'version' => '~2.1.0',
24+
'version' => '~2.2.0',
2525
],
2626
'hyperf/model-cache' => [
27-
'version' => '~2.1.0',
27+
'version' => '~2.2.0',
2828
],
2929
'hyperf/constants' => [
30-
'version' => '~2.1.0',
30+
'version' => '~2.2.0',
3131
],
3232
'hyperf/json-rpc' => [
33-
'version' => '~2.1.0',
33+
'version' => '~2.2.0',
3434
],
3535
'hyperf/redis' => [
36-
'version' => '~2.1.0',
36+
'version' => '~2.2.0',
3737
],
3838
'hyperf/rpc' => [
39-
'version' => '~2.1.0',
39+
'version' => '~2.2.0',
4040
],
4141
'hyperf/rpc-client' => [
42-
'version' => '~2.1.0',
42+
'version' => '~2.2.0',
4343
],
4444
'hyperf/rpc-server' => [
45-
'version' => '~2.1.0',
45+
'version' => '~2.2.0',
4646
],
4747
'hyperf/grpc-client' => [
48-
'version' => '~2.1.0',
48+
'version' => '~2.2.0',
4949
],
5050
'hyperf/grpc-server' => [
51-
'version' => '~2.1.0',
51+
'version' => '~2.2.0',
5252
],
5353
'hyperf/elasticsearch' => [
54-
'version' => '~2.1.0',
54+
'version' => '~2.2.0',
5555
],
5656
'hyperf/config-apollo' => [
57-
'version' => '~2.1.0',
57+
'version' => '~2.2.0',
5858
],
5959
'hyperf/config-aliyun-acm' => [
60-
'version' => '~2.1.0',
60+
'version' => '~2.2.0',
6161
],
6262
'hyperf/config-etcd' => [
63-
'version' => '~2.1.0',
63+
'version' => '~2.2.0',
6464
],
6565
'hyperf/tracer' => [
66-
'version' => '~2.1.0',
66+
'version' => '~2.2.0',
6767
],
6868
'hyperf/service-governance' => [
69-
'version' => '~2.1.0',
69+
'version' => '~2.2.0',
7070
],
7171
],
7272
'require-dev' => [
@@ -160,7 +160,7 @@
160160
'hyperf/config-apollo',
161161
],
162162
'resources' => [
163-
'resources/config_center/apollo.php' => 'config/autoload/apollo.php',
163+
'resources/config_center/config_apollo.php' => 'config/autoload/config_center.php',
164164
],
165165
],
166166
2 => [
@@ -169,7 +169,7 @@
169169
'hyperf/config-aliyun-acm',
170170
],
171171
'resources' => [
172-
'resources/config_center/aliyun_acm.php' => 'config/autoload/aliyun_acm.php',
172+
'resources/config_center/config_acm.php' => 'config/autoload/config_center.php',
173173
],
174174
],
175175
3 => [
@@ -179,7 +179,17 @@
179179
],
180180
'resources' => [
181181
'resources/config_center/etcd.php' => 'config/autoload/etcd.php',
182-
'resources/config_center/config_etcd.php' => 'config/autoload/config_etcd.php',
182+
'resources/config_center/config_etcd.php' => 'config/autoload/config_center.php',
183+
],
184+
],
185+
4 => [
186+
'name' => 'Nacos',
187+
'packages' => [
188+
'hyperf/config-nacos',
189+
],
190+
'resources' => [
191+
'resources/config_center/nacos.php' => 'config/autoload/nacos.php',
192+
'resources/config_center/config_nacos.php' => 'config/autoload/config_center.php',
183193
],
184194
],
185195
],

installer/resources/amqp/amqp.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,30 @@
1111
*/
1212
return [
1313
'default' => [
14-
'host' => 'localhost',
15-
'port' => 5672,
16-
'user' => 'guest',
17-
'password' => 'guest',
18-
'vhost' => '/',
14+
'host' => env('AMQP_HOST', 'localhost'),
15+
'port' => (int) env('AMQP_PORT', 5672),
16+
'user' => env('AMQP_USER', 'guest'),
17+
'password' => env('AMQP_PASSWORD', 'guest'),
18+
'vhost' => env('AMQP_VHOST', '/'),
19+
'concurrent' => [
20+
'limit' => 1,
21+
],
1922
'pool' => [
20-
'min_connections' => 1,
21-
'max_connections' => 10,
22-
'connect_timeout' => 10.0,
23-
'wait_timeout' => 3.0,
24-
'heartbeat' => -1,
23+
'connections' => 2,
2524
],
2625
'params' => [
2726
'insist' => false,
2827
'login_method' => 'AMQPLAIN',
2928
'login_response' => null,
3029
'locale' => 'en_US',
31-
'connection_timeout' => 3.0,
32-
'read_write_timeout' => 6.0,
30+
'connection_timeout' => 3,
31+
'read_write_timeout' => 6,
3332
'context' => null,
34-
'keepalive' => false,
33+
'keepalive' => true,
3534
'heartbeat' => 3,
35+
'channel_rpc_timeout' => 0.0,
36+
'close_on_destruct' => false,
37+
'max_idle_channels' => 10,
3638
],
3739
],
3840
];

installer/resources/async_queue/QueueHandleListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212
namespace App\Listener;
1313

14+
use Hyperf\AsyncQueue\AnnotationJob;
1415
use Hyperf\AsyncQueue\Event\AfterHandle;
1516
use Hyperf\AsyncQueue\Event\BeforeHandle;
1617
use Hyperf\AsyncQueue\Event\Event;
@@ -57,6 +58,9 @@ public function process(object $event)
5758
if ($event instanceof Event && $event->message->job()) {
5859
$job = $event->message->job();
5960
$jobClass = get_class($job);
61+
if ($job instanceof AnnotationJob) {
62+
$jobClass = sprintf('Job[%s@%s]', $job->class, $job->method);
63+
}
6064
$date = date('Y-m-d H:i:s');
6165

6266
switch (true) {

installer/resources/async_queue/async_queue.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@
1212
return [
1313
'default' => [
1414
'driver' => Hyperf\AsyncQueue\Driver\RedisDriver::class,
15-
'channel' => 'queue',
15+
'redis' => [
16+
'pool' => 'default',
17+
],
18+
'channel' => '{queue}',
1619
'timeout' => 2,
1720
'retry_seconds' => 5,
1821
'handle_timeout' => 10,
1922
'processes' => 1,
23+
'concurrent' => [
24+
'limit' => 10,
25+
],
2026
],
2127
];

installer/resources/config_center/aliyun_acm.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

installer/resources/config_center/apollo.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)