Skip to content

Commit

Permalink
Improve configuration option and parameter names
Browse files Browse the repository at this point in the history
  • Loading branch information
benr77 committed May 25, 2024
1 parent b473584 commit a6deb60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/HeadsnetDoctrineToolsBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public function configure(DefinitionConfigurator $definition): void
$definition->rootNode()
->children()
->scalarNode('root_namespace')->cannotBeEmpty()->end()
->arrayNode('preset_types')
->arrayNode('custom_types')
->canBeDisabled()
->children()
->arrayNode('scan_dirs')
->defaultValue(['src/'])->scalarPrototype()->end()
->end()
->end()
->end() // End preset_types
->end() // End custom_types
->arrayNode('custom_mappings')
->children()
->arrayNode('scan_dirs')
Expand All @@ -44,7 +44,7 @@ public function configure(DefinitionConfigurator $definition): void
/**
* @param array{
* root_namespace: string,
* preset_types: array{scan_dirs: array<string>},
* custom_types: array{scan_dirs: array<string>},
* custom_mappings: array{scan_dirs: array<string>},
* carbon_mappings: array{enabled: boolean, replace: boolean}
* } $config
Expand All @@ -55,7 +55,7 @@ public function loadExtension(array $config, ContainerConfigurator $container, C

$container->parameters()
->set('headsnet_doctrine_tools.root_namespace', $config['root_namespace'])
->set('headsnet_doctrine_tools.preset_types.scan_dirs', $config['preset_types']['scan_dirs'])
->set('headsnet_doctrine_tools.custom_types.scan_dirs', $config['custom_types']['scan_dirs'])
->set('headsnet_doctrine_tools.custom_mappings.scan_dirs', $config['custom_mappings']['scan_dirs'])
->set('headsnet_doctrine_tools.carbon_mappings.enabled', $config['carbon_mappings']['enabled'])
->set('headsnet_doctrine_tools.carbon_mappings.replace', $config['carbon_mappings']['replace'])
Expand Down
2 changes: 1 addition & 1 deletion src/Types/DoctrineTypesCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function process(ContainerBuilder $container): void
/** @var array<string, array{class: class-string}> $typeDefinitions */
$typeDefinitions = $container->getParameter(self::TYPE_DEFINITION_PARAMETER);
/** @var array<string> $scanDirs */
$scanDirs = $container->getParameter('headsnet_doctrine_tools.preset_types.scan_dirs');
$scanDirs = $container->getParameter('headsnet_doctrine_tools.custom_types.scan_dirs');
$this->rootNamespace = $container->getParameter('headsnet_doctrine_tools.root_namespace'); // @phpstan-ignore-line

$objectsToRegister = $this->findObjectsToRegister($scanDirs);
Expand Down

0 comments on commit a6deb60

Please sign in to comment.