Skip to content

Commit 434c148

Browse files
committed
ignore phpstan when phpstan claims that something is a resource, fixes #448, fixes #479, fixes #411
1 parent e8fb5b0 commit 434c148

File tree

16 files changed

+480
-473
lines changed

16 files changed

+480
-473
lines changed

generated/fileinfo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
/**
88
* This function closes the instance opened by finfo_open.
99
*
10-
* @param resource $finfo An finfo instance, returned by finfo_open.
10+
* @param finfo $finfo An finfo instance, returned by finfo_open.
1111
* @throws FileinfoException
1212
*
1313
*/
14-
function finfo_close($finfo): void
14+
function finfo_close(finfo $finfo): void
1515
{
1616
error_clear_last();
1717
$safeResult = \finfo_close($finfo);

generated/ftp.php

Lines changed: 48 additions & 48 deletions
Large diffs are not rendered by default.

generated/image.php

Lines changed: 122 additions & 122 deletions
Large diffs are not rendered by default.

generated/imap.php

Lines changed: 60 additions & 60 deletions
Large diffs are not rendered by default.

generated/ldap.php

Lines changed: 60 additions & 60 deletions
Large diffs are not rendered by default.

generated/openssl.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,12 +511,12 @@ function openssl_decrypt(string $data, string $cipher_algo, string $passphrase,
511511
* This is known as the Diffie-Hellman key exchange.
512512
*
513513
* @param string $public_key DH Public key of the remote party.
514-
* @param resource $private_key A local DH private key, corresponding to the public key to be shared with the remote party.
514+
* @param \OpenSSLAsymmetricKey $private_key A local DH private key, corresponding to the public key to be shared with the remote party.
515515
* @return string Returns shared secret on success.
516516
* @throws OpensslException
517517
*
518518
*/
519-
function openssl_dh_compute_key(string $public_key, $private_key): string
519+
function openssl_dh_compute_key(string $public_key, \OpenSSLAsymmetricKey $private_key): string
520520
{
521521
error_clear_last();
522522
$safeResult = \openssl_dh_compute_key($public_key, $private_key);
@@ -1687,7 +1687,7 @@ function openssl_spki_export(string $spki): ?string
16871687
/**
16881688
* Generates a signed public key and challenge using specified hashing algorithm
16891689
*
1690-
* @param resource $private_key private_key should be set to a private key that was
1690+
* @param \OpenSSLAsymmetricKey $private_key private_key should be set to a private key that was
16911691
* previously generated by openssl_pkey_new (or
16921692
* otherwise obtained from the other openssl_pkey family of functions).
16931693
* The corresponding public portion of the key will be used to sign the
@@ -1698,7 +1698,7 @@ function openssl_spki_export(string $spki): ?string
16981698
* @throws OpensslException
16991699
*
17001700
*/
1701-
function openssl_spki_new($private_key, string $challenge, int $digest_algo = OPENSSL_ALGO_MD5): ?string
1701+
function openssl_spki_new(\OpenSSLAsymmetricKey $private_key, string $challenge, int $digest_algo = OPENSSL_ALGO_MD5): ?string
17021702
{
17031703
error_clear_last();
17041704
$safeResult = \openssl_spki_new($private_key, $challenge, $digest_algo);

generated/pgsql.php

Lines changed: 64 additions & 64 deletions
Large diffs are not rendered by default.

generated/sem.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function msg_queue_exists(int $key): void
5454
* specified queue of the type specified by
5555
* desired_message_type.
5656
*
57-
* @param resource $queue The message queue.
57+
* @param \SysvMessageQueue $queue The message queue.
5858
* @param int $desired_message_type If desired_message_type is 0, the message from the front
5959
* of the queue is returned. If desired_message_type is
6060
* greater than 0, then the first message of that type is returned.
@@ -120,7 +120,7 @@ function msg_queue_exists(int $key): void
120120
* @throws SemException
121121
*
122122
*/
123-
function msg_receive($queue, int $desired_message_type, ?int &$received_message_type, int $max_message_size, &$message, bool $unserialize = true, int $flags = 0, ?int &$error_code = null): void
123+
function msg_receive(\SysvMessageQueue $queue, int $desired_message_type, ?int &$received_message_type, int $max_message_size, &$message, bool $unserialize = true, int $flags = 0, ?int &$error_code = null): void
124124
{
125125
error_clear_last();
126126
$safeResult = \msg_receive($queue, $desired_message_type, $received_message_type, $max_message_size, $message, $unserialize, $flags, $error_code);
@@ -136,11 +136,11 @@ function msg_receive($queue, int $desired_message_type, ?int &$received_message_
136136
* processes have finished working with the message queue and you need to
137137
* release the system resources held by it.
138138
*
139-
* @param resource $queue The message queue.
139+
* @param \SysvMessageQueue $queue The message queue.
140140
* @throws SemException
141141
*
142142
*/
143-
function msg_remove_queue($queue): void
143+
function msg_remove_queue(\SysvMessageQueue $queue): void
144144
{
145145
error_clear_last();
146146
$safeResult = \msg_remove_queue($queue);
@@ -155,7 +155,7 @@ function msg_remove_queue($queue): void
155155
* message_type (which MUST be greater than 0) to
156156
* the message queue specified by queue.
157157
*
158-
* @param resource $queue The message queue.
158+
* @param \SysvMessageQueue $queue The message queue.
159159
* @param int $message_type The type of the message (MUST be greater than 0)
160160
* @param mixed $message The body of the message.
161161
*
@@ -183,7 +183,7 @@ function msg_remove_queue($queue): void
183183
* @throws SemException
184184
*
185185
*/
186-
function msg_send($queue, int $message_type, $message, bool $serialize = true, bool $blocking = true, ?int &$error_code = null): void
186+
function msg_send(\SysvMessageQueue $queue, int $message_type, $message, bool $serialize = true, bool $blocking = true, ?int &$error_code = null): void
187187
{
188188
error_clear_last();
189189
$safeResult = \msg_send($queue, $message_type, $message, $serialize, $blocking, $error_code);
@@ -204,13 +204,13 @@ function msg_send($queue, int $message_type, $message, bool $serialize = true, b
204204
* root privileges are required to raise the msg_qbytes values above the
205205
* system defined limit.
206206
*
207-
* @param resource $queue The message queue.
207+
* @param \SysvMessageQueue $queue The message queue.
208208
* @param array $data You specify the values you require by setting the value of the keys
209209
* that you require in the data array.
210210
* @throws SemException
211211
*
212212
*/
213-
function msg_set_queue($queue, array $data): void
213+
function msg_set_queue(\SysvMessageQueue $queue, array $data): void
214214
{
215215
error_clear_last();
216216
$safeResult = \msg_set_queue($queue, $data);
@@ -226,7 +226,7 @@ function msg_set_queue($queue, array $data): void
226226
* This is useful, for example, to determine which process sent the message
227227
* that was just received.
228228
*
229-
* @param resource $queue The message queue.
229+
* @param \SysvMessageQueue $queue The message queue.
230230
* @return array On success, the return value is an array whose keys and values have the following
231231
* meanings:
232232
*
@@ -303,7 +303,7 @@ function msg_set_queue($queue, array $data): void
303303
* @throws SemException
304304
*
305305
*/
306-
function msg_stat_queue($queue): array
306+
function msg_stat_queue(\SysvMessageQueue $queue): array
307307
{
308308
error_clear_last();
309309
$safeResult = \msg_stat_queue($queue);
@@ -324,7 +324,7 @@ function msg_stat_queue($queue): array
324324
* explicitly released will be released automatically and a warning will be
325325
* generated.
326326
*
327-
* @param resource $semaphore semaphore is a semaphore
327+
* @param \SysvSemaphore $semaphore semaphore is a semaphore
328328
* obtained from sem_get.
329329
* @param bool $non_blocking Specifies if the process shouldn't wait for the semaphore to be acquired.
330330
* If set to TRUE, the call will return
@@ -333,7 +333,7 @@ function msg_stat_queue($queue): array
333333
* @throws SemException
334334
*
335335
*/
336-
function sem_acquire($semaphore, bool $non_blocking = false): void
336+
function sem_acquire(\SysvSemaphore $semaphore, bool $non_blocking = false): void
337337
{
338338
error_clear_last();
339339
$safeResult = \sem_acquire($semaphore, $non_blocking);
@@ -385,12 +385,12 @@ function sem_get(int $key, int $max_acquire = 1, int $permissions = 0666, bool $
385385
* After releasing the semaphore, sem_acquire
386386
* may be called to re-acquire it.
387387
*
388-
* @param resource $semaphore A Semaphore as returned by
388+
* @param \SysvSemaphore $semaphore A Semaphore as returned by
389389
* sem_get.
390390
* @throws SemException
391391
*
392392
*/
393-
function sem_release($semaphore): void
393+
function sem_release(\SysvSemaphore $semaphore): void
394394
{
395395
error_clear_last();
396396
$safeResult = \sem_release($semaphore);
@@ -405,12 +405,12 @@ function sem_release($semaphore): void
405405
*
406406
* After removing the semaphore, it is no longer accessible.
407407
*
408-
* @param resource $semaphore A semaphore as returned
408+
* @param \SysvSemaphore $semaphore A semaphore as returned
409409
* by sem_get.
410410
* @throws SemException
411411
*
412412
*/
413-
function sem_remove($semaphore): void
413+
function sem_remove(\SysvSemaphore $semaphore): void
414414
{
415415
error_clear_last();
416416
$safeResult = \sem_remove($semaphore);
@@ -465,11 +465,11 @@ function shm_attach(int $key, ?int $size = null, int $permissions = 0666)
465465
* shm_attach. Remember, that shared memory still exist
466466
* in the Unix system and the data is still present.
467467
*
468-
* @param resource $shm A shared memory segment obtained from shm_attach.
468+
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
469469
* @throws SemException
470470
*
471471
*/
472-
function shm_detach($shm): void
472+
function shm_detach(\SysvSharedMemory $shm): void
473473
{
474474
error_clear_last();
475475
$safeResult = \shm_detach($shm);
@@ -489,7 +489,7 @@ function shm_detach($shm): void
489489
* index or if there was not enough shared memory remaining to complete your
490490
* request.
491491
*
492-
* @param resource $shm A shared memory segment obtained from shm_attach.
492+
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
493493
* @param int $key The variable key.
494494
* @param mixed $value The variable. All variable types
495495
* that serialize supports may be used: generally
@@ -498,7 +498,7 @@ function shm_detach($shm): void
498498
* @throws SemException
499499
*
500500
*/
501-
function shm_put_var($shm, int $key, $value): void
501+
function shm_put_var(\SysvSharedMemory $shm, int $key, $value): void
502502
{
503503
error_clear_last();
504504
$safeResult = \shm_put_var($shm, $key, $value);
@@ -512,12 +512,12 @@ function shm_put_var($shm, int $key, $value): void
512512
* Removes a variable with a given key
513513
* and frees the occupied memory.
514514
*
515-
* @param resource $shm A shared memory segment obtained from shm_attach.
515+
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
516516
* @param int $key The variable key.
517517
* @throws SemException
518518
*
519519
*/
520-
function shm_remove_var($shm, int $key): void
520+
function shm_remove_var(\SysvSharedMemory $shm, int $key): void
521521
{
522522
error_clear_last();
523523
$safeResult = \shm_remove_var($shm, $key);
@@ -531,11 +531,11 @@ function shm_remove_var($shm, int $key): void
531531
* shm_remove removes the shared memory
532532
* shm. All data will be destroyed.
533533
*
534-
* @param resource $shm A shared memory segment obtained from shm_attach.
534+
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
535535
* @throws SemException
536536
*
537537
*/
538-
function shm_remove($shm): void
538+
function shm_remove(\SysvSharedMemory $shm): void
539539
{
540540
error_clear_last();
541541
$safeResult = \shm_remove($shm);

generated/shmop.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
/**
88
* shmop_delete is used to delete a shared memory block.
99
*
10-
* @param resource $shmop The shared memory block resource created by
10+
* @param \Shmop $shmop The shared memory block resource created by
1111
* shmop_open
1212
* @throws ShmopException
1313
*
1414
*/
15-
function shmop_delete($shmop): void
15+
function shmop_delete(\Shmop $shmop): void
1616
{
1717
error_clear_last();
1818
$safeResult = \shmop_delete($shmop);
@@ -25,7 +25,7 @@ function shmop_delete($shmop): void
2525
/**
2626
* shmop_read will read a string from shared memory block.
2727
*
28-
* @param resource $shmop The shared memory block identifier created by
28+
* @param \Shmop $shmop The shared memory block identifier created by
2929
* shmop_open
3030
* @param int $offset Offset from which to start reading; must be greater than or equal to zero
3131
* and less than or equal to the actual size of the shared memory segment.
@@ -37,7 +37,7 @@ function shmop_delete($shmop): void
3737
* @throws ShmopException
3838
*
3939
*/
40-
function shmop_read($shmop, int $offset, int $size): string
40+
function shmop_read(\Shmop $shmop, int $offset, int $size): string
4141
{
4242
error_clear_last();
4343
$safeResult = \shmop_read($shmop, $offset, $size);

0 commit comments

Comments
 (0)