Skip to content

Commit

Permalink
Backport type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jul 2, 2021
1 parent 1a2bdd5 commit 012c146
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Header/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function toArray(): array
/**
* @internal
*/
public function getHeaderBody($name)
public function getHeaderBody(string $name)
{
return $this->has($name) ? $this->get($name)->getBody() : null;
}
Expand Down Expand Up @@ -266,7 +266,7 @@ public function getHeaderParameter(string $name, string $parameter): ?string
/**
* @internal
*/
public function setHeaderParameter(string $name, string $parameter, $value): void
public function setHeaderParameter(string $name, string $parameter, ?string $value): void
{
if (!$this->has($name)) {
throw new LogicException(sprintf('Unable to set parameter "%s" on header "%s" as the header is not defined.', $parameter, $name));
Expand Down
2 changes: 0 additions & 2 deletions MimeTypeGuesserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public function isGuesserSupported(): bool;
/**
* Guesses the MIME type of the file with the given path.
*
* @param string $path The path to the file
*
* @return string|null The MIME type or null, if none could be guessed
*
* @throws \LogicException If the guesser is not supported
Expand Down
6 changes: 4 additions & 2 deletions Part/DataPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ public function __construct($body, string $filename = null, string $contentType

parent::__construct($body, null, $subtype, $encoding);

$this->filename = $filename;
$this->setName($filename);
if (null !== $filename) {
$this->filename = $filename;
$this->setName($filename);
}
$this->setDisposition('attachment');
}

Expand Down

0 comments on commit 012c146

Please sign in to comment.