Skip to content

Commit

Permalink
use new PHP 8 str_ functions (#53817)
Browse files Browse the repository at this point in the history
behavior is identical, but readability should be improved
  • Loading branch information
browner12 authored Dec 10, 2024
1 parent dfdc059 commit ce0e481
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Testing/DatabaseTruncation.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function withoutTablePrefix(ConnectionInterface $connection, string $t
{
$prefix = $connection->getTablePrefix();

return strpos($table, $prefix) === 0
return str_starts_with($table, $prefix)
? substr($table, strlen($prefix))
: $table;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Database/MySql/JoinLateralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function checkMySqlVersion()
{
$mySqlVersion = DB::select('select version()')[0]->{'version()'} ?? '';

if (strpos($mySqlVersion, 'Maria') !== false) {
if (str_contains($mySqlVersion, 'Maria')) {
$this->markTestSkipped('Lateral joins are not supported on MariaDB'.__CLASS__);
} elseif ((float) $mySqlVersion < '8.0.14') {
$this->markTestSkipped('Lateral joins are not supported on MySQL < 8.0.14'.__CLASS__);
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/MailSesTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testSend()
$arg['Destinations'] === ['me@example.com', 'you@example.com'] &&
$arg['ListManagementOptions'] === ['ContactListName' => 'TestList', 'TopicName' => 'TestTopic'] &&
$arg['Tags'] === [['Name' => 'FooTag', 'Value' => 'TagValue']] &&
strpos($arg['RawMessage']['Data'], 'Reply-To: Taylor Otwell <taylor@example.com>') !== false;
str_contains($arg['RawMessage']['Data'], 'Reply-To: Taylor Otwell <taylor@example.com>');
}))
->andReturn($sesResult);

Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/MailSesV2TransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testSend()
$arg['Destination']['ToAddresses'] === ['me@example.com', 'you@example.com'] &&
$arg['ListManagementOptions'] === ['ContactListName' => 'TestList', 'TopicName' => 'TestTopic'] &&
$arg['EmailTags'] === [['Name' => 'FooTag', 'Value' => 'TagValue']] &&
strpos($arg['Content']['Raw']['Data'], 'Reply-To: Taylor Otwell <taylor@example.com>') !== false;
str_contains($arg['Content']['Raw']['Data'], 'Reply-To: Taylor Otwell <taylor@example.com>');
}))
->andReturn($sesResult);

Expand Down

0 comments on commit ce0e481

Please sign in to comment.