Skip to content

Commit 7bcc79b

Browse files
Merge branch '4.4' into 5.2
* 4.4: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents 1eb6949 + 28249b0 commit 7bcc79b

File tree

8 files changed

+9
-9
lines changed

8 files changed

+9
-9
lines changed

Command/ConsumeMessagesCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ private function convertToBytes(string $memoryLimit): int
205205
{
206206
$memoryLimit = strtolower($memoryLimit);
207207
$max = ltrim($memoryLimit, '+');
208-
if (0 === strpos($max, '0x')) {
208+
if (str_starts_with($max, '0x')) {
209209
$max = \intval($max, 16);
210-
} elseif (0 === strpos($max, '0')) {
210+
} elseif (str_starts_with($max, '0')) {
211211
$max = \intval($max, 8);
212212
} else {
213213
$max = (int) $max;

Handler/HandlerDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private function callableName(callable $handler): string
6565

6666
if ($handler instanceof \Closure) {
6767
$r = new \ReflectionFunction($handler);
68-
if (false !== strpos($r->name, '{closure}')) {
68+
if (str_contains($r->name, '{closure}')) {
6969
return 'Closure';
7070
}
7171
if ($class = $r->getClosureScopeClass()) {

TraceableMessageBus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private function getCaller(): array
8686
$line = $trace[$i]['line'];
8787

8888
while (++$i < 8) {
89-
if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && 0 !== strpos($trace[$i]['function'], 'call_user_func')) {
89+
if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && !str_starts_with($trace[$i]['function'], 'call_user_func')) {
9090
$file = $trace[$i]['file'];
9191
$line = $trace[$i]['line'];
9292

Transport/InMemoryTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function createTransport(string $dsn, array $options, SerializerInterface
3131

3232
public function supports(string $dsn, array $options): bool
3333
{
34-
return 0 === strpos($dsn, 'in-memory://');
34+
return str_starts_with($dsn, 'in-memory://');
3535
}
3636

3737
public function reset()

Transport/Serialization/PhpSerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function decode(array $encodedEnvelope): Envelope
2929
throw new MessageDecodingFailedException('Encoded envelope should have at least a "body".');
3030
}
3131

32-
if (false === strpos($encodedEnvelope['body'], '}', -1)) {
32+
if (!str_contains($encodedEnvelope['body'], '}', -1)) {
3333
$encodedEnvelope['body'] = base64_decode($encodedEnvelope['body']);
3434
}
3535

Transport/Serialization/Serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private function decodeStamps(array $encodedEnvelope): array
112112
{
113113
$stamps = [];
114114
foreach ($encodedEnvelope['headers'] as $name => $value) {
115-
if (0 !== strpos($name, self::STAMP_HEADER_PREFIX)) {
115+
if (!str_starts_with($name, self::STAMP_HEADER_PREFIX)) {
116116
continue;
117117
}
118118

Transport/Sync/SyncTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ public function createTransport(string $dsn, array $options, SerializerInterface
3535

3636
public function supports(string $dsn, array $options): bool
3737
{
38-
return 0 === strpos($dsn, 'sync://');
38+
return str_starts_with($dsn, 'sync://');
3939
}
4040
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"symfony/amqp-messenger": "^5.1",
2222
"symfony/deprecation-contracts": "^2.1",
2323
"symfony/doctrine-messenger": "^5.1",
24-
"symfony/polyfill-php80": "^1.15",
24+
"symfony/polyfill-php80": "^1.16",
2525
"symfony/redis-messenger": "^5.1"
2626
},
2727
"require-dev": {

0 commit comments

Comments
 (0)