Skip to content

Commit a771e36

Browse files
FIX: Fix openssl_pkey_get_private function
1 parent ebd255a commit a771e36

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

generated/openssl.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ function openssl_pkey_export($key, ?string &$output, ?string $passphrase = null,
972972
* openssl_pkey_get_private parses
973973
* private_key and prepares it for use by other functions.
974974
*
975-
* @param string $private_key private_key can be one of the following:
975+
* @param \OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $private_key private_key can be one of the following:
976976
*
977977
* a string having the format
978978
* file://path/to/file.pem. The named file must
@@ -981,13 +981,13 @@ function openssl_pkey_export($key, ?string &$output, ?string $passphrase = null,
981981
*
982982
* A PEM formatted private key.
983983
*
984-
* @param string $passphrase The optional parameter passphrase must be used
984+
* @param string|null $passphrase The optional parameter passphrase must be used
985985
* if the specified key is encrypted (protected by a passphrase).
986-
* @return resource Returns an OpenSSLAsymmetricKey instance on success.
986+
* @return \OpenSSLAsymmetricKey Returns an OpenSSLAsymmetricKey instance on success.
987987
* @throws OpensslException
988988
*
989989
*/
990-
function openssl_pkey_get_private(string $private_key, string $passphrase = null)
990+
function openssl_pkey_get_private($private_key, ?string $passphrase = null): \OpenSSLAsymmetricKey
991991
{
992992
error_clear_last();
993993
if ($passphrase !== null) {

generator/config/CustomPhpStanFunctionMap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
'curl_share_errno' => ['int', 'share_handle' => 'CurlShareHandle'],
2727
'curl_share_setopt' => ['void', 'share_handle' => 'CurlShareHandle', 'option' => 'int', 'value' => 'mixed'],
2828
'curl_unescape' => ['string', 'handle' => 'CurlHandle', 'string' => 'string'],
29+
// theses replace ressource by OpenSSLAsymmetricKey
30+
'openssl_pkey_get_private' => ['OpenSSLAsymmetricKey|false', 'private_key'=>'OpenSSLAsymmetricKey|OpenSSLCertificate|array|string', 'passphrase='=>'null|string'],
2931
// theses replace ressource by OpenSSLCertificate
3032
'openssl_verify' => ['-1|0|1|false', 'data'=>'string', 'signature'=>'string', 'pub_key_id'=>' OpenSSLAsymmetricKey|OpenSSLCertificate|string', 'signature_alg='=>'int|string'],
3133
'openssl_x509_read' => ['OpenSSLCertificate|false', 'x509certdata'=>'OpenSSLCertificate|string'], // this replaces ressource by OpenSSLCertificate

0 commit comments

Comments
 (0)