Skip to content

Commit

Permalink
Mark methods of abstract classes final where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk committed Oct 3, 2017
1 parent 9de2ff5 commit 8c862d0
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 39 deletions.
30 changes: 15 additions & 15 deletions src/Message/AbstractMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abstract class AbstractMessage extends AbstractPart
*
* @return string
*/
public function getId(): string
final public function getId(): string
{
return $this->getHeaders()->get('message_id');
}
Expand All @@ -27,7 +27,7 @@ public function getId(): string
*
* @return EmailAddress
*/
public function getFrom(): EmailAddress
final public function getFrom(): EmailAddress
{
return $this->getHeaders()->get('from');
}
Expand All @@ -37,7 +37,7 @@ public function getFrom(): EmailAddress
*
* @return EmailAddress[] Empty array in case message has no To: recipients
*/
public function getTo(): array
final public function getTo(): array
{
return $this->getHeaders()->get('to') ?: [];
}
Expand All @@ -47,7 +47,7 @@ public function getTo(): array
*
* @return EmailAddress[] Empty array in case message has no CC: recipients
*/
public function getCc(): array
final public function getCc(): array
{
return $this->getHeaders()->get('cc') ?: [];
}
Expand All @@ -57,7 +57,7 @@ public function getCc(): array
*
* @return EmailAddress[] Empty array in case message has no BCC: recipients
*/
public function getBcc(): array
final public function getBcc(): array
{
return $this->getHeaders()->get('bcc') ?: [];
}
Expand All @@ -67,7 +67,7 @@ public function getBcc(): array
*
* @return EmailAddress[] Empty array in case message has no Reply-To: recipients
*/
public function getReplyTo(): array
final public function getReplyTo(): array
{
return $this->getHeaders()->get('reply_to') ?: [];
}
Expand All @@ -77,7 +77,7 @@ public function getReplyTo(): array
*
* @return EmailAddress[] Empty array in case message has no Sender: recipients
*/
public function getSender(): array
final public function getSender(): array
{
return $this->getHeaders()->get('sender') ?: [];
}
Expand All @@ -87,7 +87,7 @@ public function getSender(): array
*
* @return EmailAddress[] Empty array in case message has no Return-Path: recipients
*/
public function getReturnPath(): array
final public function getReturnPath(): array
{
return $this->getHeaders()->get('return_path') ?: [];
}
Expand All @@ -97,7 +97,7 @@ public function getReturnPath(): array
*
* @return \DateTimeImmutable
*/
public function getDate(): \DateTimeImmutable
final public function getDate(): \DateTimeImmutable
{
return $this->getHeaders()->get('date');
}
Expand All @@ -107,7 +107,7 @@ public function getDate(): \DateTimeImmutable
*
* @return int
*/
public function getSize()
final public function getSize()
{
return $this->getHeaders()->get('size');
}
Expand All @@ -117,7 +117,7 @@ public function getSize()
*
* @return string
*/
public function getSubject()
final public function getSubject()
{
return $this->getHeaders()->get('subject');
}
Expand All @@ -127,7 +127,7 @@ public function getSubject()
*
* @return string | null Null if message has no HTML message part
*/
public function getBodyHtml()
final public function getBodyHtml()
{
$iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $part) {
Expand All @@ -149,7 +149,7 @@ public function getBodyHtml()
*
* @return string
*/
public function getBodyText()
final public function getBodyText()
{
$iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $part) {
Expand All @@ -171,7 +171,7 @@ public function getBodyText()
*
* @return AttachmentInterface[]
*/
public function getAttachments(): array
final public function getAttachments(): array
{
if (null === $this->attachments) {
$this->attachments = [];
Expand All @@ -197,7 +197,7 @@ public function getAttachments(): array
*
* @return bool
*/
public function hasAttachments(): bool
final public function hasAttachments(): bool
{
return \count($this->getAttachments()) > 0;
}
Expand Down
38 changes: 19 additions & 19 deletions src/Message/AbstractPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,42 +94,42 @@ public function __construct(
*
* @return int
*/
public function getNumber(): int
final public function getNumber(): int
{
return $this->messageNumber;
}

public function getCharset(): string
final public function getCharset(): string
{
return $this->parameters->get('charset');
}

public function getType()
final public function getType()
{
return $this->type;
}

public function getSubtype()
final public function getSubtype()
{
return $this->subtype;
}

public function getEncoding()
final public function getEncoding()
{
return $this->encoding;
}

public function getBytes()
final public function getBytes()
{
return $this->bytes;
}

public function getLines()
final public function getLines()
{
return $this->lines;
}

public function getParameters(): Parameters
final public function getParameters(): Parameters
{
return $this->parameters;
}
Expand All @@ -153,7 +153,7 @@ public function getContent(): string
*
* @return string
*/
public function getDecodedContent(): string
final public function getDecodedContent(): string
{
if (null === $this->decodedContent) {
$content = $this->getContent();
Expand All @@ -175,7 +175,7 @@ public function getDecodedContent(): string
return $this->decodedContent;
}

public function getStructure(): \stdClass
final public function getStructure(): \stdClass
{
return $this->structure;
}
Expand Down Expand Up @@ -232,47 +232,47 @@ final protected function parseStructure(\stdClass $structure)
*
* @return PartInterface[]
*/
public function getParts(): array
final public function getParts(): array
{
return $this->parts;
}

public function current()
final public function current()
{
return $this->parts[$this->key];
}

public function getChildren()
final public function getChildren()
{
return $this->current();
}

public function hasChildren()
final public function hasChildren()
{
return \count($this->parts) > 0;
}

public function key()
final public function key()
{
return $this->key;
}

public function next()
final public function next()
{
++$this->key;
}

public function rewind()
final public function rewind()
{
$this->key = 0;
}

public function valid()
final public function valid()
{
return isset($this->parts[$this->key]);
}

public function getDisposition()
final public function getDisposition()
{
return $this->disposition;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @covers \Ddeboer\Imap\Connection
* @covers \Ddeboer\Imap\ImapResource
*/
class ConnectionTest extends AbstractTest
final class ConnectionTest extends AbstractTest
{
public function testValidResourceStream()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/MailboxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @covers \Ddeboer\Imap\Exception\AbstractException
* @covers \Ddeboer\Imap\Mailbox
*/
class MailboxTest extends AbstractTest
final class MailboxTest extends AbstractTest
{
/**
* @var Mailbox
Expand Down
2 changes: 1 addition & 1 deletion tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @covers \Ddeboer\Imap\Message\Part
* @covers \Ddeboer\Imap\Message\Transcoder
*/
class MessageTest extends AbstractTest
final class MessageTest extends AbstractTest
{
/**
* @var \Ddeboer\Imap\Mailbox
Expand Down
2 changes: 1 addition & 1 deletion tests/Search/Date/AbstractDateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* @covers \Ddeboer\Imap\Search\AbstractDate
*/
class AbstractDateTest extends AbstractTest
final class AbstractDateTest extends AbstractTest
{
protected function setUp()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* @covers \Ddeboer\Imap\Server
*/
class ServerTest extends AbstractTest
final class ServerTest extends AbstractTest
{
public function testValidConnection()
{
Expand Down

0 comments on commit 8c862d0

Please sign in to comment.