package and depencies

This commit is contained in:
RafficMohammed
2023-01-08 02:57:24 +05:30
parent d5332eb421
commit 1d54b8bc7f
4309 changed files with 193331 additions and 172289 deletions

View File

@@ -18,7 +18,7 @@ namespace Symfony\Component\Mime\Crypto;
*/
final class DkimOptions
{
private $options = [];
private array $options = [];
public function toArray(): array
{
@@ -28,7 +28,7 @@ final class DkimOptions
/**
* @return $this
*/
public function algorithm(string $algo): self
public function algorithm(string $algo): static
{
$this->options['algorithm'] = $algo;
@@ -38,7 +38,7 @@ final class DkimOptions
/**
* @return $this
*/
public function signatureExpirationDelay(int $show): self
public function signatureExpirationDelay(int $show): static
{
$this->options['signature_expiration_delay'] = $show;
@@ -48,7 +48,7 @@ final class DkimOptions
/**
* @return $this
*/
public function bodyMaxLength(int $max): self
public function bodyMaxLength(int $max): static
{
$this->options['body_max_length'] = $max;
@@ -58,7 +58,7 @@ final class DkimOptions
/**
* @return $this
*/
public function bodyShowLength(bool $show): self
public function bodyShowLength(bool $show): static
{
$this->options['body_show_length'] = $show;
@@ -68,7 +68,7 @@ final class DkimOptions
/**
* @return $this
*/
public function headerCanon(string $canon): self
public function headerCanon(string $canon): static
{
$this->options['header_canon'] = $canon;
@@ -78,7 +78,7 @@ final class DkimOptions
/**
* @return $this
*/
public function bodyCanon(string $canon): self
public function bodyCanon(string $canon): static
{
$this->options['body_canon'] = $canon;
@@ -88,7 +88,7 @@ final class DkimOptions
/**
* @return $this
*/
public function headersToIgnore(array $headers): self
public function headersToIgnore(array $headers): static
{
$this->options['headers_to_ignore'] = $headers;

View File

@@ -30,10 +30,10 @@ final class DkimSigner
public const ALGO_SHA256 = 'rsa-sha256';
public const ALGO_ED25519 = 'ed25519-sha256'; // RFC 8463
private $key;
private $domainName;
private $selector;
private $defaultOptions;
private \OpenSSLAsymmetricKey $key;
private string $domainName;
private string $selector;
private array $defaultOptions;
/**
* @param string $pk The private key as a string or the path to the file containing the private key, should be prefixed with file:// (in PEM format)
@@ -44,10 +44,7 @@ final class DkimSigner
if (!\extension_loaded('openssl')) {
throw new \LogicException('PHP extension "openssl" is required to use DKIM.');
}
if (!$this->key = openssl_pkey_get_private($pk, $passphrase)) {
throw new InvalidArgumentException('Unable to load DKIM private key: '.openssl_error_string());
}
$this->key = openssl_pkey_get_private($pk, $passphrase) ?: throw new InvalidArgumentException('Unable to load DKIM private key: '.openssl_error_string());
$this->domainName = $domainName;
$this->selector = $selector;
$this->defaultOptions = $defaultOptions + [

View File

@@ -19,21 +19,21 @@ use Symfony\Component\Mime\Message;
*/
final class SMimeEncrypter extends SMime
{
private $certs;
private $cipher;
private string|array $certs;
private int $cipher;
/**
* @param string|string[] $certificate The path (or array of paths) of the file(s) containing the X.509 certificate(s)
* @param int|null $cipher A set of algorithms used to encrypt the message. Must be one of these PHP constants: https://www.php.net/manual/en/openssl.ciphers.php
*/
public function __construct($certificate, int $cipher = null)
public function __construct(string|array $certificate, int $cipher = null)
{
if (!\extension_loaded('openssl')) {
throw new \LogicException('PHP extension "openssl" is required to use SMime.');
}
if (\is_array($certificate)) {
$this->certs = array_map([$this, 'normalizeFilePath'], $certificate);
$this->certs = array_map($this->normalizeFilePath(...), $certificate);
} else {
$this->certs = $this->normalizeFilePath($certificate);
}

View File

@@ -19,10 +19,10 @@ use Symfony\Component\Mime\Message;
*/
final class SMimeSigner extends SMime
{
private $signCertificate;
private $signPrivateKey;
private $signOptions;
private $extraCerts;
private string $signCertificate;
private string|array $signPrivateKey;
private int $signOptions;
private ?string $extraCerts;
/**
* @param string $certificate The path of the file containing the signing certificate (in PEM format)