diff --git a/phpseclib/Crypt/Blowfish.php b/phpseclib/Crypt/Blowfish.php index 61794a9ce..180482964 100644 --- a/phpseclib/Crypt/Blowfish.php +++ b/phpseclib/Crypt/Blowfish.php @@ -386,7 +386,7 @@ protected function setupKey(): void /* key-expanding p[] and S-Box building sb[] */ $this->bctx = [ 'p' => [], - 'sb' => self::$sbox + 'sb' => self::$sbox, ]; // unpack binary string in unsigned chars @@ -543,7 +543,7 @@ private static function expand0state(array $key, array &$sbox, array &$p): void [$p[16], $p[17]] = self::encryptBlockHelperFast($p[14], $p[15], $sbox, $p); // @codingStandardsIgnoreEnd - list($sbox[0], $sbox[1]) = self::encryptBlockHelperFast($p[16], $p[17], $sbox, $p); + [$sbox[0], $sbox[1]] = self::encryptBlockHelperFast($p[16], $p[17], $sbox, $p); for ($i = 2; $i < 1024; $i += 2) { [$sbox[$i], $sbox[$i + 1]] = self::encryptBlockHelperFast($sbox[$i - 2], $sbox[$i - 1], $sbox, $p); } diff --git a/phpseclib/Crypt/Common/AsymmetricKey.php b/phpseclib/Crypt/Common/AsymmetricKey.php index 3fcc7fa8c..b2bfec28e 100644 --- a/phpseclib/Crypt/Common/AsymmetricKey.php +++ b/phpseclib/Crypt/Common/AsymmetricKey.php @@ -125,7 +125,7 @@ protected static function initialize_static_variables(): void * Load the key * * @param string|array $key - * @return \phpseclib3\Crypt\Common\PublicKey|\phpseclib3\Crypt\Common\PrivateKey + * @return PublicKey|PrivateKey */ public static function load($key, ?string $password = null): AsymmetricKey { diff --git a/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php b/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php index 3a9bb67fe..abc0af79f 100644 --- a/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php +++ b/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php @@ -669,7 +669,7 @@ public static function extractEncryptionAlgorithm(string $key): array $decoded = self::preParse($key); - $r = ASN1::asn1map($decoded[0], ASN1\Maps\EncryptedPrivateKeyInfo::MAP); + $r = ASN1::asn1map($decoded[0], Maps\EncryptedPrivateKeyInfo::MAP); if (!is_array($r)) { throw new RuntimeException('Unable to parse using EncryptedPrivateKeyInfo map'); } @@ -679,7 +679,7 @@ public static function extractEncryptionAlgorithm(string $key): array if (!$decoded) { throw new RuntimeException('Unable to decode BER'); } - $r['encryptionAlgorithm']['parameters'] = ASN1::asn1map($decoded[0], ASN1\Maps\PBES2params::MAP); + $r['encryptionAlgorithm']['parameters'] = ASN1::asn1map($decoded[0], Maps\PBES2params::MAP); $kdf = &$r['encryptionAlgorithm']['parameters']['keyDerivationFunc']; switch ($kdf['algorithm']) { diff --git a/phpseclib/Crypt/DH/PrivateKey.php b/phpseclib/Crypt/DH/PrivateKey.php index 0d3089f58..30a783ea8 100644 --- a/phpseclib/Crypt/DH/PrivateKey.php +++ b/phpseclib/Crypt/DH/PrivateKey.php @@ -42,8 +42,6 @@ final class PrivateKey extends DH /** * Returns the public key - * - * @return DH\PublicKey */ public function getPublicKey(): PublicKey { diff --git a/phpseclib/Crypt/EC/BaseCurves/Base.php b/phpseclib/Crypt/EC/BaseCurves/Base.php index aa74dc907..4e4642666 100644 --- a/phpseclib/Crypt/EC/BaseCurves/Base.php +++ b/phpseclib/Crypt/EC/BaseCurves/Base.php @@ -64,7 +64,7 @@ public function convertInteger(BigInteger $x) /** * Returns the length, in bytes, of the modulo * - * @return integer + * @return Integer */ public function getLengthInBytes(): int { @@ -74,7 +74,7 @@ public function getLengthInBytes(): int /** * Returns the length, in bits, of the modulo * - * @return integer + * @return Integer */ public function getLength(): int { diff --git a/phpseclib/Math/BigInteger.php b/phpseclib/Math/BigInteger.php index 58dcd511e..831ddd7c0 100644 --- a/phpseclib/Math/BigInteger.php +++ b/phpseclib/Math/BigInteger.php @@ -164,7 +164,7 @@ private static function initialize_static_variables(): void * If the second parameter - $base - is negative, then it will be assumed that the number's are encoded using * two's compliment. The sole exception to this is -10, which is treated the same as 10 is. * - * @param string|int|BigInteger\Engines\Engine $x Base-10 number or base-$base number if $base set. + * @param string|int|Engine $x Base-10 number or base-$base number if $base set. */ public function __construct($x = 0, int $base = 10) { @@ -172,7 +172,7 @@ public function __construct($x = 0, int $base = 10) if ($x instanceof self::$mainEngine) { $this->value = clone $x; - } elseif ($x instanceof BigInteger\Engines\Engine) { + } elseif ($x instanceof Engine) { $this->value = new static("$x"); $this->value->setPrecision($x->getPrecision()); } else { diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index d331a7836..040805009 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -46,7 +46,6 @@ use phpseclib3\Net\SFTP\OpenFlag5; use phpseclib3\Net\SFTP\PacketType as SFTPPacketType; use phpseclib3\Net\SFTP\StatusCode; -use phpseclib3\Net\SSH2\DisconnectReason; use phpseclib3\Net\SSH2\MessageType as SSH2MessageType; /** diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 8f16951dc..c5581f22f 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3024,9 +3024,6 @@ public function __destruct() * 2: phpseclib takes an active approach to see if the connection is still active by sending an SSH_MSG_CHANNEL_OPEN * packet and imediately trying to close that channel. some routers, in particular, however, will only let you * open one channel, so this approach could yield false positives - * - * @param int $level - * @return bool */ public function isConnected(int $level = 0): bool { diff --git a/tests/Unit/Crypt/RSA/LoadKeyTest.php b/tests/Unit/Crypt/RSA/LoadKeyTest.php index 13df3970e..909eb2043 100644 --- a/tests/Unit/Crypt/RSA/LoadKeyTest.php +++ b/tests/Unit/Crypt/RSA/LoadKeyTest.php @@ -1426,14 +1426,14 @@ public function testPKCS8DES(): void /** * @group github1994 */ - public function testCloseNumbers() + public function testCloseNumbers(): void { $rsa = PublicKeyLoader::load([ // Modulus 'n' => new BigInteger('5BDD6AFB1E1AFB50D1B2989F70B549B8D44AE3712B444F2C5D862C46C99526E998B79BF0B4F1461524E39D263F3130B9E08F3B17C2070785EFB0EDEC1E75C6C2B8185FA9596886D5DAF8B68E92FCF5F1B33E7CD772845555B086D2A2466B6398A04DFE1C727BB020g1ED2BF3F03D2826F89616D0846C18B1D87064616FAD394462', 16), // Exponent - 'e' => new BigInteger('6FE4F5D0AFCC16E8A5CC68955D4EF28255A546D06F34DD103540B9A7D202AEC96353072DB65D9C360E9030F413971142EE6A28974767CCF3ABFA4E7ADDAEAD81D3F8AE5FF1B8241CA9EF51C10941FFFA74482A636CBD909D29CF7A0346653D3C286EA1F392F4968AEF1489EC4B4BCEA4F248F3931B1C9BE2808DBD33B049731A', 16) + 'e' => new BigInteger('6FE4F5D0AFCC16E8A5CC68955D4EF28255A546D06F34DD103540B9A7D202AEC96353072DB65D9C360E9030F413971142EE6A28974767CCF3ABFA4E7ADDAEAD81D3F8AE5FF1B8241CA9EF51C10941FFFA74482A636CBD909D29CF7A0346653D3C286EA1F392F4968AEF1489EC4B4BCEA4F248F3931B1C9BE2808DBD33B049731A', 16), ]) ->withPadding(RSA::SIGNATURE_PKCS1) ->withHash('md5') diff --git a/tests/Unit/File/ASN1Test.php b/tests/Unit/File/ASN1Test.php index 70e415bf8..fe52e7b6f 100644 --- a/tests/Unit/File/ASN1Test.php +++ b/tests/Unit/File/ASN1Test.php @@ -453,7 +453,7 @@ public function testBadTagSecondOctet(): void $this->assertNull($decoded); } - public function testLongOID() + public function testLongOID(): void { $cert = file_get_contents(dirname(__FILE__) . '/ASN1/mal-cert-02.der'); diff --git a/tests/Unit/File/X509/X509Test.php b/tests/Unit/File/X509/X509Test.php index cfbcc02a1..a9daef76c 100644 --- a/tests/Unit/File/X509/X509Test.php +++ b/tests/Unit/File/X509/X509Test.php @@ -1395,7 +1395,7 @@ public function testWeirdCharsCert(): void $this->assertFalse($x509->validateURL('https://aa')); } - public function testLargeInteger() + public function testLargeInteger(): void { // cert has an elliptic curve public key with a specified curve (vs a named curve) with // an excessively large integer value