Skip to content

Commit c1dbce1

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent f2b8160 commit c1dbce1

11 files changed

+16
-16
lines changed

Diff for: Crypto/SMimeEncrypter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class SMimeEncrypter extends SMime
2626
* @param string|string[] $certificate The path (or array of paths) of the file(s) containing the X.509 certificate(s)
2727
* @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
2828
*/
29-
public function __construct($certificate, int $cipher = null)
29+
public function __construct($certificate, ?int $cipher = null)
3030
{
3131
if (!\extension_loaded('openssl')) {
3232
throw new \LogicException('PHP extension "openssl" is required to use SMime.');

Diff for: Crypto/SMimeSigner.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class SMimeSigner extends SMime
3131
* @param string|null $extraCerts The path of the file containing intermediate certificates (in PEM format) needed by the signing certificate
3232
* @param int|null $signOptions Bitwise operator options for openssl_pkcs7_sign() (@see https://secure.php.net/manual/en/openssl.pkcs7.flags.php)
3333
*/
34-
public function __construct(string $certificate, string $privateKey, string $privateKeyPassphrase = null, string $extraCerts = null, int $signOptions = null)
34+
public function __construct(string $certificate, string $privateKey, ?string $privateKeyPassphrase = null, ?string $extraCerts = null, ?int $signOptions = null)
3535
{
3636
if (!\extension_loaded('openssl')) {
3737
throw new \LogicException('PHP extension "openssl" is required to use SMime.');

Diff for: Email.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public function getHtmlCharset(): ?string
346346
*
347347
* @return $this
348348
*/
349-
public function attach($body, string $name = null, string $contentType = null)
349+
public function attach($body, ?string $name = null, ?string $contentType = null)
350350
{
351351
if (!\is_string($body) && !\is_resource($body)) {
352352
throw new \TypeError(sprintf('The body must be a string or a resource (got "%s").', get_debug_type($body)));
@@ -361,7 +361,7 @@ public function attach($body, string $name = null, string $contentType = null)
361361
/**
362362
* @return $this
363363
*/
364-
public function attachFromPath(string $path, string $name = null, string $contentType = null)
364+
public function attachFromPath(string $path, ?string $name = null, ?string $contentType = null)
365365
{
366366
$this->cachedBody = null;
367367
$this->attachments[] = ['path' => $path, 'name' => $name, 'content-type' => $contentType, 'inline' => false];
@@ -374,7 +374,7 @@ public function attachFromPath(string $path, string $name = null, string $conten
374374
*
375375
* @return $this
376376
*/
377-
public function embed($body, string $name = null, string $contentType = null)
377+
public function embed($body, ?string $name = null, ?string $contentType = null)
378378
{
379379
if (!\is_string($body) && !\is_resource($body)) {
380380
throw new \TypeError(sprintf('The body must be a string or a resource (got "%s").', get_debug_type($body)));
@@ -389,7 +389,7 @@ public function embed($body, string $name = null, string $contentType = null)
389389
/**
390390
* @return $this
391391
*/
392-
public function embedFromPath(string $path, string $name = null, string $contentType = null)
392+
public function embedFromPath(string $path, ?string $name = null, ?string $contentType = null)
393393
{
394394
$this->cachedBody = null;
395395
$this->attachments[] = ['path' => $path, 'name' => $name, 'content-type' => $contentType, 'inline' => true];

Diff for: FileinfoMimeTypeGuesser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
2828
*
2929
* @see http://www.php.net/manual/en/function.finfo-open.php
3030
*/
31-
public function __construct(string $magicFile = null)
31+
public function __construct(?string $magicFile = null)
3232
{
3333
$this->magicFile = $magicFile;
3434
}

Diff for: Header/AbstractHeader.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ protected function generateTokenLines(string $token): array
231231
/**
232232
* Generate a list of all tokens in the final header.
233233
*/
234-
protected function toTokens(string $string = null): array
234+
protected function toTokens(?string $string = null): array
235235
{
236236
if (null === $string) {
237237
$string = $this->getBodyAsString();

Diff for: Header/Headers.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function get(string $name): ?HeaderInterface
190190
return array_shift($values);
191191
}
192192

193-
public function all(string $name = null): iterable
193+
public function all(?string $name = null): iterable
194194
{
195195
if (null === $name) {
196196
foreach ($this->headers as $name => $collection) {

Diff for: Header/ParameterizedHeader.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function getBodyAsString(): string
8585
* This doesn't need to be overridden in theory, but it is for implementation
8686
* reasons to prevent potential breakage of attributes.
8787
*/
88-
protected function toTokens(string $string = null): array
88+
protected function toTokens(?string $string = null): array
8989
{
9090
$tokens = parent::toTokens(parent::getBodyAsString());
9191

Diff for: Message.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Message extends RawMessage
2424
private $headers;
2525
private $body;
2626

27-
public function __construct(Headers $headers = null, AbstractPart $body = null)
27+
public function __construct(?Headers $headers = null, ?AbstractPart $body = null)
2828
{
2929
$this->headers = $headers ? clone $headers : new Headers();
3030
$this->body = $body;
@@ -42,7 +42,7 @@ public function __clone()
4242
/**
4343
* @return $this
4444
*/
45-
public function setBody(AbstractPart $body = null)
45+
public function setBody(?AbstractPart $body = null)
4646
{
4747
$this->body = $body;
4848

Diff for: Part/DataPart.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DataPart extends TextPart
3333
/**
3434
* @param resource|string $body
3535
*/
36-
public function __construct($body, string $filename = null, string $contentType = null, string $encoding = null)
36+
public function __construct($body, ?string $filename = null, ?string $contentType = null, ?string $encoding = null)
3737
{
3838
unset($this->_parent);
3939

@@ -51,7 +51,7 @@ public function __construct($body, string $filename = null, string $contentType
5151
$this->setDisposition('attachment');
5252
}
5353

54-
public static function fromPath(string $path, string $name = null, string $contentType = null): self
54+
public static function fromPath(string $path, ?string $name = null, ?string $contentType = null): self
5555
{
5656
if (null === $contentType) {
5757
$ext = strtolower(substr($path, strrpos($path, '.') + 1));

Diff for: Part/TextPart.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TextPart extends AbstractPart
4242
/**
4343
* @param resource|string $body
4444
*/
45-
public function __construct($body, ?string $charset = 'utf-8', string $subtype = 'plain', string $encoding = null)
45+
public function __construct($body, ?string $charset = 'utf-8', string $subtype = 'plain', ?string $encoding = null)
4646
{
4747
unset($this->_headers);
4848

Diff for: Test/Constraint/EmailAttachmentCount.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class EmailAttachmentCount extends Constraint
2020
private $expectedValue;
2121
private $transport;
2222

23-
public function __construct(int $expectedValue, string $transport = null)
23+
public function __construct(int $expectedValue, ?string $transport = null)
2424
{
2525
$this->expectedValue = $expectedValue;
2626
$this->transport = $transport;

0 commit comments

Comments
 (0)