refactor: replace strpos with PHP 8.x string functions

- IRCClient: strpos(..., 'PONG') !== 0 → ! str_starts_with(...)
- IGDBService: strpos(, '//') === 0 → str_starts_with(...)
- Settings: strpos(, '.') !== false → str_contains(...)
- NntmuxCheckIndex: 3x strpos → str_contains

strpos with offset (YencService, MovieService, ReleaseRemoverService)
is left untouched as it is a legitimate use case.
This commit is contained in:
Kcchouette
2026-06-13 18:12:22 +02:00
parent d733f75503
commit 062548f57a
4 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -170,9 +170,9 @@ class NntmuxCheckIndex extends Command
$this->error("HTTP Status: {$statusCode}");
// Check if it's a table not found error
if (strpos($body, 'no such table') !== false ||
strpos($body, 'unknown table') !== false ||
strpos($body, "doesn't exist") !== false) {
if (str_contains($body, 'no such table') ||
str_contains($body, 'unknown table') ||
str_contains($body, "doesn't exist")) {
$this->error("ManticoreSearch table '{$indexName}' does not exist.");
return;
+1 -1
View File
@@ -176,7 +176,7 @@ class Settings extends Model
// Convert numeric strings to actual numbers
if (is_numeric($value)) {
// Check if it's an integer or float
if (strpos((string) $value, '.') !== false) {
if (str_contains((string) $value, '.')) {
return (float) $value;
}
+1 -1
View File
@@ -647,7 +647,7 @@ class IGDBService
if (! empty($imageData['url'])) {
$url = $imageData['url'];
if (strpos($url, '//') === 0) {
if (str_starts_with($url, '//')) {
$url = 'https:'.$url;
}
+1 -1
View File
@@ -437,7 +437,7 @@ class IRCClient
$pong === false
|| (
(time() - $this->_lastPing) > ($this->_socket_timeout / 2)
&& strpos((string) $this->_buffer, 'PONG') !== 0
&& ! str_starts_with((string) $this->_buffer, 'PONG')
)
) {
$this->_reconnect();