Skip to content

Commit 1663a9f

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

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/**
4+
* @param-out string $tag
5+
*
6+
* @return string|false
7+
*/
8+
function openssl_encrypt(
9+
#[\SensitiveParameter] string $data,
10+
string $cipher_algo,
11+
#[\SensitiveParameter] string $passphrase,
12+
int $options = 0,
13+
string $iv = "",
14+
?string &$tag = null,
15+
string $aad = "",
16+
int $tag_length = 16
17+
) {}
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)