Skip to content

Commit 441bc09

Browse files
committed
WI-74923 [phpstorm-stubs] Add Proctitle extension stubs.
1 parent 4e84aba commit 441bc09

3 files changed

Lines changed: 45 additions & 0 deletions

File tree

PhpStormStubsMap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5399,7 +5399,9 @@ final class PhpStormStubsMap
53995399
'set_time_limit' => 'standard/standard_3.php',
54005400
'setcookie' => 'standard/standard_4.php',
54015401
'setlocale' => 'standard/standard_1.php',
5402+
'setproctitle' => 'proctitle/proctitle.php',
54025403
'setrawcookie' => 'standard/standard_4.php',
5404+
'setthreadtitle' => 'proctitle/proctitle.php',
54035405
'settype' => 'standard/standard_5.php',
54045406
'sha1' => 'standard/standard_0.php',
54055407
'sha1_file' => 'standard/standard_0.php',

proctitle/proctitle.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
// Start of proctitle v.0.1.2
4+
5+
/**
6+
* Changes the current process' title in the system's list of processes.
7+
*
8+
* Mainly useful together with {@see pcntl_fork()}, to tell forked workers apart in the process list.
9+
*
10+
* On systems that provide setproctitle(3) — the *BSD family — the native call is used. Everywhere
11+
* else the extension overwrites the process' own argv[0] in place, which caps the visible title at
12+
* 127 bytes; longer titles are truncated, shorter ones are padded with spaces.
13+
*
14+
* @link https://pecl.php.net/package/proctitle
15+
* @see cli_set_process_title() Bundled with PHP since 5.5 and the maintained alternative.
16+
*
17+
* @param string $title The new process title.
18+
*
19+
* @return void No value is returned; the function reports failure only by raising a warning.
20+
*
21+
* @since 0.1.0
22+
*/
23+
function setproctitle($title) {}
24+
25+
/**
26+
* Sets the name of the current thread.
27+
*
28+
* Implemented with prctl(PR_SET_NAME), so the function exists only in builds whose configure step
29+
* found a working prctl(2) — Linux in practice, not *BSD. The kernel stores at most 16 bytes
30+
* including the terminator, so names are truncated to 15 characters.
31+
*
32+
* @link https://pecl.php.net/package/proctitle
33+
*
34+
* @param string $title The new thread name.
35+
*
36+
* @return bool TRUE on success, FALSE when prctl() failed.
37+
*
38+
* @since 0.1.2
39+
*/
40+
function setthreadtitle($title) {}
41+
42+
// End of proctitle v.0.1.2

tests/Framework/DataProvider/StubCategory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ public function getDirectories(): array
222222
'Parle',
223223
'pcov',
224224
'pq',
225+
'proctitle',
225226
'ps',
226227
'pthreads',
227228
'radius',

0 commit comments

Comments
 (0)