Skip to content

Commit 97d2750

Browse files
authored
Merge pull request #30 from php-service-bus/master
update amphp version to 2.6 & update dependencies
2 parents b362ee6 + bafab44 commit 97d2750

File tree

8 files changed

+20
-34
lines changed

8 files changed

+20
-34
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: composer install -ov
4242

4343
- name: Run phpstan/phpstan
44-
run: ./vendor/bin/phpstan analyse src --level 7
44+
run: ./vendor/bin/phpstan analyse src --level 9
4545

4646
phpunit:
4747
name: PHPUnit

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
],
2020
"require": {
2121
"php": ">=8.0",
22-
"amphp/amp": "v2.5.*",
22+
"amphp/amp": "v2.6.*",
2323
"amphp/socket": "v1.1.*",
2424
"phpinnacle/buffer": "v1.2.*"
2525
},
2626
"require-dev": {
2727
"phpunit/phpunit": "v9.5.*",
28-
"vimeo/psalm": "v4.3.*",
29-
"phpstan/phpstan": "v0.12.*"
28+
"vimeo/psalm": "v4.13.*",
29+
"phpstan/phpstan": "v1.2.*"
3030
},
3131
"prefer-stable": true,
3232
"autoload": {
@@ -41,7 +41,7 @@
4141
},
4242
"scripts": {
4343
"psalm": "./vendor/bin/psalm --config=psalm.xml",
44-
"phpstan": "./vendor/bin/phpstan analyse src --level 7",
44+
"phpstan": "./vendor/bin/phpstan analyse src --level 9",
4545
"tests": "./vendor/bin/phpunit --configuration phpunit.xml --verbose",
4646
"coverage": "./vendor/bin/phpunit --configuration phpunit.xml --coverage-html ./coverage --verbose"
4747
},

phpstan.neon

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
parameters:
2-
checkGenericClassInNonGenericObjectType: false
3-
checkMissingIterableValueType: false
4-
ignoreErrors:
5-
-
6-
message: '#Unable to resolve the template type#'
7-
path: %currentWorkingDirectory%/src
8-
-
9-
message: '#AbstractFrame given#'
10-
path: %currentWorkingDirectory%/src/Channel.php
11-
-
12-
message: '#AbstractFrame given#'
13-
path: %currentWorkingDirectory%/src/Client.php
2+
checkMissingIterableValueType: false
3+
checkGenericClassInNonGenericObjectType: false
4+
ignoreErrors:
5+
- '#Cannot cast mixed to int#'

psalm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
totallyTyped="true"
44
useDocblockTypes="true"
55
useDocblockPropertyTypes="true"
6-
allowPhpStormGenerics="true"
76
strictBinaryOperands="true"
87
findUnusedPsalmSuppress="true"
98
ignoreInternalFunctionFalseReturn="false"
@@ -21,5 +20,6 @@
2120

2221
<issueHandlers>
2322
<PropertyNotSetInConstructor errorLevel="suppress"/>
23+
<UnnecessaryVarAnnotation errorLevel="suppress"/>
2424
</issueHandlers>
2525
</psalm>

src/Channel.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,7 @@ public function doPublish
11081108
$buffer->appendUint8(206);
11091109

11101110
if (!empty($body)) {
1111+
/* @phpstan-ignore-next-line */
11111112
$chunks = \str_split($body, $this->properties->maxFrame());
11121113

11131114
if ($chunks !== false) {
@@ -1126,23 +1127,20 @@ public function doPublish
11261127
}
11271128

11281129
/**
1129-
* @template T
1130+
* @template T of Protocol\AbstractFrame
11301131
* @psalm-param class-string<T> $frame
11311132
* @psalm-return Promise<T>
1132-
*
1133-
* @return Promise<Protocol\AbstractFrame>
11341133
*/
11351134
private function await(string $frame): Promise
11361135
{
11371136
/** @psalm-var Deferred<T> $deferred */
11381137
$deferred = new Deferred;
11391138

1140-
/** @psalm-var class-string<Protocol\AbstractFrame> $frame */
1141-
11421139
$this->connection->subscribe(
11431140
$this->id,
11441141
$frame,
11451142
static function (Protocol\AbstractFrame $frame) use ($deferred) {
1143+
/** @psalm-var T $frame */
11461144
$deferred->resolve($frame);
11471145

11481146
return true;

src/Client.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ function () use ($code, $reason) {
158158
if ($code === 0) {
159159
$promises = [];
160160

161-
foreach ($this->channels as $id => $channel) {
161+
foreach ($this->channels as $channel) {
162162
$promises[] = $channel->close($code, $reason);
163163
}
164164

@@ -400,7 +400,7 @@ private function findChannelId(): int
400400
}
401401

402402
/**
403-
* @template T
403+
* @template T of Protocol\AbstractFrame
404404
* @psalm-param class-string<T> $frame
405405
* @psalm-return Promise<T>
406406
*/
@@ -409,12 +409,11 @@ private function await(string $frame, int $channel = 0): Promise
409409
/** @psalm-var Deferred<T> $deferred */
410410
$deferred = new Deferred;
411411

412-
/** @psalm-var class-string<Protocol\AbstractFrame> $frame */
413-
414412
$this->connection->subscribe(
415413
$channel,
416414
$frame,
417415
static function (Protocol\AbstractFrame $frame) use ($deferred) {
416+
/** @psalm-var T $frame */
418417
$deferred->resolve($frame);
419418

420419
return true;

src/Connection.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,9 @@ function () {
137137
$this->parser->append($chunk);
138138

139139
while ($frame = $this->parser->parse()) {
140-
/** @var AbstractFrame $frame */
141-
142140
$class = \get_class($frame);
143141

144142
/**
145-
* @psalm-var int $i
146143
* @psalm-var callable(AbstractFrame):Promise<bool> $callback
147144
*/
148145
foreach ($this->callbacks[(int)$frame->channel][$class] ?? [] as $i => $callback) {

src/Properties.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ public function __construct(string $platform, string $product, string $version,
7171

7272
/**
7373
* @psalm-param array{
74-
* platform: string,
75-
* product: string,
76-
* version: string,
77-
* capabilities: array<string, bool>
74+
* platform: string|null,
75+
* product: string|null,
76+
* version: string|null,
77+
* capabilities: array<string, bool>|null
7878
* } $config
7979
*/
8080
public static function create(array $config): self

0 commit comments

Comments
 (0)