From f2d2c242126cae65dbd57a8ff821c4fd56f6a541 Mon Sep 17 00:00:00 2001 From: Yosri BAHRI Date: Wed, 24 May 2023 19:27:04 +0200 Subject: [PATCH] require symfony yaml --- composer.json | 16 ++++++++++++++-- src/DependencyInjection/DevgineDemoExtension.php | 9 +++++---- src/DevgineDemoBundle.php | 5 ++--- src/Resources/config/console.xml | 15 --------------- src/Resources/config/console.yaml | 4 ++++ 5 files changed, 25 insertions(+), 24 deletions(-) delete mode 100644 src/Resources/config/console.xml create mode 100644 src/Resources/config/console.yaml diff --git a/composer.json b/composer.json index 984afad..8f408c1 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ "symfony/console": "^6.1", "symfony/http-kernel": "^6.1", "symfony/dependency-injection": "^6.1", - "symfony/config": "^6.1" + "symfony/config": "^6.1", + "symfony/yaml": "^6.1" }, "license": "MIT", "autoload": { @@ -31,5 +32,16 @@ "email": "yosribahri@gmail.com" } ], - "minimum-stability": "dev" + "minimum-stability": "dev", + "scripts": { + "md": [ + "phpmd src,tests ansi phpmd.xml.dist" + ], + "cpd": [ + "phpcpd src" + ], + "test": [ + "phpunit" + ] + } } diff --git a/src/DependencyInjection/DevgineDemoExtension.php b/src/DependencyInjection/DevgineDemoExtension.php index e964aa2..7ce9f6a 100644 --- a/src/DependencyInjection/DevgineDemoExtension.php +++ b/src/DependencyInjection/DevgineDemoExtension.php @@ -2,20 +2,21 @@ namespace Devgine\Demo\DependencyInjection; +use Symfony\Component\Config\FileLocator; use Symfony\Component\Console\Application; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; class DevgineDemoExtension extends Extension { + /** @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function load(array $configs, ContainerBuilder $container) { - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); + $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); if (class_exists(Application::class)) { - $loader->load('console.xml'); + $loader->load('console.yaml'); } } } diff --git a/src/DevgineDemoBundle.php b/src/DevgineDemoBundle.php index f260b77..cb21b44 100644 --- a/src/DevgineDemoBundle.php +++ b/src/DevgineDemoBundle.php @@ -2,9 +2,8 @@ namespace Devgine\Demo; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\Bundle\AbstractBundle; +use Symfony\Component\HttpKernel\Bundle\Bundle; -class DevgineDemoBundle extends AbstractBundle +class DevgineDemoBundle extends Bundle { } diff --git a/src/Resources/config/console.xml b/src/Resources/config/console.xml deleted file mode 100644 index 1c526b7..0000000 --- a/src/Resources/config/console.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/src/Resources/config/console.yaml b/src/Resources/config/console.yaml new file mode 100644 index 0000000..674967a --- /dev/null +++ b/src/Resources/config/console.yaml @@ -0,0 +1,4 @@ +services: + Devgine\Demo\Command\HelloCommand: + tags: + - { name: 'console.command', command: 'devgine:demo:hello' }