Skip to content
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