2nd round of comments

This commit is contained in:
Jack Worman 2022-06-23 19:44:04 -05:00
parent beafe2a8a1
commit 86ef8ef262
32 changed files with 127 additions and 144 deletions

View File

@ -14194,12 +14194,16 @@
<code>self::minHelper($nums)</code> <code>self::minHelper($nums)</code>
<code>self::randomRangeHelper($min, $max)</code> <code>self::randomRangeHelper($min, $max)</code>
</LessSpecificReturnStatement> </LessSpecificReturnStatement>
<MixedArgument occurrences="1">
<code>$digit / 2 ** (2 * $step)</code>
</MixedArgument>
<MixedAssignment occurrences="3"> <MixedAssignment occurrences="3">
<code>$digit</code> <code>$digit</code>
<code>$digit</code> <code>$digit</code>
<code>$vals[]</code> <code>$vals[]</code>
</MixedAssignment> </MixedAssignment>
<MixedOperand occurrences="2"> <MixedOperand occurrences="3">
<code>$digit</code>
<code>$digit</code> <code>$digit</code>
<code>$digit</code> <code>$digit</code>
</MixedOperand> </MixedOperand>
@ -14398,37 +14402,21 @@
<InvalidFalsableReturnType occurrences="1"> <InvalidFalsableReturnType occurrences="1">
<code>string</code> <code>string</code>
</InvalidFalsableReturnType> </InvalidFalsableReturnType>
<MissingParamType occurrences="11"> <MissingParamType occurrences="4">
<code>$instanceID</code>
<code>$instanceID</code> <code>$instanceID</code>
<code>$instanceID</code> <code>$instanceID</code>
<code>$num</code> <code>$num</code>
<code>$x</code>
<code>$x</code>
<code>$x</code>
<code>$y</code>
<code>$y</code>
<code>$y</code>
<code>$z</code> <code>$z</code>
</MissingParamType> </MissingParamType>
<MixedArgument occurrences="9"> <MixedArgument occurrences="2">
<code>$num</code> <code>$num</code>
<code>$r</code>
<code>$r</code>
<code>$x</code>
<code>$x</code>
<code>$y</code>
<code>$y</code>
<code>$y</code>
<code>$z</code> <code>$z</code>
</MixedArgument> </MixedArgument>
<MixedArrayOffset occurrences="3"> <MixedArrayOffset occurrences="2">
<code>static::$modulo[$instanceID]</code>
<code>static::$reduce[$instanceID]</code> <code>static::$reduce[$instanceID]</code>
<code>static::$reduce[$instanceID]</code> <code>static::$reduce[$instanceID]</code>
</MixedArrayOffset> </MixedArrayOffset>
<MixedAssignment occurrences="22"> <MixedAssignment occurrences="21">
<code>$r</code>
<code>$this-&gt;instanceID</code> <code>$this-&gt;instanceID</code>
<code>$this-&gt;value</code> <code>$this-&gt;value</code>
<code>$x</code> <code>$x</code>
@ -14541,9 +14529,6 @@
</UndefinedThisPropertyAssignment> </UndefinedThisPropertyAssignment>
</file> </file>
<file src="../phpseclib/Math/PrimeField/Integer.php"> <file src="../phpseclib/Math/PrimeField/Integer.php">
<MissingParamType occurrences="1">
<code>$instanceID</code>
</MissingParamType>
<MixedArgument occurrences="6"> <MixedArgument occurrences="6">
<code>$length</code> <code>$length</code>
<code>$one</code> <code>$one</code>
@ -14552,10 +14537,6 @@
<code>static::$zero[static::class]</code> <code>static::$zero[static::class]</code>
<code>static::$zero[static::class]</code> <code>static::$zero[static::class]</code>
</MixedArgument> </MixedArgument>
<MixedArrayOffset occurrences="2">
<code>static::$modulo[$instanceID]</code>
<code>static::$reduce[$instanceID]</code>
</MixedArrayOffset>
<MixedAssignment occurrences="1"> <MixedAssignment occurrences="1">
<code>$this-&gt;value</code> <code>$this-&gt;value</code>
</MixedAssignment> </MixedAssignment>
@ -14599,6 +14580,9 @@
<code>false</code> <code>false</code>
<code>false</code> <code>false</code>
</FalsableReturnStatement> </FalsableReturnStatement>
<InvalidArgument occurrences="1">
<code>[&amp;$this, 'comparator']</code>
</InvalidArgument>
<InvalidFalsableReturnType occurrences="3"> <InvalidFalsableReturnType occurrences="3">
<code>array</code> <code>array</code>
<code>array|string</code> <code>array|string</code>
@ -14796,11 +14780,11 @@
<code>$value</code> <code>$value</code>
</MixedAssignment> </MixedAssignment>
<MixedInferredReturnType occurrences="8"> <MixedInferredReturnType occurrences="8">
<code>?int</code>
<code>array</code> <code>array</code>
<code>array|false</code> <code>array|false</code>
<code>array|false</code> <code>array|false</code>
<code>bool</code> <code>bool</code>
<code>int</code>
<code>string</code> <code>string</code>
<code>string</code> <code>string</code>
<code>string|bool</code> <code>string|bool</code>
@ -15024,12 +15008,14 @@
<UnevaluatedCode occurrences="1"> <UnevaluatedCode occurrences="1">
<code>break;</code> <code>break;</code>
</UnevaluatedCode> </UnevaluatedCode>
<UnusedMethod occurrences="1">
<code>comparator</code>
</UnusedMethod>
<UnusedParam occurrences="1"> <UnusedParam occurrences="1">
<code>$key</code> <code>$key</code>
</UnusedParam> </UnusedParam>
<UnusedReturnValue occurrences="2"> <UnusedReturnValue occurrences="1">
<code>bool</code> <code>bool</code>
<code>int</code>
</UnusedReturnValue> </UnusedReturnValue>
<UnusedVariable occurrences="13"> <UnusedVariable occurrences="13">
<code>$attrib_bits</code> <code>$attrib_bits</code>

View File

