1 | <?php |
||
22 | final class ZendMail extends AbstractTransport |
||
23 | { |
||
24 | /** |
||
25 | * The mailer used to send messages. |
||
26 | * |
||
27 | * @var TransportInterface |
||
28 | */ |
||
29 | private $transport; |
||
30 | |||
31 | /** |
||
32 | * Initializes a new instance of this class. |
||
33 | * |
||
34 | * @param TransportInterface $transport |
||
35 | */ |
||
36 | public function __construct(TransportInterface $transport) |
||
40 | |||
41 | /** |
||
42 | * Sends a message over the transport. |
||
43 | * |
||
44 | * @param array $recipients A list with all recipients that should receive the message. |
||
45 | * @param Message $message The message to send. |
||
46 | * @param string $subject The subject for this message. |
||
47 | * @param string $text The plain text template. |
||
48 | * @param null|string $html The HTML template. |
||
49 | * @return void |
||
50 | */ |
||
51 | public function send(array $recipients, Message $message, string $subject, string $text, ?string $html): void |
||
58 | |||
59 | /** |
||
60 | * Sends a message to the given recipient. |
||
61 | * |
||
62 | * @param RecipientInterface $recipient The recipient that should receive the message. |
||
63 | * @param Message $message The message that should be sent. |
||
64 | * @param string $subject The subject of the message. |
||
65 | * @param string $text The plain text message. |
||
66 | * @param null|string $html An optional HTML version of the message. |
||
67 | */ |
||
68 | private function sendToRecipient( |
||
105 | } |
||
106 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: