mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-02 09:38:06 +01:00
backport select type hinting changes from master branch
This commit is contained in:
parent
f24691dc55
commit
e0adfa1712
@ -326,9 +326,8 @@ abstract class DH extends AsymmetricKey
|
||||
* OnLoad Handler
|
||||
*
|
||||
* @return bool
|
||||
* @param array $components
|
||||
*/
|
||||
protected static function onLoad($components)
|
||||
protected static function onLoad(array $components)
|
||||
{
|
||||
if (!isset($components['privateKey']) && !isset($components['publicKey'])) {
|
||||
$new = new Parameters();
|
||||
|
@ -214,9 +214,8 @@ abstract class DSA extends AsymmetricKey
|
||||
* OnLoad Handler
|
||||
*
|
||||
* @return bool
|
||||
* @param array $components
|
||||
*/
|
||||
protected static function onLoad($components)
|
||||
protected static function onLoad(array $components)
|
||||
{
|
||||
if (!isset(self::$engines['PHP'])) {
|
||||
self::useBestEngine();
|
||||
|
@ -199,9 +199,8 @@ abstract class EC extends AsymmetricKey
|
||||
* OnLoad Handler
|
||||
*
|
||||
* @return bool
|
||||
* @param array $components
|
||||
*/
|
||||
protected static function onLoad($components)
|
||||
protected static function onLoad(array $components)
|
||||
{
|
||||
if (!isset(self::$engines['PHP'])) {
|
||||
self::useBestEngine();
|
||||
|
@ -645,7 +645,7 @@ class Prime extends Base
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
private function getNAFPoints($point, $wnd)
|
||||
private function getNAFPoints(array $point, $wnd)
|
||||
{
|
||||
if (isset($point['naf'])) {
|
||||
return $point['naf'];
|
||||
|
@ -115,7 +115,7 @@ abstract class XML
|
||||
* @param bool $decode optional
|
||||
* @return \DOMNodeList
|
||||
*/
|
||||
private static function query($xpath, $name, $error = null, $decode = true)
|
||||
private static function query(\DOMXPath $xpath, $name, $error = null, $decode = true)
|
||||
{
|
||||
$query = '/';
|
||||
$names = explode('/', $name);
|
||||
|
@ -422,9 +422,8 @@ abstract class RSA extends AsymmetricKey
|
||||
* OnLoad Handler
|
||||
*
|
||||
* @return bool
|
||||
* @param array $components
|
||||
*/
|
||||
protected static function onLoad($components)
|
||||
protected static function onLoad(array $components)
|
||||
{
|
||||
$key = $components['isPublicKey'] ?
|
||||
new PublicKey() :
|
||||
|
@ -60,10 +60,9 @@ class PrivateKey extends RSA implements Common\PrivateKey
|
||||
*
|
||||
* See {@link http://tools.ietf.org/html/rfc3447#section-5.1.2 RFC3447#section-5.1.2}.
|
||||
*
|
||||
* @param \phpseclib3\Math\BigInteger $c
|
||||
* @return bool|\phpseclib3\Math\BigInteger
|
||||
*/
|
||||
private function rsadp($c)
|
||||
private function rsadp(BigInteger $c)
|
||||
{
|
||||
if ($c->compare(self::$zero) < 0 || $c->compare($this->modulus) > 0) {
|
||||
throw new \OutOfRangeException('Ciphertext representative out of range');
|
||||
@ -76,10 +75,9 @@ class PrivateKey extends RSA implements Common\PrivateKey
|
||||
*
|
||||
* See {@link http://tools.ietf.org/html/rfc3447#section-5.2.1 RFC3447#section-5.2.1}.
|
||||
*
|
||||
* @param \phpseclib3\Math\BigInteger $m
|
||||
* @return bool|\phpseclib3\Math\BigInteger
|
||||
*/
|
||||
private function rsasp1($m)
|
||||
private function rsasp1(BigInteger $m)
|
||||
{
|
||||
if ($m->compare(self::$zero) < 0 || $m->compare($this->modulus) > 0) {
|
||||
throw new \OutOfRangeException('Signature representative out of range');
|
||||
@ -176,7 +174,7 @@ class PrivateKey extends RSA implements Common\PrivateKey
|
||||
* @param int $i
|
||||
* @return \phpseclib3\Math\BigInteger
|
||||
*/
|
||||
private function blind($x, $r, $i)
|
||||
private function blind(BigInteger $x, BigInteger $r, $i)
|
||||
{
|
||||
$x = $x->multiply($r->modPow($this->publicExponent, $this->primes[$i]));
|
||||
$x = $x->modPow($this->exponents[$i], $this->primes[$i]);
|
||||
|
@ -364,7 +364,7 @@ class PublicKey extends RSA implements Common\PublicKey
|
||||
* @throws \LengthException if strlen($m) > $this->k - 2 * $this->hLen - 2
|
||||
* @return string
|
||||
*/
|
||||
private function rsaes_oaep_encrypt($m)
|
||||
private function rsaes_oaep_encrypt(BigInteger $m)
|
||||
{
|
||||
$mLen = strlen($m);
|
||||
|
||||
|
@ -440,7 +440,7 @@ class ANSI
|
||||
* @param string $char
|
||||
* @return string
|
||||
*/
|
||||
private function processCoordinate($last_attr, $cur_attr, $char)
|
||||
private function processCoordinate(\stdClass $last_attr, \stdClass $cur_attr, $char)
|
||||
{
|
||||
$output = '';
|
||||
|
||||
|
@ -516,12 +516,8 @@ abstract class ASN1
|
||||
* @param array $special
|
||||
* @return array|bool|Element|string|null
|
||||
*/
|
||||
public static function asn1map($decoded, $mapping, $special = [])
|
||||
public static function asn1map(array $decoded, $mapping, $special = [])
|
||||
{
|
||||
if (!is_array($decoded)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($mapping['explicit']) && is_array($decoded['content'])) {
|
||||
$decoded = $decoded['content'][0];
|
||||
}
|
||||
@ -854,7 +850,7 @@ abstract class ASN1
|
||||
* @param array $special
|
||||
* @return string
|
||||
*/
|
||||
private static function encode_der($source, $mapping, $idx = null, $special = [])
|
||||
private static function encode_der($source, array $mapping, $idx = null, array $special = [])
|
||||
{
|
||||
if ($source instanceof Element) {
|
||||
return $source->element;
|
||||
@ -1310,7 +1306,7 @@ abstract class ASN1
|
||||
*
|
||||
* @param array $oids
|
||||
*/
|
||||
public static function loadOIDs($oids)
|
||||
public static function loadOIDs(array $oids)
|
||||
{
|
||||
self::$reverseOIDs += $oids;
|
||||
self::$oids = array_flip(self::$reverseOIDs);
|
||||
@ -1324,7 +1320,7 @@ abstract class ASN1
|
||||
*
|
||||
* @param array $filters
|
||||
*/
|
||||
public static function setFilters($filters)
|
||||
public static function setFilters(array $filters)
|
||||
{
|
||||
self::$filters = $filters;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ class X509
|
||||
* @param int $format optional
|
||||
* @return string
|
||||
*/
|
||||
public function saveX509($cert, $format = self::FORMAT_PEM)
|
||||
public function saveX509(array $cert, $format = self::FORMAT_PEM)
|
||||
{
|
||||
if (!is_array($cert) || !isset($cert['tbsCertificate'])) {
|
||||
return false;
|
||||
@ -577,7 +577,7 @@ class X509
|
||||
* @param array $root (by reference)
|
||||
* @param string $path
|
||||
*/
|
||||
private function mapInExtensions(&$root, $path)
|
||||
private function mapInExtensions(array &$root, $path)
|
||||
{
|
||||
$extensions = &$this->subArrayUnchecked($root, $path);
|
||||
|
||||
@ -625,7 +625,7 @@ class X509
|
||||
* @param array $root (by reference)
|
||||
* @param string $path
|
||||
*/
|
||||
private function mapOutExtensions(&$root, $path)
|
||||
private function mapOutExtensions(array &$root, $path)
|
||||
{
|
||||
$extensions = &$this->subArray($root, $path, !empty($this->extensionValues));
|
||||
|
||||
@ -786,7 +786,7 @@ class X509
|
||||
* @param array $root (by reference)
|
||||
* @param string $path
|
||||
*/
|
||||
private function mapInDNs(&$root, $path)
|
||||
private function mapInDNs(array &$root, $path)
|
||||
{
|
||||
$dns = &$this->subArray($root, $path);
|
||||
|
||||
@ -814,7 +814,7 @@ class X509
|
||||
* @param array $root (by reference)
|
||||
* @param string $path
|
||||
*/
|
||||
private function mapOutDNs(&$root, $path)
|
||||
private function mapOutDNs(array &$root, $path)
|
||||
{
|
||||
$dns = &$this->subArray($root, $path);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user