refactor: replace str_ireplace() with in_array()

php > ini_set('display_errors', '1');
php > var_dump(ini_get('display_errors'));
string(1) "1"

php > ini_set('display_errors', 1);
php > var_dump(ini_get('display_errors'));
string(1) "1"

php > ini_set('display_errors', true);
php > var_dump(ini_get('display_errors'));
string(1) "1"

php > ini_set('display_errors', 'true');
php > var_dump(ini_get('display_errors'));
string(4) "true"
This commit is contained in:
kenjis 2023-10-26 08:38:30 +09:00
parent f26b9dc85b
commit f251a3c750
No known key found for this signature in database
GPG Key ID: BD254878922AF198
2 changed files with 10 additions and 10 deletions

View File

@ -130,11 +130,11 @@ final class ExceptionHandler extends BaseExceptionHandler implements ExceptionHa
$view = 'production.php';
if (
str_ireplace(
['off', 'none', 'no', 'false', 'null', '0'],
'',
ini_get('display_errors')
) !== ''
in_array(
strtolower(ini_get('display_errors')),
['1', 'true', 'on', 'yes'],
true
)
) {
$view = 'error_exception.php';
}

View File

@ -254,11 +254,11 @@ class Exceptions
$templatePath = rtrim($templatePath, '\\/ ') . DIRECTORY_SEPARATOR;
if (
str_ireplace(
['off', 'none', 'no', 'false', 'null', '0'],
'',
ini_get('display_errors')
) !== ''
in_array(
strtolower(ini_get('display_errors')),
['1', 'true', 'on', 'yes'],
true
)
) {
$view = 'error_exception.php';
}