Skip to content

ignore phpstan when phpstan claims that something is a resource, fixes #448, fixes #479, fixes #411 #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions generated/fileinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
/**
* This function closes the instance opened by finfo_open.
*
* @param resource $finfo An finfo instance, returned by finfo_open.
* @param finfo $finfo An finfo instance, returned by finfo_open.
* @throws FileinfoException
*
*/
function finfo_close($finfo): void
function finfo_close(finfo $finfo): void
{
error_clear_last();
$safeResult = \finfo_close($finfo);
Expand Down
96 changes: 48 additions & 48 deletions generated/ftp.php

Large diffs are not rendered by default.

244 changes: 122 additions & 122 deletions generated/image.php

Large diffs are not rendered by default.

120 changes: 60 additions & 60 deletions generated/imap.php

Large diffs are not rendered by default.

120 changes: 60 additions & 60 deletions generated/ldap.php

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions generated/openssl.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,12 @@ function openssl_decrypt(string $data, string $cipher_algo, string $passphrase,
* This is known as the Diffie-Hellman key exchange.
*
* @param string $public_key DH Public key of the remote party.
* @param resource $private_key A local DH private key, corresponding to the public key to be shared with the remote party.
* @param \OpenSSLAsymmetricKey $private_key A local DH private key, corresponding to the public key to be shared with the remote party.
* @return string Returns shared secret on success.
* @throws OpensslException
*
*/
function openssl_dh_compute_key(string $public_key, $private_key): string
function openssl_dh_compute_key(string $public_key, \OpenSSLAsymmetricKey $private_key): string
{
error_clear_last();
$safeResult = \openssl_dh_compute_key($public_key, $private_key);
Expand Down Expand Up @@ -1687,7 +1687,7 @@ function openssl_spki_export(string $spki): ?string
/**
* Generates a signed public key and challenge using specified hashing algorithm
*
* @param resource $private_key private_key should be set to a private key that was
* @param \OpenSSLAsymmetricKey $private_key private_key should be set to a private key that was
* previously generated by openssl_pkey_new (or
* otherwise obtained from the other openssl_pkey family of functions).
* The corresponding public portion of the key will be used to sign the
Expand All @@ -1698,7 +1698,7 @@ function openssl_spki_export(string $spki): ?string
* @throws OpensslException
*
*/
function openssl_spki_new($private_key, string $challenge, int $digest_algo = OPENSSL_ALGO_MD5): ?string
function openssl_spki_new(\OpenSSLAsymmetricKey $private_key, string $challenge, int $digest_algo = OPENSSL_ALGO_MD5): ?string
{
error_clear_last();
$safeResult = \openssl_spki_new($private_key, $challenge, $digest_algo);
Expand Down
128 changes: 64 additions & 64 deletions generated/pgsql.php

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions generated/sem.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function msg_queue_exists(int $key): void
* specified queue of the type specified by
* desired_message_type.
*
* @param resource $queue The message queue.
* @param \SysvMessageQueue $queue The message queue.
* @param int $desired_message_type If desired_message_type is 0, the message from the front
* of the queue is returned. If desired_message_type is
* greater than 0, then the first message of that type is returned.
Expand Down Expand Up @@ -120,7 +120,7 @@ function msg_queue_exists(int $key): void
* @throws SemException
*
*/
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
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
{
error_clear_last();
$safeResult = \msg_receive($queue, $desired_message_type, $received_message_type, $max_message_size, $message, $unserialize, $flags, $error_code);
Expand All @@ -136,11 +136,11 @@ function msg_receive($queue, int $desired_message_type, ?int &$received_message_
* processes have finished working with the message queue and you need to
* release the system resources held by it.
*
* @param resource $queue The message queue.
* @param \SysvMessageQueue $queue The message queue.
* @throws SemException
*
*/
function msg_remove_queue($queue): void
function msg_remove_queue(\SysvMessageQueue $queue): void
{
error_clear_last();
$safeResult = \msg_remove_queue($queue);
Expand All @@ -155,7 +155,7 @@ function msg_remove_queue($queue): void
* message_type (which MUST be greater than 0) to
* the message queue specified by queue.
*
* @param resource $queue The message queue.
* @param \SysvMessageQueue $queue The message queue.
* @param int $message_type The type of the message (MUST be greater than 0)
* @param mixed $message The body of the message.
*
Expand Down Expand Up @@ -183,7 +183,7 @@ function msg_remove_queue($queue): void
* @throws SemException
*
*/
function msg_send($queue, int $message_type, $message, bool $serialize = true, bool $blocking = true, ?int &$error_code = null): void
function msg_send(\SysvMessageQueue $queue, int $message_type, $message, bool $serialize = true, bool $blocking = true, ?int &$error_code = null): void
{
error_clear_last();
$safeResult = \msg_send($queue, $message_type, $message, $serialize, $blocking, $error_code);
Expand All @@ -204,13 +204,13 @@ function msg_send($queue, int $message_type, $message, bool $serialize = true, b
* root privileges are required to raise the msg_qbytes values above the
* system defined limit.
*
* @param resource $queue The message queue.
* @param \SysvMessageQueue $queue The message queue.
* @param array $data You specify the values you require by setting the value of the keys
* that you require in the data array.
* @throws SemException
*
*/
function msg_set_queue($queue, array $data): void
function msg_set_queue(\SysvMessageQueue $queue, array $data): void
{
error_clear_last();
$safeResult = \msg_set_queue($queue, $data);
Expand All @@ -226,7 +226,7 @@ function msg_set_queue($queue, array $data): void
* This is useful, for example, to determine which process sent the message
* that was just received.
*
* @param resource $queue The message queue.
* @param \SysvMessageQueue $queue The message queue.
* @return array On success, the return value is an array whose keys and values have the following
* meanings:
*
Expand Down Expand Up @@ -303,7 +303,7 @@ function msg_set_queue($queue, array $data): void
* @throws SemException
*
*/
function msg_stat_queue($queue): array
function msg_stat_queue(\SysvMessageQueue $queue): array
{
error_clear_last();
$safeResult = \msg_stat_queue($queue);
Expand All @@ -324,7 +324,7 @@ function msg_stat_queue($queue): array
* explicitly released will be released automatically and a warning will be
* generated.
*
* @param resource $semaphore semaphore is a semaphore
* @param \SysvSemaphore $semaphore semaphore is a semaphore
* obtained from sem_get.
* @param bool $non_blocking Specifies if the process shouldn't wait for the semaphore to be acquired.
* If set to TRUE, the call will return
Expand All @@ -333,7 +333,7 @@ function msg_stat_queue($queue): array
* @throws SemException
*
*/
function sem_acquire($semaphore, bool $non_blocking = false): void
function sem_acquire(\SysvSemaphore $semaphore, bool $non_blocking = false): void
{
error_clear_last();
$safeResult = \sem_acquire($semaphore, $non_blocking);
Expand Down Expand Up @@ -385,12 +385,12 @@ function sem_get(int $key, int $max_acquire = 1, int $permissions = 0666, bool $
* After releasing the semaphore, sem_acquire
* may be called to re-acquire it.
*
* @param resource $semaphore A Semaphore as returned by
* @param \SysvSemaphore $semaphore A Semaphore as returned by
* sem_get.
* @throws SemException
*
*/
function sem_release($semaphore): void
function sem_release(\SysvSemaphore $semaphore): void
{
error_clear_last();
$safeResult = \sem_release($semaphore);
Expand All @@ -405,12 +405,12 @@ function sem_release($semaphore): void
*
* After removing the semaphore, it is no longer accessible.
*
* @param resource $semaphore A semaphore as returned
* @param \SysvSemaphore $semaphore A semaphore as returned
* by sem_get.
* @throws SemException
*
*/
function sem_remove($semaphore): void
function sem_remove(\SysvSemaphore $semaphore): void
{
error_clear_last();
$safeResult = \sem_remove($semaphore);
Expand Down Expand Up @@ -465,11 +465,11 @@ function shm_attach(int $key, ?int $size = null, int $permissions = 0666)
* shm_attach. Remember, that shared memory still exist
* in the Unix system and the data is still present.
*
* @param resource $shm A shared memory segment obtained from shm_attach.
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
* @throws SemException
*
*/
function shm_detach($shm): void
function shm_detach(\SysvSharedMemory $shm): void
{
error_clear_last();
$safeResult = \shm_detach($shm);
Expand All @@ -489,7 +489,7 @@ function shm_detach($shm): void
* index or if there was not enough shared memory remaining to complete your
* request.
*
* @param resource $shm A shared memory segment obtained from shm_attach.
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
* @param int $key The variable key.
* @param mixed $value The variable. All variable types
* that serialize supports may be used: generally
Expand All @@ -498,7 +498,7 @@ function shm_detach($shm): void
* @throws SemException
*
*/
function shm_put_var($shm, int $key, $value): void
function shm_put_var(\SysvSharedMemory $shm, int $key, $value): void
{
error_clear_last();
$safeResult = \shm_put_var($shm, $key, $value);
Expand All @@ -512,12 +512,12 @@ function shm_put_var($shm, int $key, $value): void
* Removes a variable with a given key
* and frees the occupied memory.
*
* @param resource $shm A shared memory segment obtained from shm_attach.
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
* @param int $key The variable key.
* @throws SemException
*
*/
function shm_remove_var($shm, int $key): void
function shm_remove_var(\SysvSharedMemory $shm, int $key): void
{
error_clear_last();
$safeResult = \shm_remove_var($shm, $key);
Expand All @@ -531,11 +531,11 @@ function shm_remove_var($shm, int $key): void
* shm_remove removes the shared memory
* shm. All data will be destroyed.
*
* @param resource $shm A shared memory segment obtained from shm_attach.
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
* @throws SemException
*
*/
function shm_remove($shm): void
function shm_remove(\SysvSharedMemory $shm): void
{
error_clear_last();
$safeResult = \shm_remove($shm);
Expand Down
8 changes: 4 additions & 4 deletions generated/shmop.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
/**
* shmop_delete is used to delete a shared memory block.
*
* @param resource $shmop The shared memory block resource created by
* @param \Shmop $shmop The shared memory block resource created by
* shmop_open
* @throws ShmopException
*
*/
function shmop_delete($shmop): void
function shmop_delete(\Shmop $shmop): void
{
error_clear_last();
$safeResult = \shmop_delete($shmop);
Expand All @@ -25,7 +25,7 @@ function shmop_delete($shmop): void
/**
* shmop_read will read a string from shared memory block.
*
* @param resource $shmop The shared memory block identifier created by
* @param \Shmop $shmop The shared memory block identifier created by
* shmop_open
* @param int $offset Offset from which to start reading; must be greater than or equal to zero
* and less than or equal to the actual size of the shared memory segment.
Expand All @@ -37,7 +37,7 @@ function shmop_delete($shmop): void
* @throws ShmopException
*
*/
function shmop_read($shmop, int $offset, int $size): string
function shmop_read(\Shmop $shmop, int $offset, int $size): string
{
error_clear_last();
$safeResult = \shmop_read($shmop, $offset, $size);
Expand Down
Loading