Skip to content

Commit ff62d28

Browse files
Merge branch '5.3' into 5.4
* 5.3: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents 07e0671 + 633e4e8 commit ff62d28

6 files changed

+6
-6
lines changed

Address.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public static function fromString(string $string): self
136136
{
137137
trigger_deprecation('symfony/mime', '5.2', '"%s()" is deprecated, use "%s::create()" instead.', __METHOD__, __CLASS__);
138138

139-
if (false === strpos($string, '<')) {
139+
if (!str_contains($string, '<')) {
140140
return new self($string, '');
141141
}
142142

Crypto/SMime.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function getMessageHeaders(string $headerData): array
8383
}
8484

8585
// Handle headers that span multiple lines
86-
if (false === strpos($headerLine, ':')) {
86+
if (!str_contains($headerLine, ':')) {
8787
$headers[$currentHeaderName] .= ' '.trim($headerLine);
8888
continue;
8989
}

FileBinaryMimeTypeGuesser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function guessMimeType(string $path): ?string
7474
ob_start();
7575

7676
// need to use --mime instead of -i. see #6641
77-
passthru(sprintf($this->cmd, escapeshellarg((0 === strpos($path, '-') ? './' : '').$path)), $return);
77+
passthru(sprintf($this->cmd, escapeshellarg((str_starts_with($path, '-') ? './' : '').$path)), $return);
7878
if ($return > 0) {
7979
ob_end_clean();
8080

Tests/AbstractMimeTypeGuesserTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function testGuessWithNonReadablePath()
116116
touch($path);
117117
@chmod($path, 0333);
118118

119-
if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
119+
if (str_ends_with(sprintf('%o', fileperms($path)), '0333')) {
120120
$this->expectException(\InvalidArgumentException::class);
121121
$this->getGuesser()->guessMimeType($path);
122122
} else {

Tests/Crypto/SMimeSignerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private function assertMessageSignatureIsValid(Message $message, Message $origin
159159
$this->assertMessageHeaders($message, $originalMessage);
160160
$this->assertTrue(openssl_pkcs7_verify($messageFile, 0, $this->generateTmpFilename(), [$this->samplesDir.'ca.crt']), sprintf('Verification of the message %s failed. Internal error "%s".', $messageFile, openssl_error_string()));
161161

162-
if (false === strpos($messageString, 'enveloped-data')) {
162+
if (!str_contains($messageString, 'enveloped-data')) {
163163
// Tamper to ensure it actually verified
164164
file_put_contents($messageFile, str_replace('Content-Transfer-Encoding: ', 'Content-Transfer-Encoding: ', $messageString));
165165
$this->assertFalse(openssl_pkcs7_verify($messageFile, 0, $this->generateTmpFilename(), [$this->samplesDir.'ca.crt']), sprintf('Verification of the message failed. Internal error "%s".', openssl_error_string()));

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"symfony/deprecation-contracts": "^2.1",
2121
"symfony/polyfill-intl-idn": "^1.10",
2222
"symfony/polyfill-mbstring": "^1.0",
23-
"symfony/polyfill-php80": "^1.15"
23+
"symfony/polyfill-php80": "^1.16"
2424
},
2525
"require-dev": {
2626
"egulias/email-validator": "^2.1.10|^3.1",

0 commit comments

Comments
 (0)