Skip to content

[Mime] Remove @internal from Headers methods #40576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UPGRADE-5.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ Messenger
* Deprecated the `prefetch_count` parameter in the AMQP bridge, it has no effect and will be removed in Symfony 6.0
* Deprecated the use of TLS option for Redis Bridge, use `rediss://127.0.0.1` instead of `redis://127.0.0.1?tls=1`

Mime
----

* Remove the internal annotation from the `getHeaderBody()` and `getHeaderParameter()` methods of the `Headers` class.

Notifier
--------

Expand Down
6 changes: 0 additions & 6 deletions src/Symfony/Component/Mime/Header/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,6 @@ public function toArray(): array
return $arr;
}

/**
* @internal
*/
public function getHeaderBody($name)
{
return $this->has($name) ? $this->get($name)->getBody() : null;
Expand All @@ -274,9 +271,6 @@ public function setHeaderBody(string $type, string $name, $body): void
}
}

/**
* @internal
*/
public function getHeaderParameter(string $name, string $parameter): ?string
{
if (!$this->has($name)) {
Expand Down
35 changes: 35 additions & 0 deletions src/Symfony/Component/Mime/Tests/Header/HeadersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,39 @@ public function testToArray()
"Foo: =?utf-8?Q?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa?=\r\n =?utf-8?Q?aaaa?=",
], $headers->toArray());
}

public function testHeaderBody()
{
$headers = new Headers();
$this->assertNull($headers->getHeaderBody('Content-Type'));
$headers->setHeaderBody('Text', 'Content-Type', 'type');
$this->assertSame('type', $headers->getHeaderBody('Content-Type'));
}

public function testHeaderParameter()
{
$headers = new Headers();
$this->assertNull($headers->getHeaderParameter('Content-Disposition', 'name'));

$headers->addParameterizedHeader('Content-Disposition', 'name');
$headers->setHeaderParameter('Content-Disposition', 'name', 'foo');
$this->assertSame('foo', $headers->getHeaderParameter('Content-Disposition', 'name'));
}

public function testHeaderParameterNotDefined()
{
$headers = new Headers();

$this->expectException(\LogicException::class);
$headers->setHeaderParameter('Content-Disposition', 'name', 'foo');
}

public function testSetHeaderParameterNotParameterized()
{
$headers = new Headers();
$headers->addTextHeader('Content-Disposition', 'name');

$this->expectException(\LogicException::class);
$headers->setHeaderParameter('Content-Disposition', 'name', 'foo');
}
}