1
0
mirror of https://github.com/flarum/core.git synced 2025-08-04 15:37:51 +02:00

chore: use str_contains (#3841)

This commit is contained in:
Ngô Quốc Đạt
2023-09-15 03:05:15 +07:00
committed by GitHub
parent ee34217b15
commit be9eb16d7d
4 changed files with 6 additions and 6 deletions

View File

@@ -47,7 +47,7 @@ class UnparsePostMentions
$attributes['displayname'] = $this->translator->trans('core.lib.username.deleted_text');
}
if (strpos($attributes['displayname'], '"#') !== false) {
if (str_contains($attributes['displayname'], '"#')) {
$attributes['displayname'] = preg_replace('/"#[a-z]{0,3}[0-9]+/', '_', $attributes['displayname']);
}
@@ -62,7 +62,7 @@ class UnparsePostMentions
{
$tagName = 'POSTMENTION';
if (strpos($xml, $tagName) === false) {
if (! str_contains($xml, $tagName)) {
return $xml;
}

View File

@@ -49,7 +49,7 @@ class UnparseTagMentions
{
$tagName = 'TAGMENTION';
if (strpos($xml, $tagName) === false) {
if (! str_contains($xml, $tagName)) {
return $xml;
}

View File

@@ -40,7 +40,7 @@ class UnparseUserMentions
$attributes['displayname'] = $user?->display_name ?? $this->translator->trans('core.lib.username.deleted_text');
if (strpos($attributes['displayname'], '"#') !== false) {
if (str_contains($attributes['displayname'], '"#')) {
$attributes['displayname'] = preg_replace('/"#[a-z]{0,3}[0-9]+/', '_', $attributes['displayname']);
}
@@ -55,7 +55,7 @@ class UnparseUserMentions
{
$tagName = 'USERMENTION';
if (strpos($xml, $tagName) === false) {
if (! str_contains($xml, $tagName)) {
return $xml;
}

View File

@@ -45,7 +45,7 @@ class RequireExtensionHandler
$packageName = $command->package;
// Auto append :* if not requiring a specific version.
if (strpos($packageName, ':') === false) {
if (! str_contains($packageName, ':')) {
$packageName .= ':*';
}