@ -62,7 +62,7 @@ class AES extends Rijndael
* Since \phpseclib3\Crypt\AES extends \phpseclib3\Crypt\Rijndael, this function is, technically, available, but it doesn't do anything. * Since \phpseclib3\Crypt\AES extends \phpseclib3\Crypt\Rijndael, this function is, technically, available, but it doesn't do anything.
* *
* @throws \BadMethodCallException anytime it's called * @throws \BadMethodCallException anytime it's called
*@see \phpseclib3\Crypt\Rijndael::setBlockLength() * @see \phpseclib3\Crypt\Rijndael::setBlockLength()
*/ */
public function setBlockLength(int $length): void public function setBlockLength(int $length): void
{ {
@ -75,7 +75,7 @@ class AES extends Rijndael
* Valid key lengths are 128, 192, and 256. Set the link to bool(false) to disable a fixed key length * Valid key lengths are 128, 192, and 256. Set the link to bool(false) to disable a fixed key length
* *
* @throws \LengthException if the key length isn't supported * @throws \LengthException if the key length isn't supported
*@see \phpseclib3\Crypt\Rijndael:setKeyLength() * @see \phpseclib3\Crypt\Rijndael:setKeyLength()
*/ */
public function setKeyLength(int $length): void public function setKeyLength(int $length): void
{ {

View File

@ -307,7 +307,7 @@ class Blowfish extends BlockCipher
* *
* This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * @see \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
*/ */
protected function isValidEngineHelper(int $engine): bool protected function isValidEngineHelper(int $engine): bool
{ {

View File

@ -37,7 +37,7 @@ class ChaCha20 extends Salsa20
* *
* This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
protected function isValidEngineHelper(int $engine): bool protected function isValidEngineHelper(int $engine): bool
{ {
@ -74,7 +74,7 @@ class ChaCha20 extends Salsa20
* Encrypts a message. * Encrypts a message.
* *
* @return string $ciphertext * @return string $ciphertext
*@see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
* @see self::crypt() * @see self::crypt()
*/ */
public function encrypt(string $plaintext): string public function encrypt(string $plaintext): string
@ -95,7 +95,7 @@ class ChaCha20 extends Salsa20
* At least if the continuous buffer is disabled. * At least if the continuous buffer is disabled.
* *
* @return string $plaintext * @return string $plaintext
*@see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see self::crypt() * @see self::crypt()
*/ */
public function decrypt(string $ciphertext): string public function decrypt(string $ciphertext): string
@ -113,7 +113,7 @@ class ChaCha20 extends Salsa20
* Encrypts a message with libsodium * Encrypts a message with libsodium
* *
* @return string $text * @return string $text
*@see self::encrypt() * @see self::encrypt()
*/ */
private function encrypt_with_libsodium(string $plaintext): string private function encrypt_with_libsodium(string $plaintext): string
{ {
@ -138,7 +138,7 @@ class ChaCha20 extends Salsa20
* Decrypts a message with libsodium * Decrypts a message with libsodium
* *
* @return string $text * @return string $text
*@see self::decrypt() * @see self::decrypt()
*/ */
private function decrypt_with_libsodium(string $ciphertext): string private function decrypt_with_libsodium(string $ciphertext): string
{ {

View File

@ -356,7 +356,7 @@ abstract class AsymmetricKey
* The plugin needs to either already be loaded or be auto-loadable. * The plugin needs to either already be loaded or be auto-loadable.
* Loading a plugin whose shortname overwrite an existing shortname will overwrite the old plugin. * Loading a plugin whose shortname overwrite an existing shortname will overwrite the old plugin.
* *
*@see self::load() * @see self::load()
*/ */
public static function addFileFormat(string $fullname): void public static function addFileFormat(string $fullname): void
{ {

View File

@ -122,7 +122,7 @@ abstract class PKCS8 extends PKCS
/** /**
* Returns a SymmetricKey object based on a PBES1 $algo * Returns a SymmetricKey object based on a PBES1 $algo
* *
*@return \phpseclib3\Crypt\Common\SymmetricKey * @return \phpseclib3\Crypt\Common\SymmetricKey
*/ */
private static function getPBES1EncryptionObject(string $algo) private static function getPBES1EncryptionObject(string $algo)
{ {

View File

@ -841,7 +841,7 @@ abstract class SymmetricKey
* {@internal Could, but not must, extend by the child Crypt_* class} * {@internal Could, but not must, extend by the child Crypt_* class}
* *
* @param string[] ...$func_args * @param string[] ...$func_args
*@throws \LengthException if pbkdf1 is being used and the derived key length exceeds the hash length * @throws \LengthException if pbkdf1 is being used and the derived key length exceeds the hash length
* @see Crypt/Hash.php * @see Crypt/Hash.php
*/ */
public function setPassword(string $password, string $method = 'pbkdf2', ...$func_args): bool public function setPassword(string $password, string $method = 'pbkdf2', ...$func_args): bool
@ -982,7 +982,7 @@ abstract class SymmetricKey
* {@link https://tools.ietf.org/html/rfc7292#appendix-B} * {@link https://tools.ietf.org/html/rfc7292#appendix-B}
* *
* @return string $a * @return string $a
*@see self::setPassword() * @see self::setPassword()
*/ */
private static function pkcs12helper(int $n, Hash $hashObj, string $i, string $d, int $count): string private static function pkcs12helper(int $n, Hash $hashObj, string $i, string $d, int $count): string
{ {
@ -1039,7 +1039,7 @@ abstract class SymmetricKey
* {@internal Could, but not must, extend by the child Crypt_* class} * {@internal Could, but not must, extend by the child Crypt_* class}
* *
* @return string $ciphertext * @return string $ciphertext
*@see self::decrypt() * @see self::decrypt()
*/ */
public function encrypt(string $plaintext): string public function encrypt(string $plaintext): string
{ {
@ -1418,7 +1418,7 @@ abstract class SymmetricKey
* *
* @return string $plaintext * @return string $plaintext
* @throws \LengthException if we're inside a block cipher and the ciphertext length is not a multiple of the block size * @throws \LengthException if we're inside a block cipher and the ciphertext length is not a multiple of the block size
*@see self::encrypt() * @see self::encrypt()
*/ */
public function decrypt(string $ciphertext): string public function decrypt(string $ciphertext): string
{ {
@ -1787,7 +1787,7 @@ abstract class SymmetricKey
* @return string * @return string
* @throws \LengthException if $length isn't of a sufficient length * @throws \LengthException if $length isn't of a sufficient length
* @throws \RuntimeException if GCM mode isn't being used * @throws \RuntimeException if GCM mode isn't being used
*@see self::encrypt() * @see self::encrypt()
*/ */
public function getTag(int $length = 16) public function getTag(int $length = 16)
{ {
@ -1820,7 +1820,7 @@ abstract class SymmetricKey
* *
* @throws \LengthException if $length isn't of a sufficient length * @throws \LengthException if $length isn't of a sufficient length
* @throws \RuntimeException if GCM mode isn't being used * @throws \RuntimeException if GCM mode isn't being used
*@see self::decrypt() * @see self::decrypt()
*/ */
public function setTag(string $tag): void public function setTag(string $tag): void
{ {
@ -1844,7 +1844,7 @@ abstract class SymmetricKey
* *
* mcrypt requires an IV even if ECB is used * mcrypt requires an IV even if ECB is used
* *
*@see self::encrypt() * @see self::encrypt()
* @see self::decrypt() * @see self::decrypt()
*/ */
protected function getIV(string $iv): string protected function getIV(string $iv): string
@ -1860,7 +1860,7 @@ abstract class SymmetricKey
* and SymmetricKey::decrypt(). Also, OpenSSL doesn't implement CTR for all of it's symmetric ciphers so this * and SymmetricKey::decrypt(). Also, OpenSSL doesn't implement CTR for all of it's symmetric ciphers so this
* function will emulate CTR with ECB when necessary. * function will emulate CTR with ECB when necessary.
* *
*@see self::encrypt() * @see self::encrypt()
* @see self::decrypt() * @see self::decrypt()
*/ */
private function openssl_ctr_process(string $plaintext, string &$encryptIV, array &$buffer): string private function openssl_ctr_process(string $plaintext, string &$encryptIV, array &$buffer): string
@ -1943,7 +1943,7 @@ abstract class SymmetricKey
* for OFB is the same for both encrypting and decrypting this function is re-used by both SymmetricKey::encrypt() * for OFB is the same for both encrypting and decrypting this function is re-used by both SymmetricKey::encrypt()
* and SymmetricKey::decrypt(). * and SymmetricKey::decrypt().
* *
*@see self::encrypt() * @see self::encrypt()
* @see self::decrypt() * @see self::decrypt()
*/ */
private function openssl_ofb_process(string $plaintext, string &$encryptIV, array &$buffer): string private function openssl_ofb_process(string $plaintext, string &$encryptIV, array &$buffer): string
@ -2117,7 +2117,7 @@ abstract class SymmetricKey
/** /**
* Test for engine validity * Test for engine validity
* *
*@see self::__construct() * @see self::__construct()
*/ */
protected function isValidEngineHelper(int $engine): bool protected function isValidEngineHelper(int $engine): bool
{ {
@ -2164,7 +2164,7 @@ abstract class SymmetricKey
/** /**
* Test for engine validity * Test for engine validity
* *
*@see self::__construct() * @see self::__construct()
*/ */
public function isValidEngine(string $engine): bool public function isValidEngine(string $engine): bool
{ {
@ -2198,7 +2198,7 @@ abstract class SymmetricKey
* *
* If the preferred crypt engine is not available the fastest available one will be used * If the preferred crypt engine is not available the fastest available one will be used
* *
*@see self::__construct() * @see self::__construct()
*/ */
public function setPreferredEngine(string $engine): void public function setPreferredEngine(string $engine): void
{ {
@ -2424,7 +2424,7 @@ abstract class SymmetricKey
* If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless * If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless
* and padding will, hence forth, be enabled. * and padding will, hence forth, be enabled.
* *
*@throws \LengthException if padding is disabled and the plaintext's length is not a multiple of the block size * @throws \LengthException if padding is disabled and the plaintext's length is not a multiple of the block size
* @see self::unpad() * @see self::unpad()
*/ */
protected function pad(string $text): string protected function pad(string $text): string
@ -2450,7 +2450,7 @@ abstract class SymmetricKey
* If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong * If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong
* and false will be returned. * and false will be returned.
* *
*@throws \LengthException if the ciphertext's length is not a multiple of the block size * @throws \LengthException if the ciphertext's length is not a multiple of the block size
* @see self::pad() * @see self::pad()
*/ */
protected function unpad(string $text): string protected function unpad(string $text): string
@ -2632,7 +2632,7 @@ abstract class SymmetricKey
* </code> * </code>
* *
* @return string (the name of the created callback function) * @return string (the name of the created callback function)
*@see self::decrypt() * @see self::decrypt()
* @see self::setupInlineCrypt() * @see self::setupInlineCrypt()
* @see self::encrypt() * @see self::encrypt()
*/ */
@ -3146,7 +3146,7 @@ abstract class SymmetricKey
* See https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf#page=20 * See https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf#page=20
* for more info * for more info
* *
*@see self::decrypt() * @see self::decrypt()
* @see self::encrypt() * @see self::encrypt()
*/ */
private function ghash(string $x): string private function ghash(string $x): string
@ -3177,7 +3177,7 @@ abstract class SymmetricKey
/** /**
* Returns the bit length of a string in a packed format * Returns the bit length of a string in a packed format
* *
*@see self::setupGCM() * @see self::setupGCM()
* @see self::decrypt() * @see self::decrypt()
* @see self::encrypt() * @see self::encrypt()
*/ */
@ -3189,7 +3189,7 @@ abstract class SymmetricKey
/** /**
* NULL pads a string to be a multiple of 128 * NULL pads a string to be a multiple of 128
* *
*@see self::setupGCM() * @see self::setupGCM()
* @see self::decrypt() * @see self::decrypt()
* @see self::encrypt() * @see self::encrypt()
*/ */

View File

@ -579,7 +579,7 @@ class DES extends BlockCipher
* *
* This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * @see \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
*/ */
protected function isValidEngineHelper(int $engine): bool protected function isValidEngineHelper(int $engine): bool
{ {
@ -600,7 +600,7 @@ class DES extends BlockCipher
* *
* DES also requires that every eighth bit be a parity bit, however, we'll ignore that. * DES also requires that every eighth bit be a parity bit, however, we'll ignore that.
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::setKey() * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey()
*/ */
public function setKey(string $key): void public function setKey(string $key): void
{ {
@ -615,7 +615,7 @@ class DES extends BlockCipher
/** /**
* Encrypts a block * Encrypts a block
* *
*@see self::encrypt() * @see self::encrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock() * @see \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock()
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
*/ */
@ -627,7 +627,7 @@ class DES extends BlockCipher
/** /**
* Decrypts a block * Decrypts a block
* *
*@see self::decrypt() * @see self::decrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock() * @see \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
@ -644,7 +644,7 @@ class DES extends BlockCipher
* idea of what this function does. * idea of what this function does.
* *
* @return string * @return string
*@see self::decryptBlock() * @see self::decryptBlock()
* @see self::encryptBlock() * @see self::encryptBlock()
*/ */
private function processBlock(string $block, int $mode) private function processBlock(string $block, int $mode)

View File

@ -322,7 +322,7 @@ abstract class DH extends AsymmetricKey
/** /**
* OnLoad Handler * OnLoad Handler
* *
*@return bool * @return bool
*/ */
protected static function onLoad(array $components) protected static function onLoad(array $components)
{ {

View File

@ -213,7 +213,7 @@ abstract class DSA extends AsymmetricKey
/** /**
* OnLoad Handler * OnLoad Handler
* *
*@return bool * @return bool
*/ */
protected static function onLoad(array $components) protected static function onLoad(array $components)
{ {

View File

@ -197,7 +197,7 @@ abstract class EC extends AsymmetricKey
/** /**
* OnLoad Handler * OnLoad Handler
* *
*@return bool * @return bool
*/ */
protected static function onLoad(array $components) protected static function onLoad(array $components)
{ {
@ -338,7 +338,7 @@ abstract class EC extends AsymmetricKey
* Returns the parameters * Returns the parameters
* *
* @param string $type optional * @param string $type optional
*@see self::getPublicKey() * @see self::getPublicKey()
*/ */
public function getParameters(string $type = 'PKCS1') public function getParameters(string $type = 'PKCS1')
{ {
@ -382,7 +382,7 @@ abstract class EC extends AsymmetricKey
* Used by Ed25519 / Ed448. * Used by Ed25519 / Ed448.
* *
* @param string|null $context optional * @param string|null $context optional
*@see self::verify() * @see self::verify()
* @see self::sign() * @see self::sign()
*/ */
public function withContext(string $context = null): EC public function withContext(string $context = null): EC

View File

@ -335,7 +335,7 @@ trait Common
* @param bool $returnArray optional * @param bool $returnArray optional
* @param array $options optional * @param array $options optional
* @return string|false * @return string|false
*@todo Maybe at some point this could be moved to __toString() for each of the curves? * @todo Maybe at some point this could be moved to __toString() for each of the curves?
*/ */
private static function encodeParameters(BaseCurve $curve, bool $returnArray = false, array $options = []) private static function encodeParameters(BaseCurve $curve, bool $returnArray = false, array $options = [])
{ {

View File

@ -269,7 +269,7 @@ class RC2 extends BlockCipher
* *
* This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
protected function isValidEngineHelper(int $engine): bool protected function isValidEngineHelper(int $engine): bool
{ {
@ -322,7 +322,7 @@ class RC2 extends BlockCipher
* it is empty. * it is empty.
* *
* @throws \LengthException if the key length isn't supported * @throws \LengthException if the key length isn't supported
*@see \phpseclib3\Crypt\Common\SymmetricKey::setKey() * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey()
*/ */
public function setKey(string $key, ?int $t1 = null): void public function setKey(string $key, ?int $t1 = null): void
{ {
@ -381,7 +381,7 @@ class RC2 extends BlockCipher
* Mostly a wrapper for \phpseclib3\Crypt\Common\SymmetricKey::encrypt, with some additional OpenSSL handling code * Mostly a wrapper for \phpseclib3\Crypt\Common\SymmetricKey::encrypt, with some additional OpenSSL handling code
* *
* @return string $ciphertext * @return string $ciphertext
*@see self::decrypt() * @see self::decrypt()
*/ */
public function encrypt(string $plaintext): string public function encrypt(string $plaintext): string
{ {
@ -402,7 +402,7 @@ class RC2 extends BlockCipher
* Mostly a wrapper for \phpseclib3\Crypt\Common\SymmetricKey::decrypt, with some additional OpenSSL handling code * Mostly a wrapper for \phpseclib3\Crypt\Common\SymmetricKey::decrypt, with some additional OpenSSL handling code
* *
* @return string $plaintext * @return string $plaintext
*@see self::encrypt() * @see self::encrypt()
*/ */
public function decrypt(string $ciphertext): string public function decrypt(string $ciphertext): string
{ {
@ -420,7 +420,7 @@ class RC2 extends BlockCipher
/** /**
* Encrypts a block * Encrypts a block
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock() * @see \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock()
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
*/ */
protected function encryptBlock(string $in): string protected function encryptBlock(string $in): string
@ -462,7 +462,7 @@ class RC2 extends BlockCipher
/** /**
* Decrypts a block * Decrypts a block
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock() * @see \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
protected function decryptBlock(string $in): string protected function decryptBlock(string $in): string

View File

@ -100,7 +100,7 @@ class RC4 extends StreamCipher
* *
* This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
protected function isValidEngineHelper(int $engine): bool protected function isValidEngineHelper(int $engine): bool
{ {
@ -167,7 +167,7 @@ class RC4 extends StreamCipher
* Encrypts a message. * Encrypts a message.
* *
* @return string $ciphertext * @return string $ciphertext
*@see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
* @see self::crypt() * @see self::crypt()
*/ */
public function encrypt(string $plaintext): string public function encrypt(string $plaintext): string
@ -185,7 +185,7 @@ class RC4 extends StreamCipher
* At least if the continuous buffer is disabled. * At least if the continuous buffer is disabled.
* *
* @return string $plaintext * @return string $plaintext
*@see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see self::crypt() * @see self::crypt()
*/ */
public function decrypt(string $ciphertext): string public function decrypt(string $ciphertext): string
@ -244,7 +244,7 @@ class RC4 extends StreamCipher
* Encrypts or decrypts a message. * Encrypts or decrypts a message.
* *
* @return string $text * @return string $text
*@see self::decrypt() * @see self::decrypt()
* @see self::encrypt() * @see self::encrypt()
*/ */
private function crypt(string $text, int $mode): string private function crypt(string $text, int $mode): string

View File

@ -286,7 +286,7 @@ abstract class RSA extends AsymmetricKey
* *
* The public key can be extracted from the private key * The public key can be extracted from the private key
* *
*@return RSA * @return RSA
*/ */
public static function createKey(int $bits = 2048) public static function createKey(int $bits = 2048)
{ {
@ -416,7 +416,7 @@ abstract class RSA extends AsymmetricKey
/** /**
* OnLoad Handler * OnLoad Handler
* *
*@return bool * @return bool
*/ */
protected static function onLoad(array $components) protected static function onLoad(array $components)
{ {
@ -516,7 +516,7 @@ abstract class RSA extends AsymmetricKey
* *
* See {@link http://tools.ietf.org/html/rfc3447#section-9.2 RFC3447#section-9.2}. * See {@link http://tools.ietf.org/html/rfc3447#section-9.2 RFC3447#section-9.2}.
* *
*@throws \LengthException if the intended encoded message length is too short * @throws \LengthException if the intended encoded message length is too short
*/ */
protected function emsa_pkcs1_v1_5_encode(string $m, int $emLen): string protected function emsa_pkcs1_v1_5_encode(string $m, int $emLen): string
{ {

View File

@ -241,7 +241,7 @@ class PrivateKey extends RSA implements Common\PrivateKey
* See {@link http://tools.ietf.org/html/rfc3447#section-8.2.1 RFC3447#section-8.2.1}. * See {@link http://tools.ietf.org/html/rfc3447#section-8.2.1 RFC3447#section-8.2.1}.
* *
* @return bool|string * @return bool|string
*@throws \LengthException if the RSA modulus is too short * @throws \LengthException if the RSA modulus is too short
*/ */
private function rsassa_pkcs1_v1_5_sign(string $m) private function rsassa_pkcs1_v1_5_sign(string $m)
{ {
@ -413,7 +413,7 @@ class PrivateKey extends RSA implements Common\PrivateKey
* Decryption * Decryption
* *
* @return bool|string * @return bool|string
*@see self::encrypt() * @see self::encrypt()
*/ */
public function decrypt(string $ciphertext) public function decrypt(string $ciphertext)
{ {

View File

@ -62,7 +62,7 @@ class PublicKey extends RSA implements Common\PublicKey
* *
* See {@link http://tools.ietf.org/html/rfc3447#section-8.2.2 RFC3447#section-8.2.2}. * See {@link http://tools.ietf.org/html/rfc3447#section-8.2.2 RFC3447#section-8.2.2}.
* *
*@throws \LengthException if the RSA modulus is too short * @throws \LengthException if the RSA modulus is too short
*/ */
private function rsassa_pkcs1_v1_5_verify(string $m, string $s): bool private function rsassa_pkcs1_v1_5_verify(string $m, string $s): bool
{ {
@ -305,7 +305,7 @@ class PublicKey extends RSA implements Common\PublicKey
* *
* @param bool $pkcs15_compat optional * @param bool $pkcs15_compat optional
* @return bool|string * @return bool|string
*@throws \LengthException if strlen($m) > $this->k - 11 * @throws \LengthException if strlen($m) > $this->k - 11
*/ */
private function rsaes_pkcs1_v1_5_encrypt(string $m, bool $pkcs15_compat = false) private function rsaes_pkcs1_v1_5_encrypt(string $m, bool $pkcs15_compat = false)
{ {
@ -345,7 +345,7 @@ class PublicKey extends RSA implements Common\PublicKey
* See {@link http://tools.ietf.org/html/rfc3447#section-7.1.1 RFC3447#section-7.1.1} and * See {@link http://tools.ietf.org/html/rfc3447#section-7.1.1 RFC3447#section-7.1.1} and
* {http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding OAES}. * {http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding OAES}.
* *
*@throws \LengthException if strlen($m) > $this->k - 2 * $this->hLen - 2 * @throws \LengthException if strlen($m) > $this->k - 2 * $this->hLen - 2
*/ */
private function rsaes_oaep_encrypt(string $m): string private function rsaes_oaep_encrypt(string $m): string
{ {
@ -426,7 +426,7 @@ class PublicKey extends RSA implements Common\PublicKey
* *
* @return bool|string * @return bool|string
* @throws \LengthException if the RSA modulus is too short * @throws \LengthException if the RSA modulus is too short
*@see self::decrypt() * @see self::decrypt()
*/ */
public function encrypt(string $plaintext) public function encrypt(string $plaintext)
{ {

View File

@ -38,7 +38,7 @@ abstract class Random
* microoptimizations because this function has the potential of being called a huge number of times. * microoptimizations because this function has the potential of being called a huge number of times.
* eg. for RSA key generation. * eg. for RSA key generation.
* *
*@throws \RuntimeException if a symmetric cipher is needed but not loaded * @throws \RuntimeException if a symmetric cipher is needed but not loaded
*/ */
public static function string(int $length): string public static function string(int $length): string
{ {

View File

@ -187,7 +187,7 @@ class Rijndael extends BlockCipher
* the mcrypt php extension, even if available. * the mcrypt php extension, even if available.
* This results then in slower encryption. * This results then in slower encryption.
* *
*@throws \LengthException if the key length is invalid * @throws \LengthException if the key length is invalid
*/ */
public function setKeyLength(int $length): void public function setKeyLength(int $length): void
{ {
@ -212,7 +212,7 @@ class Rijndael extends BlockCipher
* Rijndael supports five different key lengths * Rijndael supports five different key lengths
* *
* @throws \LengthException if the key length isn't supported * @throws \LengthException if the key length isn't supported
*@see setKeyLength() * @see setKeyLength()
*/ */
public function setKey(string $key): void public function setKey(string $key): void
{ {
@ -259,7 +259,7 @@ class Rijndael extends BlockCipher
* *
* This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
protected function isValidEngineHelper(int $engine): bool protected function isValidEngineHelper(int $engine): bool
{ {
@ -612,7 +612,7 @@ class Rijndael extends BlockCipher
/** /**
* Performs S-Box substitutions * Performs S-Box substitutions
* *
*@return array * @return array
*/ */
private function subWord(int $word) private function subWord(int $word)
{ {
@ -942,7 +942,7 @@ class Rijndael extends BlockCipher
/** /**
* Encrypts a message. * Encrypts a message.
* *
*@see self::decrypt() * @see self::decrypt()
* @see parent::encrypt() * @see parent::encrypt()
*/ */
public function encrypt(string $plaintext): string public function encrypt(string $plaintext): string
@ -971,7 +971,7 @@ class Rijndael extends BlockCipher
/** /**
* Decrypts a message. * Decrypts a message.
* *
*@see self::encrypt() * @see self::encrypt()
* @see parent::decrypt() * @see parent::decrypt()
*/ */
public function decrypt(string $ciphertext): string public function decrypt(string $ciphertext): string

View File

@ -232,7 +232,7 @@ class Salsa20 extends StreamCipher
* Encrypts a message. * Encrypts a message.
* *
* @return string $ciphertext * @return string $ciphertext
*@see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
* @see self::crypt() * @see self::crypt()
*/ */
public function encrypt(string $plaintext): string public function encrypt(string $plaintext): string
@ -251,7 +251,7 @@ class Salsa20 extends StreamCipher
* At least if the continuous buffer is disabled. * At least if the continuous buffer is disabled.
* *
* @return string $plaintext * @return string $plaintext
*@see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see self::crypt() * @see self::crypt()
*/ */
public function decrypt(string $ciphertext): string public function decrypt(string $ciphertext): string
@ -293,7 +293,7 @@ class Salsa20 extends StreamCipher
* Encrypts or decrypts a message. * Encrypts or decrypts a message.
* *
* @return string $text * @return string $text
*@see self::decrypt() * @see self::decrypt()
* @see self::encrypt() * @see self::encrypt()
*/ */
private function crypt(string $text, int $mode): string private function crypt(string $text, int $mode): string
@ -465,7 +465,7 @@ class Salsa20 extends StreamCipher
/** /**
* Calculates Poly1305 MAC * Calculates Poly1305 MAC
* *
*@see self::decrypt() * @see self::decrypt()
* @see self::encrypt() * @see self::encrypt()
*/ */
protected function poly1305(string $text): string protected function poly1305(string $text): string

View File

@ -128,7 +128,7 @@ class TripleDES extends DES
* *
* - cbc3 (same as cbc) * - cbc3 (same as cbc)
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
* @see \phpseclib3\Crypt\DES::__construct() * @see \phpseclib3\Crypt\DES::__construct()
*/ */
public function __construct(string $mode) public function __construct(string $mode)
@ -170,7 +170,7 @@ class TripleDES extends DES
* *
* This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine()
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
protected function isValidEngineHelper(int $engine): bool protected function isValidEngineHelper(int $engine): bool
{ {
@ -188,7 +188,7 @@ class TripleDES extends DES
* *
* SetIV is not required when \phpseclib3\Crypt\Common\SymmetricKey::MODE_ECB is being used. * SetIV is not required when \phpseclib3\Crypt\Common\SymmetricKey::MODE_ECB is being used.
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::setIV() * @see \phpseclib3\Crypt\Common\SymmetricKey::setIV()
*/ */
public function setIV(string $iv): void public function setIV(string $iv): void
{ {
@ -207,7 +207,7 @@ class TripleDES extends DES
* *
* If you want to use a 64-bit key use DES.php * If you want to use a 64-bit key use DES.php
* *
*@throws \LengthException if the key length is invalid * @throws \LengthException if the key length is invalid
* @see \phpseclib3\Crypt\Common\SymmetricKey:setKeyLength() * @see \phpseclib3\Crypt\Common\SymmetricKey:setKeyLength()
*/ */
public function setKeyLength(int $length): void public function setKeyLength(int $length): void
@ -230,7 +230,7 @@ class TripleDES extends DES
* *
* DES also requires that every eighth bit be a parity bit, however, we'll ignore that. * DES also requires that every eighth bit be a parity bit, however, we'll ignore that.
* *
*@throws \LengthException if the key length is invalid * @throws \LengthException if the key length is invalid
* @see \phpseclib3\Crypt\DES::setKey() * @see \phpseclib3\Crypt\DES::setKey()
* @see \phpseclib3\Crypt\Common\SymmetricKey::setKey() * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey()
*/ */
@ -267,7 +267,7 @@ class TripleDES extends DES
* Encrypts a message. * Encrypts a message.
* *
* @return string $cipertext * @return string $cipertext
*@see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
*/ */
public function encrypt(string $plaintext): string public function encrypt(string $plaintext): string
{ {
@ -292,7 +292,7 @@ class TripleDES extends DES
* Decrypts a message. * Decrypts a message.
* *
* @return string $plaintext * @return string $plaintext
*@see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
public function decrypt(string $ciphertext): string public function decrypt(string $ciphertext): string
{ {
@ -413,7 +413,7 @@ class TripleDES extends DES
/** /**
* Sets the internal crypt engine * Sets the internal crypt engine
* *
*@see \phpseclib3\Crypt\Common\SymmetricKey::setPreferredEngine() * @see \phpseclib3\Crypt\Common\SymmetricKey::setPreferredEngine()
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
public function setPreferredEngine(string $engine): void public function setPreferredEngine(string $engine): void

View File

@ -393,7 +393,7 @@ class Twofish extends BlockCipher
* Rijndael supports five different key lengths * Rijndael supports five different key lengths
* *
* @throws \LengthException if the key length isn't supported * @throws \LengthException if the key length isn't supported
*@see setKeyLength() * @see setKeyLength()
*/ */
public function setKey(string $key): void public function setKey(string $key): void
{ {

View File

@ -1340,7 +1340,7 @@ class X509
* Returns true if the signature is verified and false if it is not correct. * Returns true if the signature is verified and false if it is not correct.
* If the algorithms are unsupposed an exception is thrown. * If the algorithms are unsupposed an exception is thrown.
* *
*@throws \phpseclib3\Exception\UnsupportedAlgorithmException if the algorithm is unsupported * @throws \phpseclib3\Exception\UnsupportedAlgorithmException if the algorithm is unsupported
*/ */
private function validateSignatureHelper(string $publicKeyAlgorithm, string $publicKey, string $signatureAlgorithm, string $signature, string $signatureSubject): bool private function validateSignatureHelper(string $publicKeyAlgorithm, string $publicKey, string $signatureAlgorithm, string $signature, string $signatureSubject): bool
{ {

View File

@ -60,7 +60,7 @@ abstract class Base extends BCMath
/** /**
* Modular reduction preparation * Modular reduction preparation
* *
*@see self::slidingWindow() * @see self::slidingWindow()
*/ */
protected static function prepareReduce(string $x, string $n, string $class): string protected static function prepareReduce(string $x, string $n, string $class): string
{ {
@ -70,7 +70,7 @@ abstract class Base extends BCMath
/** /**
* Modular multiply * Modular multiply
* *
*@see self::slidingWindow() * @see self::slidingWindow()
*/ */
protected static function multiplyReduce(string $x, string $y, string $n, string $class): string protected static function multiplyReduce(string $x, string $y, string $n, string $class): string
{ {
@ -80,7 +80,7 @@ abstract class Base extends BCMath
/** /**
* Modular square * Modular square
* *
*@see self::slidingWindow() * @see self::slidingWindow()
*/ */
protected static function squareReduce(string $x, string $n, string $class): string protected static function squareReduce(string $x, string $n, string $class): string
{ {

View File

@ -649,7 +649,7 @@ abstract class PHP extends Engine
$result = []; $result = [];
for ($i = count($dividend) - 1; $i >= 0; --$i) { for ($i = count($dividend) - 1; $i >= 0; --$i) {
$temp = static::BASE_FULL * $carry + $dividend[$i]; $temp = static::BASE_FULL * $carry + (int) $dividend[$i];
$result[$i] = self::safe_divide($temp, $divisor); $result[$i] = self::safe_divide($temp, $divisor);
$carry = (int)($temp - $divisor * $result[$i]); $carry = (int)($temp - $divisor * $result[$i]);
} }
@ -664,10 +664,8 @@ abstract class PHP extends Engine
* if the dividend is not evenly divisible by the divisor. Since a float64 doesn't * if the dividend is not evenly divisible by the divisor. Since a float64 doesn't
* have the precision of int64 this is a problem so, when int64 is being used, * have the precision of int64 this is a problem so, when int64 is being used,
* we'll guarantee that the dividend is divisible by first subtracting the remainder. * we'll guarantee that the dividend is divisible by first subtracting the remainder.
*
* @return int
*/ */
private static function safe_divide(int $x, int $y) private static function safe_divide(int $x, int $y): int
{ {
if (static::BASE === 26) { if (static::BASE === 26) {
return (int)($x / $y); return (int)($x / $y);

View File

@ -92,7 +92,7 @@ abstract class Base extends PHP
/** /**
* Modular reduction preparation * Modular reduction preparation
* *
*@see self::slidingWindow() * @see self::slidingWindow()
*/ */
protected static function prepareReduce(array $x, array $n, string $class): array protected static function prepareReduce(array $x, array $n, string $class): array
{ {
@ -102,7 +102,7 @@ abstract class Base extends PHP
/** /**
* Modular multiply * Modular multiply
* *
*@see self::slidingWindow() * @see self::slidingWindow()
*/ */
protected static function multiplyReduce(array $x, array $y, array $n, string $class): array protected static function multiplyReduce(array $x, array $y, array $n, string $class): array
{ {
@ -113,7 +113,7 @@ abstract class Base extends PHP
/** /**
* Modular square * Modular square
* *
*@see self::slidingWindow() * @see self::slidingWindow()
*/ */
protected static function squareReduce(array $x, array $n, string $class): array protected static function squareReduce(array $x, array $n, string $class): array
{ {

View File

@ -31,7 +31,7 @@ abstract class MontgomeryMult extends Montgomery
* {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36} * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36}
* *
* @param class-string<PHP> $class * @param class-string<PHP> $class
*@see self::_prepMontgomery() * @see self::_prepMontgomery()
* @see self::_montgomery() * @see self::_montgomery()
*/ */
public static function multiplyReduce(array $x, array $y, array $m, string $class): array public static function multiplyReduce(array $x, array $y, array $m, string $class): array

View File

@ -82,7 +82,7 @@ class PHP32 extends PHP
} }
$step = count($vals) & 3; $step = count($vals) & 3;
if ($step) { if ($step) {
$digit = floor($digit / pow(2, 2 * $step)); $digit = floor($digit / 2 ** (2 * $step));
} }
if ($step != 3) { if ($step != 3) {
$digit &= static::MAX_DIGIT; $digit &= static::MAX_DIGIT;

View File

@ -155,7 +155,7 @@ class Integer extends Base
* @return string[] * @return string[]
* @link https://en.wikipedia.org/wiki/Polynomial_greatest_common_divisor#Euclidean_division * @link https://en.wikipedia.org/wiki/Polynomial_greatest_common_divisor#Euclidean_division
*/ */
private static function polynomialDivide($x, $y): array private static function polynomialDivide(string $x, string $y): array
{ {
// in wikipedia's description of the algorithm, lc() is the leading coefficient. over a binary field that's // in wikipedia's description of the algorithm, lc() is the leading coefficient. over a binary field that's
// always going to be 1. // always going to be 1.
@ -184,7 +184,7 @@ class Integer extends Base
* *
* @link https://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplication * @link https://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplication
*/ */
private static function regularPolynomialMultiply($x, $y): string private static function regularPolynomialMultiply(string $x, string $y): string
{ {
$precomputed = [ltrim($x, "\0")]; $precomputed = [ltrim($x, "\0")];
$x = strrev(BinaryField::base256ToBase2($x)); $x = strrev(BinaryField::base256ToBase2($x));
@ -222,7 +222,7 @@ class Integer extends Base
* *
* @link https://en.wikipedia.org/wiki/Karatsuba_algorithm * @link https://en.wikipedia.org/wiki/Karatsuba_algorithm
*/ */
private static function polynomialMultiply($x, $y): string private static function polynomialMultiply(string $x, string $y): string
{ {
if (strlen($x) == strlen($y)) { if (strlen($x) == strlen($y)) {
$length = strlen($x); $length = strlen($x);
@ -430,7 +430,7 @@ class Integer extends Base
/** /**
* Returns the modulo * Returns the modulo
*/ */
public static function getModulo($instanceID): string public static function getModulo(int $instanceID): string
{ {
return static::$modulo[$instanceID]; return static::$modulo[$instanceID];
} }

View File

@ -94,7 +94,7 @@ class Integer extends Base
/** /**
* Delete the modulo for a given instance * Delete the modulo for a given instance
*/ */
public static function cleanupCache($instanceID): void public static function cleanupCache(int $instanceID): void
{ {
unset(static::$modulo[$instanceID]); unset(static::$modulo[$instanceID]);
unset(static::$reduce[$instanceID]); unset(static::$reduce[$instanceID]);

View File

@ -620,7 +620,7 @@ class SFTP extends SSH2
* If canonicalize_paths has been disabled using disablePathCanonicalization(), $path is returned as-is. * If canonicalize_paths has been disabled using disablePathCanonicalization(), $path is returned as-is.
* *
* @throws \UnexpectedValueException on receipt of unexpected packets * @throws \UnexpectedValueException on receipt of unexpected packets
*@see self::chdir() * @see self::chdir()
* @see self::disablePathCanonicalization() * @see self::disablePathCanonicalization()
*/ */
public function realpath(string $path) public function realpath(string $path)
@ -706,7 +706,7 @@ class SFTP extends SSH2
/** /**
* Changes the current directory * Changes the current directory
* *
*@throws \UnexpectedValueException on receipt of unexpected packets * @throws \UnexpectedValueException on receipt of unexpected packets
*/ */
public function chdir(string $dir): bool public function chdir(string $dir): bool
{ {
@ -951,10 +951,8 @@ class SFTP extends SSH2
* Compares two rawlist entries using parameters set by setListOrder() * Compares two rawlist entries using parameters set by setListOrder()
* *
* Intended for use with uasort() * Intended for use with uasort()
*
* @return int
*/ */
private function comparator(array $a, array $b) private function comparator(array $a, array $b): ?int
{ {
switch (true) { switch (true) {
case $a['filename'] === '.' || $b['filename'] === '.': case $a['filename'] === '.' || $b['filename'] === '.':
@ -1006,6 +1004,7 @@ class SFTP extends SSH2
return $order === SORT_ASC ? $a[$sort] - $b[$sort] : $b[$sort] - $a[$sort]; return $order === SORT_ASC ? $a[$sort] - $b[$sort] : $b[$sort] - $a[$sort];
} }
} }
return null;
} }
/** /**
@ -1254,7 +1253,7 @@ class SFTP extends SSH2
* The second parameter can be either PacketType::STAT or PacketType::LSTAT. * The second parameter can be either PacketType::STAT or PacketType::LSTAT.
* *
* @return array|false * @return array|false
*@throws \UnexpectedValueException on receipt of unexpected packets * @throws \UnexpectedValueException on receipt of unexpected packets
*/ */
private function stat_helper(string $filename, int $type) private function stat_helper(string $filename, int $type)
{ {
@ -1290,7 +1289,7 @@ class SFTP extends SSH2
* *
* If the file does not exist, it will be created. * If the file does not exist, it will be created.
* *
*@throws \UnexpectedValueException on receipt of unexpected packets * @throws \UnexpectedValueException on receipt of unexpected packets
*/ */
public function touch(string $filename, int $time = null, int $atime = null): bool public function touch(string $filename, int $time = null, int $atime = null): bool
{ {
@ -1450,7 +1449,7 @@ class SFTP extends SSH2
/** /**
* Sets information about a file * Sets information about a file
* *
*@throws \UnexpectedValueException on receipt of unexpected packets * @throws \UnexpectedValueException on receipt of unexpected packets
*/ */
private function setstat(string $filename, string $attr, bool $recursive): bool private function setstat(string $filename, string $attr, bool $recursive): bool
{ {
@ -1613,7 +1612,7 @@ class SFTP extends SSH2
* *
* symlink() creates a symbolic link to the existing target with the specified name link. * symlink() creates a symbolic link to the existing target with the specified name link.
* *
*@throws \UnexpectedValueException on receipt of unexpected packets * @throws \UnexpectedValueException on receipt of unexpected packets
*/ */
public function symlink(string $target, string $link): bool public function symlink(string $target, string $link): bool
{ {
@ -1729,7 +1728,7 @@ class SFTP extends SSH2
/** /**
* Removes a directory. * Removes a directory.
* *
*@throws \UnexpectedValueException on receipt of unexpected packets * @throws \UnexpectedValueException on receipt of unexpected packets
*/ */
public function rmdir(string $dir): bool public function rmdir(string $dir): bool
{ {
@ -2051,7 +2050,7 @@ class SFTP extends SSH2
* *
* @param string|bool|resource|callable $local_file * @param string|bool|resource|callable $local_file
* @return string|bool * @return string|bool
*@throws \UnexpectedValueException on receipt of unexpected packets * @throws \UnexpectedValueException on receipt of unexpected packets
*/ */
public function get(string $remote_file, $local_file = false, int $offset = 0, int $length = -1, callable $progressCallback = null) public function get(string $remote_file, $local_file = false, int $offset = 0, int $length = -1, callable $progressCallback = null)
{ {

View File

@ -2797,7 +2797,7 @@ class SSH2
* *
* @return string|bool|null * @return string|bool|null
* @throws \RuntimeException on connection error * @throws \RuntimeException on connection error
*@see self::write() * @see self::write()
*/ */
public function read(string $expect = '', int $mode = self::READ_SIMPLE) public function read(string $expect = '', int $mode = self::READ_SIMPLE)
{ {
@ -2842,7 +2842,7 @@ class SSH2
* Inputs a command into an interactive shell. * Inputs a command into an interactive shell.
* *
* @throws \RuntimeException on connection error * @throws \RuntimeException on connection error
*@see SSH2::read() * @see SSH2::read()
*/ */
public function write(string $cmd): void public function write(string $cmd): void
{ {
@ -2866,7 +2866,7 @@ class SSH2
* returns that and then that that was passed into stopSubsystem() but that'll be saved for a future date and implemented * returns that and then that that was passed into stopSubsystem() but that'll be saved for a future date and implemented
* if there's sufficient demand for such a feature. * if there's sufficient demand for such a feature.
* *
*@see self::stopSubsystem() * @see self::stopSubsystem()
*/ */
public function startSubsystem(string $subsystem): bool public function startSubsystem(string $subsystem): bool
{ {
@ -3058,7 +3058,7 @@ class SSH2
* See '6. Binary Packet Protocol' of rfc4253 for more info. * See '6. Binary Packet Protocol' of rfc4253 for more info.
* *
* @return bool|string * @return bool|string
*@see self::_send_binary_packet() * @see self::_send_binary_packet()
*/ */
private function get_binary_packet(bool $skip_channel_filter = false) private function get_binary_packet(bool $skip_channel_filter = false)
{ {
@ -3311,7 +3311,7 @@ class SSH2
* Read Remaining Bytes * Read Remaining Bytes
* *
* @return string * @return string
*@see self::get_binary_packet() * @see self::get_binary_packet()
*/ */
private function read_remaining_bytes(int $remaining_length) private function read_remaining_bytes(int $remaining_length)
{ {
@ -3368,7 +3368,7 @@ class SSH2
* Because some binary packets need to be ignored... * Because some binary packets need to be ignored...
* *
* @return string|bool * @return string|bool
*@see self::_get_binary_packet() * @see self::_get_binary_packet()
*/ */
private function filter(string $payload, bool $skip_channel_filter) private function filter(string $payload, bool $skip_channel_filter)
{ {