From 775b0780efc6b939441f6b1874d672b01d6c5c32 Mon Sep 17 00:00:00 2001 From: Christian Fasching Date: Mon, 10 May 2021 09:47:16 +0200 Subject: [PATCH] changed config file extensions to yaml --- src/Command/BaseGenerateBundleCommand.php | 8 ++++---- src/Command/Validators.php | 6 +++--- .../PimcoreBundleGeneratorExtension.php | 2 +- src/Generator/BaseBundleGenerator.php | 2 +- src/Generator/BundleGenerator.php | 2 +- src/Model/BaseBundle.php | 8 ++++---- src/Resources/config/{services.yml => services.yaml} | 0 src/Resources/skeleton/bundle/Extension.php.twig | 4 ++-- .../bundle/{routing.yml.twig => routing.yaml.twig} | 0 .../bundle/{services.yml.twig => services.yaml.twig} | 0 10 files changed, 16 insertions(+), 16 deletions(-) rename src/Resources/config/{services.yml => services.yaml} (100%) rename src/Resources/skeleton/bundle/{routing.yml.twig => routing.yaml.twig} (100%) rename src/Resources/skeleton/bundle/{services.yml.twig => services.yaml.twig} (100%) diff --git a/src/Command/BaseGenerateBundleCommand.php b/src/Command/BaseGenerateBundleCommand.php index 440b5e4..3f3b8c9 100644 --- a/src/Command/BaseGenerateBundleCommand.php +++ b/src/Command/BaseGenerateBundleCommand.php @@ -43,7 +43,7 @@ protected function configure() new InputOption('namespace', '', InputOption::VALUE_REQUIRED, 'The namespace of the bundle to create'), new InputOption('dir', '', InputOption::VALUE_REQUIRED, 'The directory where to create the bundle', 'bundles/'), new InputOption('bundle-name', '', InputOption::VALUE_REQUIRED, 'The optional bundle name'), - new InputOption('format', '', InputOption::VALUE_REQUIRED, 'Use the format for configuration files (php, xml, yml, or annotation)'), + new InputOption('format', '', InputOption::VALUE_REQUIRED, 'Use the format for configuration files (php, xml, yaml, or annotation)'), new InputOption('shared', '', InputOption::VALUE_NONE, 'Are you planning on sharing this bundle across multiple applications?'), ]) ->setHelp(<<updateRouting($bundle), false); if (!$bundle->shouldGenerateDependencyInjectionDirectory()) { - // we need to import their services.yml manually! + // we need to import their services.yaml manually! $runner($this->updateConfiguration($output, $bundle)); } @@ -254,13 +254,13 @@ protected function interact(InputInterface $input, OutputInterface $output) ]); $question = new Question($questionHelper->getQuestion( - 'Configuration format (annotation, yml, xml, php)', + 'Configuration format (annotation, yaml, xml, php)', $format ), $format); $question->setValidator(function ($format) { return Validators::validateFormat($format); }); - $question->setAutocompleterValues(['annotation', 'yml', 'xml', 'php']); + $question->setAutocompleterValues(['annotation', 'yaml', 'xml', 'php']); $format = $questionHelper->ask($input, $output, $question); $input->setOption('format', $format); } diff --git a/src/Command/Validators.php b/src/Command/Validators.php index 917aa8f..42b3527 100644 --- a/src/Command/Validators.php +++ b/src/Command/Validators.php @@ -86,11 +86,11 @@ public static function validateFormat($format) $format = strtolower($format); // in case they typed "yaml", but ok with that - if ($format == 'yaml') { - $format = 'yml'; + if ($format == 'yml') { + $format = 'yaml'; } - if (!in_array($format, ['php', 'xml', 'yml', 'annotation'])) { + if (!in_array($format, ['php', 'xml', 'yaml', 'annotation'])) { throw new \RuntimeException(sprintf('Format "%s" is not supported.', $format)); } diff --git a/src/DependencyInjection/PimcoreBundleGeneratorExtension.php b/src/DependencyInjection/PimcoreBundleGeneratorExtension.php index 1ae6d12..cea747c 100644 --- a/src/DependencyInjection/PimcoreBundleGeneratorExtension.php +++ b/src/DependencyInjection/PimcoreBundleGeneratorExtension.php @@ -31,6 +31,6 @@ public function load(array $configs, ContainerBuilder $container) new FileLocator(__DIR__ . '/../Resources/config') ); - $loader->load('services.yml'); + $loader->load('services.yaml'); } } diff --git a/src/Generator/BaseBundleGenerator.php b/src/Generator/BaseBundleGenerator.php index 46f176d..7750ae2 100644 --- a/src/Generator/BaseBundleGenerator.php +++ b/src/Generator/BaseBundleGenerator.php @@ -57,7 +57,7 @@ public function generateBundle(Bundle $bundle) $this->renderFile('bundle/DefaultController.php.twig', $dir.'/Controller/DefaultController.php', $parameters); $this->renderFile('bundle/DefaultControllerTest.php.twig', $bundle->getTestsDirectory().'/Controller/DefaultControllerTest.php', $parameters); - // render the services.yml/xml file + // render the services.yaml/xml file $servicesFilename = $bundle->getServicesConfigurationFilename(); $this->renderFile( sprintf('bundle/%s.twig', $servicesFilename), diff --git a/src/Generator/BundleGenerator.php b/src/Generator/BundleGenerator.php index 9cb19fa..7e5c191 100644 --- a/src/Generator/BundleGenerator.php +++ b/src/Generator/BundleGenerator.php @@ -36,7 +36,7 @@ public function generateBundle(Bundle $bundle) 'extension_alias' => $bundle->getExtensionAlias(), ]; - $routingFilename = $bundle->getRoutingConfigurationFilename() ?: 'routes.yml'; + $routingFilename = $bundle->getRoutingConfigurationFilename() ?: 'routing.yaml'; $routingTarget = $dir . '/Resources/config/pimcore/' . $routingFilename; // create routing file for default annotation diff --git a/src/Model/BaseBundle.php b/src/Model/BaseBundle.php index 90f8359..7ee0d62 100644 --- a/src/Model/BaseBundle.php +++ b/src/Model/BaseBundle.php @@ -112,21 +112,21 @@ public function shouldGenerateDependencyInjectionDirectory() } /** - * What is the filename for the services.yml/xml file? + * What is the filename for the services.yaml/xml file? * * @return string */ public function getServicesConfigurationFilename() { - if ('yml' === $this->getConfigurationFormat() || 'annotation' === $this->configurationFormat) { - return 'services.yml'; + if ('yaml' === $this->getConfigurationFormat() || 'annotation' === $this->configurationFormat) { + return 'services.yaml'; } else { return 'services.'.$this->getConfigurationFormat(); } } /** - * What is the filename for the routing.yml/xml file? + * What is the filename for the routing.yaml/xml file? * * If false, no routing file will be generated * diff --git a/src/Resources/config/services.yml b/src/Resources/config/services.yaml similarity index 100% rename from src/Resources/config/services.yml rename to src/Resources/config/services.yaml diff --git a/src/Resources/skeleton/bundle/Extension.php.twig b/src/Resources/skeleton/bundle/Extension.php.twig index be45f1d..a5248dd 100644 --- a/src/Resources/skeleton/bundle/Extension.php.twig +++ b/src/Resources/skeleton/bundle/Extension.php.twig @@ -29,9 +29,9 @@ class {{ bundle_basename }}Extension extends Extension $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); - {% if format == 'yml' or format == 'annotation' -%} + {% if format == 'yaml' or format == 'annotation' -%} $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.yml'); + $loader->load('services.yaml'); {%- elseif format == 'xml' -%} $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.xml'); diff --git a/src/Resources/skeleton/bundle/routing.yml.twig b/src/Resources/skeleton/bundle/routing.yaml.twig similarity index 100% rename from src/Resources/skeleton/bundle/routing.yml.twig rename to src/Resources/skeleton/bundle/routing.yaml.twig diff --git a/src/Resources/skeleton/bundle/services.yml.twig b/src/Resources/skeleton/bundle/services.yaml.twig similarity index 100% rename from src/Resources/skeleton/bundle/services.yml.twig rename to src/Resources/skeleton/bundle/services.yaml.twig