Skip to content

[Mime] Remove deprecated code #41364

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
May 23, 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
18 changes: 0 additions & 18 deletions src/Symfony/Component/Mime/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,4 @@ public static function createArray(array $addresses): array

return $addrs;
}

/**
* @deprecated since Symfony 5.2, use "create()" instead.
*/
public static function fromString(string $string): self
{
trigger_deprecation('symfony/mime', '5.2', '"%s()" is deprecated, use "%s::create()" instead.', __METHOD__, __CLASS__);

if (false === strpos($string, '<')) {
return new self($string, '');
}

if (!preg_match(self::FROM_STRING_PATTERN, $string, $matches)) {
throw new InvalidArgumentException(sprintf('Could not parse "%s" to a "%s" instance.', $string, self::class));
}

return new self($matches['addrSpec'], trim($matches['displayName'], ' \'"'));
}
}
5 changes: 5 additions & 0 deletions src/Symfony/Component/Mime/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

6.0
---

* Remove `Address::fromString()`, use `Address::create()` instead

5.2.0
-----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,14 @@
*/
class AddMimeTypeGuesserPass implements CompilerPassInterface
{
private $mimeTypesService;
private $mimeTypeGuesserTag;

public function __construct(string $mimeTypesService = 'mime_types', string $mimeTypeGuesserTag = 'mime.mime_type_guesser')
{
if (0 < \func_num_args()) {
trigger_deprecation('symfony/mime', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
}

$this->mimeTypesService = $mimeTypesService;
$this->mimeTypeGuesserTag = $mimeTypeGuesserTag;
}

/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if ($container->has($this->mimeTypesService)) {
$definition = $container->findDefinition($this->mimeTypesService);
foreach ($container->findTaggedServiceIds($this->mimeTypeGuesserTag, true) as $id => $attributes) {
if ($container->has('mime_types')) {
$definition = $container->findDefinition('mime_types');
foreach ($container->findTaggedServiceIds('mime.mime_type_guesser', true) as $id => $attributes) {
$definition->addMethodCall('registerGuesser', [new Reference($id)]);
}
}
Expand Down