N°8834 - Add compatibility with PHP 8.4 (#819)

* N°8834 - Add compatibility with PHP 8.4

* Rollback of scssphp/scssphp version upgrade due to compilation error
This commit is contained in:
Lenaick
2026-02-26 10:36:32 +01:00
committed by GitHub
parent d4821b7edc
commit fc967c06ce
961 changed files with 12298 additions and 7130 deletions

View File

@@ -23,7 +23,13 @@ use Symfony\Component\Dotenv\Dotenv;
/**
* A console command to compile .env files into a PHP-optimized file called .env.local.php.
*
* @internal
* To use this command, first register it explicitly as a service, e.g in your services.yaml file:
*
* ```yaml
* services:
* # [...]
* Symfony\Component\Dotenv\Command\DotenvDumpCommand: ~
* ```
*/
#[Autoconfigure(bind: ['$projectDir' => '%kernel.project_dir%', '$defaultEnv' => '%kernel.environment%'])]
#[AsCommand(name: 'dotenv:dump', description: 'Compile .env files to .env.local.php')]
@@ -32,7 +38,7 @@ final class DotenvDumpCommand extends Command
private string $projectDir;
private ?string $defaultEnv;
public function __construct(string $projectDir, string $defaultEnv = null)
public function __construct(string $projectDir, ?string $defaultEnv = null)
{
$this->projectDir = $projectDir;
$this->defaultEnv = $defaultEnv;
@@ -88,17 +94,18 @@ return $vars;
EOF;
file_put_contents($dotenvPath.'.local.php', $vars, \LOCK_EX);
$output->writeln(sprintf('Successfully dumped .env files in <info>.env.local.php</> for the <info>%s</> environment.', $env));
$output->writeln(\sprintf('Successfully dumped .env files in <info>.env.local.php</> for the <info>%s</> environment.', $env));
return 0;
}
private function loadEnv(string $dotenvPath, string $env, array $config): array
{
$dotenv = new Dotenv();
$envKey = $config['env_var_name'] ?? 'APP_ENV';
$testEnvs = $config['test_envs'] ?? ['test'];
$dotenv = new Dotenv($envKey);
$globalsBackup = [$_SERVER, $_ENV];
unset($_SERVER[$envKey]);
$_ENV = [$envKey => $env];