Skip to content

Commit 61015d7

Browse files
Merge branch '4.4' into 5.2
* 4.4: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents 583e879 + 68cd209 commit 61015d7

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

Test/TransportFactoryTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testCreate(Dsn $dsn, TransportInterface $transport)
6969
$factory = $this->getFactory();
7070

7171
$this->assertEquals($transport, $factory->create($dsn));
72-
if (false !== strpos('smtp', $dsn->getScheme())) {
72+
if (str_contains('smtp', $dsn->getScheme())) {
7373
$this->assertStringMatchesFormat($dsn->getScheme().'://%S'.$dsn->getHost().'%S', (string) $transport);
7474
}
7575
}

Tests/Transport/Smtp/SmtpTransportTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ public function write(string $bytes, $debug = true): void
166166

167167
$this->commands[] = $bytes;
168168

169-
if (0 === strpos($bytes, 'DATA')) {
169+
if (str_starts_with($bytes, 'DATA')) {
170170
$this->nextResponse = '354 Enter message, ending with "." on a line by itself';
171-
} elseif (0 === strpos($bytes, 'QUIT')) {
171+
} elseif (str_starts_with($bytes, 'QUIT')) {
172172
$this->nextResponse = '221 Goodbye';
173173
} else {
174174
$this->nextResponse = '250 OK';

Transport/SendmailTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ public function __construct(string $command = null, EventDispatcherInterface $di
5555
parent::__construct($dispatcher, $logger);
5656

5757
if (null !== $command) {
58-
if (false === strpos($command, ' -bs') && false === strpos($command, ' -t')) {
58+
if (!str_contains($command, ' -bs') && !str_contains($command, ' -t')) {
5959
throw new \InvalidArgumentException(sprintf('Unsupported sendmail command flags "%s"; must be one of "-bs" or "-t" but can include additional flags.', $command));
6060
}
6161

6262
$this->command = $command;
6363
}
6464

6565
$this->stream = new ProcessStream();
66-
if (false !== strpos($this->command, ' -bs')) {
66+
if (str_contains($this->command, ' -bs')) {
6767
$this->stream->setCommand($this->command);
6868
$this->transport = new SmtpTransport($this->stream, $dispatcher, $logger);
6969
}
@@ -92,13 +92,13 @@ protected function doSend(SentMessage $message): void
9292
$this->getLogger()->debug(sprintf('Email transport "%s" starting', __CLASS__));
9393

9494
$command = $this->command;
95-
if (false === strpos($command, ' -f')) {
95+
if (!str_contains($command, ' -f')) {
9696
$command .= ' -f'.escapeshellarg($message->getEnvelope()->getSender()->getEncodedAddress());
9797
}
9898

9999
$chunks = AbstractStream::replace("\r\n", "\n", $message->toIterable());
100100

101-
if (false === strpos($command, ' -i') && false === strpos($command, ' -oi')) {
101+
if (!str_contains($command, ' -i') && !str_contains($command, ' -oi')) {
102102
$chunks = AbstractStream::replace("\n.", "\n..", $chunks);
103103
}
104104

Transport/Smtp/Stream/AbstractStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public static function replace(string $from, string $to, iterable $chunks): \Gen
114114
continue;
115115
}
116116

117-
if (false !== strpos($chunk, $from)) {
117+
if (str_contains($chunk, $from)) {
118118
$chunk = explode($from, $chunk);
119119
$carry = array_pop($chunk);
120120

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"psr/log": "^1|^2|^3",
2222
"symfony/event-dispatcher": "^4.4|^5.0",
2323
"symfony/mime": "^5.2.6",
24-
"symfony/polyfill-php80": "^1.15",
24+
"symfony/polyfill-php80": "^1.16",
2525
"symfony/service-contracts": "^1.1|^2"
2626
},
2727
"require-dev": {

0 commit comments

Comments
 (0)