Skip to content

Commit 328ef30

Browse files
committed
[FrameworkBundle] Add --resolve-env-vars option to lint:container command
1 parent afe6d01 commit 328ef30

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Add support for setting `headers` with `Symfony\Bundle\FrameworkBundle\Controller\TemplateController`
8+
* Add `--resolve-env-vars` option to `lint:container` command
89
* Derivate `kernel.secret` from the decryption secret when its env var is not defined
910
* Make the `config/` directory optional in `MicroKernelTrait`, add support for service arguments in the
1011
invokable Kernel class, and register `FrameworkBundle` by default when the `bundles.php` file is missing

Command/ContainerLintCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Console\Command\Command;
1818
use Symfony\Component\Console\Exception\RuntimeException;
1919
use Symfony\Component\Console\Input\InputInterface;
20+
use Symfony\Component\Console\Input\InputOption;
2021
use Symfony\Component\Console\Output\OutputInterface;
2122
use Symfony\Component\Console\Style\SymfonyStyle;
2223
use Symfony\Component\DependencyInjection\Compiler\CheckAliasValidityPass;
@@ -39,6 +40,7 @@ protected function configure(): void
3940
{
4041
$this
4142
->setHelp('This command parses service definitions and ensures that injected values match the type declarations of each services\' class.')
43+
->addOption('resolve-env-vars', null, InputOption::VALUE_NONE, 'Resolve environment variables and fail if one is missing.')
4244
;
4345
}
4446

@@ -58,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5860
$container->setParameter('container.build_time', time());
5961

6062
try {
61-
$container->compile();
63+
$container->compile((bool) $input->getOption('resolve-env-vars'));
6264
} catch (InvalidArgumentException $e) {
6365
$errorIo->error($e->getMessage());
6466

0 commit comments

Comments
 (0)