Skip to content

Commit b1827ba

Browse files
authored
Merge branch refs/heads/1.8.x into 1.9.x
2 parents c96332e + 687753c commit b1827ba

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

resources/functionMap.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@
10601060
'componere\cast_by_ref' => ['Type', 'arg1'=>'', 'object'=>''],
10611061
'confirm_pdo_ibm_compiled' => [''],
10621062
'connection_aborted' => ['0|1'],
1063-
'connection_status' => ['int'],
1063+
'connection_status' => ['int-mask<CONNECTION_NORMAL|CONNECTION_ABORTED|CONNECTION_TIMEOUT>'],
10641064
'connection_timeout' => ['int'],
10651065
'constant' => ['mixed', 'const_name'=>'string'],
10661066
'convert_cyr_string' => ['string', 'str'=>'string', 'from'=>'string', 'to'=>'string'],
@@ -2998,7 +2998,7 @@
29982998
'forward_static_call' => ['mixed', 'function'=>'callable', '...parameters='=>'mixed'],
29992999
'forward_static_call_array' => ['mixed', 'function'=>'callable', 'parameters'=>'array<int,mixed>'],
30003000
'fpassthru' => ['0|positive-int|false', 'fp'=>'resource'],
3001-
'fpm_get_status' => ['array|false'],
3001+
'fpm_get_status' => ['array{pool: string, process-manager: \'dynamic\'|\'ondemand\'|\'static\', start-time: int<0, max>, start-since: int<0, max>, accepted-conn: int<0, max>, listen-queue: int<0, max>, max-listen-queue: int<0, max>, listen-queue-len: int<0, max>, idle-processes: int<0, max>, active-processes: int<1, max>, total-processes: int<1, max>, max-active-processes: int<1, max>, max-children-reached: 0|1, slow-requests: int<0, max>, procs: array<int, array{pid: int<2, max>, state: \'Idle\'|\'Running\', start-time: int<0, max>, start-since: int<0, max>, requests: int<0, max>, request-duration: int<0, max>, request-method: string, request-uri: string, query-string: string, request-length: int<0, max>, user: string, script: string, last-request-cpu: float, last-request-memory: int<0, max>}>}|false'],
30023002
'fprintf' => ['int', 'stream'=>'resource', 'format'=>'string', '...values='=>'string|int|float'],
30033003
'fputcsv' => ['0|positive-int|false', 'fp'=>'resource', 'fields'=>'array', 'delimiter='=>'string', 'enclosure='=>'string', 'escape_char='=>'string'],
30043004
'fputs' => ['0|positive-int|false', 'fp'=>'resource', 'str'=>'string', 'length='=>'0|positive-int'],

tests/PHPStan/Analyser/NodeScopeResolverTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,10 @@ public function dataFileAsserts(): iterable
10521052
yield from $this->gatherAssertTypes(__DIR__ . '/data/dnf.php');
10531053
}
10541054

1055+
if (PHP_VERSION_ID >= 70300) {
1056+
yield from $this->gatherAssertTypes(__DIR__ . '/data/fpm-get-status.php');
1057+
}
1058+
10551059
yield from $this->gatherAssertTypes(__DIR__ . '/data/array-offset-unset.php');
10561060

10571061
yield from $this->gatherAssertTypes(__DIR__ . '/data/assert-docblock.php');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace FpmGetStatus;
4+
5+
use function fpm_get_status;
6+
use function PHPStan\Testing\assertType;
7+
8+
$status = fpm_get_status();
9+
10+
assertType('array{pool: string, process-manager: \'dynamic\'|\'ondemand\'|\'static\', start-time: int<0, max>, start-since: int<0, max>, accepted-conn: int<0, max>, listen-queue: int<0, max>, max-listen-queue: int<0, max>, listen-queue-len: int<0, max>, idle-processes: int<0, max>, active-processes: int<1, max>, total-processes: int<1, max>, max-active-processes: int<1, max>, max-children-reached: 0|1, slow-requests: int<0, max>, procs: array<int, array{pid: int<2, max>, state: \'Idle\'|\'Running\', start-time: int<0, max>, start-since: int<0, max>, requests: int<0, max>, request-duration: int<0, max>, request-method: string, request-uri: string, query-string: string, request-length: int<0, max>, user: string, script: string, last-request-cpu: float, last-request-memory: int<0, max>}>}|false', $status);
11+
12+
if ($status !== false && isset($status['procs'][0])) {
13+
assertType('array{pid: int<2, max>, state: \'Idle\'|\'Running\', start-time: int<0, max>, start-since: int<0, max>, requests: int<0, max>, request-duration: int<0, max>, request-method: string, request-uri: string, query-string: string, request-length: int<0, max>, user: string, script: string, last-request-cpu: float, last-request-memory: int<0, max>}', $status['procs'][0]);
14+
15+
assertType('int<2, max>', $status['procs'][0]['pid']);
16+
}

0 commit comments

Comments
 (0)