fix: compatibilidad PHP 7.4 — str_starts_with, str_contains, match, never, mixed

This commit is contained in:
Lizandro Guarnizo
2026-06-04 20:04:37 -05:00
parent 943e629120
commit 43f337ee34
5 changed files with 54 additions and 50 deletions
+3 -3
View File
@@ -15,10 +15,10 @@ declare(strict_types=1);
foreach ($lines as $line) {
$line = trim($line);
// Ignorar comentarios
if ($line === '' || str_starts_with($line, '#')) {
if ($line === '' || strpos($line, '#') === 0) {
continue;
}
if (!str_contains($line, '=')) {
if (strpos($line, '=') === false) {
continue;
}
[$key, $value] = explode('=', $line, 2);
@@ -32,7 +32,7 @@ declare(strict_types=1);
}
})();
function env(string $key, mixed $default = null): mixed
function env(string $key, $default = null)
{
return $_ENV[$key] ?? getenv($key) ?: $default;
}