Skip to content

Commit f0642ef

Browse files
Add types to private and internal properties
1 parent 446f330 commit f0642ef

File tree

9 files changed

+24
-33
lines changed

9 files changed

+24
-33
lines changed

Part/AbstractMultipartPart.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
*/
1919
abstract class AbstractMultipartPart extends AbstractPart
2020
{
21-
private $boundary;
22-
private $parts = [];
21+
private ?string $boundary = null;
22+
private array $parts = [];
2323

2424
public function __construct(AbstractPart ...$parts)
2525
{

Part/DataPart.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@
2020
class DataPart extends TextPart
2121
{
2222
/** @internal */
23-
protected $_parent;
23+
protected array $_parent;
2424

25-
private $filename;
26-
private $mediaType;
27-
private $cid;
25+
private ?string $filename = null;
26+
private string $mediaType;
27+
private ?string $cid = null;
2828

2929
/**
3030
* @param resource|string|File $body Use a File instance to defer loading the file until rendering
3131
*/
3232
public function __construct($body, string $filename = null, string $contentType = null, string $encoding = null)
3333
{
34-
unset($this->_parent);
35-
3634
if ($body instanceof File && !$filename) {
3735
$filename = $body->getFilename();
3836
}

Part/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class File
2020
{
21-
private static $mimeTypes;
21+
private static MimeTypes $mimeTypes;
2222

2323
public function __construct(
2424
private string $path,

Part/MessagePart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class MessagePart extends DataPart
2323
{
24-
private $message;
24+
private RawMessage $message;
2525

2626
public function __construct(RawMessage $message)
2727
{

Part/Multipart/FormDataPart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
final class FormDataPart extends AbstractMultipartPart
2525
{
26-
private $fields = [];
26+
private array $fields = [];
2727

2828
/**
2929
* @param array<string|array|DataPart> $fields

Part/Multipart/RelatedPart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
final class RelatedPart extends AbstractMultipartPart
2121
{
22-
private $mainPart;
22+
private AbstractPart $mainPart;
2323

2424
public function __construct(AbstractPart $mainPart, AbstractPart $part, AbstractPart ...$parts)
2525
{

Part/SMimePart.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@
1919
class SMimePart extends AbstractPart
2020
{
2121
/** @internal */
22-
protected $_headers;
22+
protected Headers $_headers;
2323

24-
private $body;
25-
private $type;
26-
private $subtype;
27-
private $parameters;
24+
private iterable|string $body;
25+
private string $type;
26+
private string $subtype;
27+
private array $parameters;
2828

2929
public function __construct(iterable|string $body, string $type, string $subtype, array $parameters)
3030
{
31-
unset($this->_headers);
32-
3331
parent::__construct();
3432

3533
$this->body = $body;

Part/TextPart.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,23 @@
2424
class TextPart extends AbstractPart
2525
{
2626
/** @internal */
27-
protected $_headers;
27+
protected Headers $_headers;
2828

29-
private static $encoders = [];
29+
private static array $encoders = [];
3030

3131
private $body;
32-
private $charset;
33-
private $subtype;
34-
/**
35-
* @var ?string
36-
*/
37-
private $disposition;
38-
private $name;
39-
private $encoding;
40-
private $seekable;
32+
private ?string $charset;
33+
private string $subtype;
34+
private ?string $disposition = null;
35+
private ?string $name = null;
36+
private string $encoding;
37+
private ?bool $seekable = null;
4138

4239
/**
4340
* @param resource|string|File $body Use a File instance to defer loading the file until rendering
4441
*/
4542
public function __construct($body, ?string $charset = 'utf-8', string $subtype = 'plain', string $encoding = null)
4643
{
47-
unset($this->_headers);
48-
4944
parent::__construct();
5045

5146
if (!\is_string($body) && !\is_resource($body) && !$body instanceof File) {

RawMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class RawMessage
2020
{
21-
private $message;
21+
private iterable|string|null $message = null;
2222

2323
public function __construct(iterable|string $message)
2424
{

0 commit comments

Comments
 (0)