Use str_contains and similar instead of strpos

This commit is contained in:
Jan Böhmer 2023-05-27 23:58:28 +02:00
parent 508de10191
commit 1dbf36b86b
16 changed files with 18 additions and 19 deletions

View file

@ -62,7 +62,7 @@ class RedirectController extends AbstractController
//If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string
if (($this->enforce_index_php || !$this->checkIfModRewriteAvailable())
&& false === strpos($new_url, 'index.php')) {
&& !str_contains($new_url, 'index.php')) {
//Like Request::getUriForPath only with index.php
$new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo();
}

View file

@ -198,7 +198,7 @@ class SelectAPIController extends AbstractController
//Remove the data-* prefix for each key
$data = array_combine(
array_map(static function ($key) {
if (strpos($key, 'data-') === 0) {
if (str_starts_with($key, 'data-')) {
return substr($key, 5);
}
return $key;