Fix setting PHP version in .env

This commit is contained in:
Daniel Winning 2025-04-13 13:35:39 +01:00
parent 881210312f
commit f276d19bc8
3 changed files with 7 additions and 6 deletions

View file

@ -1,6 +1,7 @@
# Project Settings
PROJECT_DIRECTORY=%s PROJECT_DIRECTORY=%s
PROJECT_NAME=%s PROJECT_NAME=%s
PHP_VERSION=%s
# Ports # PHP
PHP_VERSION=%s
PHP_PORT=%s PHP_PORT=%s

View file

@ -14,7 +14,7 @@ class DockerComposeFileBuilder extends AbstractFileBuilder
*/ */
public function __construct(Config $config) public function __construct(Config $config)
{ {
$projectDockerCompose = $this->config->getFilePaths()->get('projectDockerCompose'); $projectDockerCompose = $config->getFilePaths()->get('projectDockerCompose');
if (!$projectDockerCompose instanceof SpinnerFilePath) { if (!$projectDockerCompose instanceof SpinnerFilePath) {
throw new \Exception('Project Docker Compose file path not found.'); throw new \Exception('Project Docker Compose file path not found.');

View file

@ -131,7 +131,7 @@ class SpinCommand extends AbstractSpinnerCommand
file_get_contents($this->config->getFilePaths()->get('envTemplate')->getAbsolutePath()), file_get_contents($this->config->getFilePaths()->get('envTemplate')->getAbsolutePath()),
$this->config->getFilePaths()->get('project')->getAbsolutePath(), $this->config->getFilePaths()->get('project')->getAbsolutePath(),
$input->getArgument('name'), $input->getArgument('name'),
$input->getOption('php'), $this->config->getPhpVersion($input),
$this->getPort('php'), $this->getPort('php'),
) )
); );
@ -171,8 +171,8 @@ class SpinCommand extends AbstractSpinnerCommand
(new PHPDockerFileBuilder($this->config))->build($input)->save(); (new PHPDockerFileBuilder($this->config))->build($input)->save();
} }
private function getPort(string $service): int private function getPort(string $service): ?int
{ {
return $this->ports[$service] ?? $this->portGenerator->generateRandomPort(); return $this->ports[$service];
} }
} }