Skip to content

Commit

Permalink
bug #30677 Fix type hints for email attachments (fabpot)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.3-dev branch.

Discussion
----------

Fix type hints for email attachments

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

`createDataPart()` must return a `DataPart` instance, so `attachPart()` must only accept `DataPart` instances and `getAttachments()` is guaranteed to return an array of `DataPart` instances.

Commits
-------

8059c50 fixed type hints for email attachments
  • Loading branch information
fabpot committed Mar 25, 2019
2 parents 041f60f + 8059c50 commit cb1ab07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Mime/Email.php
Expand Up @@ -372,15 +372,15 @@ public function embedFromPath(string $path, string $name = null, string $content
/**
* @return $this
*/
public function attachPart(AbstractPart $part)
public function attachPart(DataPart $part)
{
$this->attachments[] = ['part' => $part];

return $this;
}

/**
* @return AbstractPart[]
* @return DataPart[]
*/
public function getAttachments(): array
{
Expand Down

0 comments on commit cb1ab07

Please sign in to comment.