Add test on pass by ref

This commit is contained in:
Maxim.Kolmakov 2020-11-18 17:22:48 +01:00
parent 1f4b93bdd0
commit c8cfd40341
5 changed files with 17 additions and 15 deletions

View File

@ -191,50 +191,50 @@ function openssl_get_publickey($public_key): bool
/**
* Generate a new signed public key and challenge
* @link https://php.net/manual/en/function.openssl-spki-new.php
* @param OpenSSLAsymmetricKey|resource &$private_key <p>
* @param OpenSSLAsymmetricKey|resource $private_key <p>
* <b>privkey</b> should be set to a private key that was
* previously generated by {@link https://php.net/en/manual/function.openssl-pkey-new.php 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
* CSR.
* </p>
* @param string &$challenge <p>The challenge associated to associate with the SPKAC</p>
* @param string $challenge <p>The challenge associated to associate with the SPKAC</p>
* @param int $digest_algo <p>The digest algorithm. See openssl_get_md_method().</p>
* @return string|false Returns a signed public key and challenge string or NULL on failure.
* @since 5.6
*/
function openssl_spki_new(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] &$private_key, string &$challenge, int $digest_algo = 0): string|false
function openssl_spki_new(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] $private_key, string $challenge, int $digest_algo = 0): string|false
{}
/**
* Verifies a signed public key and challenge
* @link https://php.net/manual/en/function.openssl-spki-verify.php
* @param string &$spki <p>Expects a valid signed public key and challenge</p>
* @param string $spki <p>Expects a valid signed public key and challenge</p>
* @return bool Returns a boolean on success or failure.
* @since 5.6
*/
function openssl_spki_verify(string &$spki): bool
function openssl_spki_verify(string $spki): bool
{}
/**
* Exports the challenge associated with a signed public key and challenge
* @link https://php.net/manual/en/function.openssl-spki-export-challenge.php
* @param string &$spki <p>Expects a valid signed public key and challenge</p>
* @param string $spki <p>Expects a valid signed public key and challenge</p>
* @return string|false Returns the associated challenge string or NULL on failure.
* @since 5.6
*/
function openssl_spki_export_challenge (string &$spki): string|false
function openssl_spki_export_challenge (string $spki): string|false
{}
/**
* Exports a valid PEM formatted public key signed public key and challenge
* @link https://php.net/manual/en/function.openssl-spki-export.php
* @param string &$spki <p>Expects a valid signed public key and challenge</p>
* @param string $spki <p>Expects a valid signed public key and challenge</p>
* @return string|false Returns the associated PEM formatted public key or NULL on failure.
* @since 5.6
*/
function openssl_spki_export (string &$spki ): string|false
function openssl_spki_export (string $spki ): string|false
{}
/**
* Parse an X.509 certificate and return a resource identifier for

View File

@ -550,14 +550,14 @@ function sodium_crypto_generichash_update(string &$state, string $message): bool
* Get the final hash
* BLAKE2b
* @link https://www.php.net/manual/en/function.sodium-crypto-generichash-final.php
* @param string $state
* @param string &$state
* @param int $length
* @return string
* @throws SodiumException
* @since 7.2
*/
function sodium_crypto_generichash_final(
string $state,
string &$state,
int $length = 32
): string {
unset($state, $length);

View File

@ -839,7 +839,7 @@ function array_search (mixed $needle, array $haystack, bool $strict): string|int
/**
* Import variables into the current symbol table from an array
* @link https://php.net/manual/en/function.extract.php
* @param array $array<p>
* @param array &$array<p>
* Note that prefix is only required if
* extract_type is EXTR_PREFIX_SAME,
* EXTR_PREFIX_ALL, EXTR_PREFIX_INVALID
@ -862,7 +862,7 @@ function array_search (mixed $needle, array $haystack, bool $strict): string|int
* @return int the number of variables successfully imported into the symbol
* table.
*/
function extract (array $array, int $flags, string $prefix): int
function extract (array &$array, int $flags, string $prefix): int
{}
/**

View File

@ -118,6 +118,8 @@ class StubsTest extends TestCase
" but stub function has signature $functionName(" . $this->printParameters($phpstormFunction->parameters) . ")");
self::assertEquals($parameter->type, current(array_filter($phpstormFunction->parameters,
fn(PHPParameter $stubParameter) => $stubParameter->name === $parameter->name))->type, "Type mismatch $functionName: \$$parameter->name ");
self::assertEquals($parameter->is_passed_by_ref, current(array_filter($phpstormFunction->parameters,
fn(PHPParameter $stubParameter) => $stubParameter->name === $parameter->name))->is_passed_by_ref, "Invalid pass by ref $functionName: \$$parameter->name ");
}
}
}

View File

@ -57,12 +57,12 @@ function xml_parser_create_ns (string $encoding, string $separator = ':') {}
* @param XmlParser|resource $parser <p>
* A reference to the XML parser to use inside the object.
* </p>
* @param object &$object <p>
* @param object $object <p>
* The object where to use the XML parser.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function xml_set_object (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, object &$object): bool
function xml_set_object (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, object $object): bool
{}
/**