From 83a1fe4b56e6c6fa0db1bc0ce84aa652f50aa2e6 Mon Sep 17 00:00:00 2001 From: Supportic Date: Wed, 18 Feb 2026 21:34:22 +0100 Subject: [PATCH] Exchange XMLFileLoader with YamlFileLoader --- README.md | 6 -- .../ShivasVersioningExtension.php | 4 +- src/Resources/config/services.xml | 67 -------------- src/Resources/config/services.yaml | 88 +++++++++++++++++++ 4 files changed, 90 insertions(+), 75 deletions(-) delete mode 100644 src/Resources/config/services.xml create mode 100644 src/Resources/config/services.yaml diff --git a/README.md b/README.md index 2a8d62b..1c95229 100644 --- a/README.md +++ b/README.md @@ -94,12 +94,6 @@ App\Provider\MyCustomProvider: - { name: shivas_versioning.provider, alias: my_provider, priority: 0 } ``` -```xml - - - -``` - Please take a look at the priority attribute, it should be between 0 and 99 to keep the providers in the right order. Ensure your provider is loaded correctly and supported: diff --git a/src/DependencyInjection/ShivasVersioningExtension.php b/src/DependencyInjection/ShivasVersioningExtension.php index 6a5217c..28c2fe7 100644 --- a/src/DependencyInjection/ShivasVersioningExtension.php +++ b/src/DependencyInjection/ShivasVersioningExtension.php @@ -14,7 +14,7 @@ final class ShivasVersioningExtension extends Extension */ public function load(array $configs, ContainerBuilder $container): void { - $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.xml'); + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.yaml'); } } diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml deleted file mode 100644 index 34e6827..0000000 --- a/src/Resources/config/services.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - %kernel.project_dir% - - - - %kernel.project_dir% - - - - - %kernel.project_dir% - - - - - %kernel.project_dir% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml new file mode 100644 index 0000000..196b399 --- /dev/null +++ b/src/Resources/config/services.yaml @@ -0,0 +1,88 @@ +# This file is the entry point to configure your own services. +# Files in the packages/ subdirectory configure your dependencies. + +# Put parameters here that don't need to change on each machine where the app is deployed +# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration +parameters: + +services: + _defaults: + public: false + # autowire: true # Automatically injects dependencies in your services. + # autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. + + # Aliases + Shivas\VersioningBundle\Service\VersionManagerInterface: '@shivas_versioning.manager' + Shivas\VersioningBundle\Formatter\FormatterInterface: '@shivas_versioning.formatter.git' + Shivas\VersioningBundle\Writer\WriterInterface: '@shivas_versioning.writer.version' + + # Services + shivas_versioning.manager: + class: Shivas\VersioningBundle\Service\VersionManager + arguments: + - '@shivas_versioning.cache.version' + - '@Shivas\VersioningBundle\Writer\WriterInterface' + - '@Shivas\VersioningBundle\Formatter\FormatterInterface' + + shivas_versioning.formatter.git: + class: Shivas\VersioningBundle\Formatter\GitDescribeFormatter + + shivas_versioning.writer.version: + class: Shivas\VersioningBundle\Writer\VersionWriter + arguments: ['%kernel.project_dir%'] + + # Providers + shivas_versioning.provider.version: + class: Shivas\VersioningBundle\Provider\VersionProvider + arguments: ['%kernel.project_dir%'] + tags: + - { name: shivas_versioning.provider, alias: version, priority: 100 } + + shivas_versioning.provider.git: + class: Shivas\VersioningBundle\Provider\GitRepositoryProvider + arguments: ['%kernel.project_dir%'] + tags: + - { name: shivas_versioning.provider, alias: git, priority: -25 } + + shivas_versioning.provider.revision: + class: Shivas\VersioningBundle\Provider\RevisionProvider + arguments: ['%kernel.project_dir%'] + tags: + - { name: shivas_versioning.provider, alias: revision, priority: -50 } + + shivas_versioning.provider.init: + class: Shivas\VersioningBundle\Provider\InitialVersionProvider + tags: + - { name: shivas_versioning.provider, alias: init, priority: -75 } + + # Cache + shivas_versioning.cache.version: + parent: cache.system + tags: + - { name: cache.pool } + + # Commands + shivas_versioning.command.status: + class: Shivas\VersioningBundle\Command\StatusCommand + arguments: ['@Shivas\VersioningBundle\Service\VersionManagerInterface'] + tags: + - { name: console.command } + + shivas_versioning.command.list_providers: + class: Shivas\VersioningBundle\Command\ListProvidersCommand + arguments: ['@Shivas\VersioningBundle\Service\VersionManagerInterface'] + tags: + - { name: console.command } + + shivas_versioning.command.version_bump: + class: Shivas\VersioningBundle\Command\VersionBumpCommand + arguments: ['@Shivas\VersioningBundle\Service\VersionManagerInterface'] + tags: + - { name: console.command } + + # Twig Extensions + shivas_versioning.twig.version: + class: Shivas\VersioningBundle\Twig\VersionExtension + arguments: ['@Shivas\VersioningBundle\Service\VersionManagerInterface'] + tags: + - { name: twig.extension }