Skip to content

Commit 3744c45

Browse files
committed
Add stub for $tag of openssl_encrypt()
1 parent b5fc9ec commit 3744c45

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

conf/config.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ parameters:
201201
- ../stubs/arrayFunctions.stub
202202
- ../stubs/core.stub
203203
- ../stubs/typeCheckingFunctions.stub
204+
- ../stubs/openssl.stub
204205
earlyTerminatingMethodCalls: []
205206
earlyTerminatingFunctionCalls: []
206207
memoryLimitFile: %tmpDir%/.memory_limit

stubs/openssl.stub

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
/**
4+
* @param-out string $tag
5+
*/
6+
function openssl_encrypt(
7+
#[\SensitiveParameter] string $data,
8+
string $cipher_algo,
9+
#[\SensitiveParameter] string $passphrase,
10+
int $options = 0,
11+
string $iv = "",
12+
string &$tag = null,
13+
string $aad = "",
14+
int $tag_length = 16
15+
): string|false {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
use function PHPStan\Testing\assertType;
4+
5+
$ciphertext = openssl_encrypt('plain text', 'aes-256-gcm', 'key', OPENSSL_RAW_DATA, 'iv', $tag, '', 16);
6+
7+
assertType('string|false', $ciphertext);
8+
assertType('string', $tag);

0 commit comments

Comments
 (0)