diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7e03d749..e8877943 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,7 +9,6 @@ on: env: fail-fast: true PHPUNIT_FLAGS: "-v" - SYMFONY_REQUIRE: ">=4.4" XDEBUG_MODE: "coverage" jobs: @@ -21,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] dependencies: [highest] allowed-to-fail: [false] symfony-version: [latest] @@ -32,10 +31,10 @@ jobs: symfony-version: latest steps: - name: "Checkout code" - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v6 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@2.7.0 + uses: shivammathur/setup-php@v2 with: coverage: xdebug php-version: ${{ matrix.php-version }} @@ -63,10 +62,10 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v6 - name: "Setup node" - uses: actions/setup-node@v4.0.3 + uses: actions/setup-node@v4 with: node-version: 'lts/*' diff --git a/DependencyInjection/BazingaJsTranslationExtension.php b/DependencyInjection/BazingaJsTranslationExtension.php index 2859b28a..e976804c 100644 --- a/DependencyInjection/BazingaJsTranslationExtension.php +++ b/DependencyInjection/BazingaJsTranslationExtension.php @@ -4,7 +4,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Definition\Processor; @@ -22,9 +22,9 @@ public function load(array $configs, ContainerBuilder $container): void $configuration = new Configuration($container->getParameter('kernel.debug')); $config = $processor->processConfiguration($configuration, $configs); - $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.xml'); - $loader->load('controllers.xml'); + $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.php'); + $loader->load('controllers.php'); $container ->getDefinition('bazinga.jstranslation.controller') diff --git a/Resources/config/controllers.php b/Resources/config/controllers.php new file mode 100644 index 00000000..e30ba859 --- /dev/null +++ b/Resources/config/controllers.php @@ -0,0 +1,23 @@ +parameters(); + $parameters->set('bazinga.jstranslation.controller.class', \Bazinga\Bundle\JsTranslationBundle\Controller\Controller::class); + + $services = $container->services(); + + $services->set('bazinga.jstranslation.controller', '%bazinga.jstranslation.controller.class%') + ->public() + ->args([ + service('translator'), + service('twig'), + service('bazinga.jstranslation.translation_finder'), + '%kernel.cache_dir%/bazinga-js-translation', + '%kernel.debug%', + abstract_arg('fallback locale'), + abstract_arg('default domain'), + abstract_arg('http cache time'), + ]); +}; diff --git a/Resources/config/controllers.xml b/Resources/config/controllers.xml deleted file mode 100644 index 86080cda..00000000 --- a/Resources/config/controllers.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Bazinga\Bundle\JsTranslationBundle\Controller\Controller - - - - - - - - %kernel.cache_dir%/bazinga-js-translation - %kernel.debug% - - - - - - diff --git a/Resources/config/services.php b/Resources/config/services.php new file mode 100644 index 00000000..7bec9d51 --- /dev/null +++ b/Resources/config/services.php @@ -0,0 +1,35 @@ +parameters(); + $parameters->set('bazinga.jstranslation.translation_finder.class', \Bazinga\Bundle\JsTranslationBundle\Finder\TranslationFinder::class); + $parameters->set('bazinga.jstranslation.translation_dumper.class', \Bazinga\Bundle\JsTranslationBundle\Dumper\TranslationDumper::class); + + $services = $container->services(); + + $services->set('bazinga.jstranslation.translation_finder', '%bazinga.jstranslation.translation_finder.class%') + ->public() + ->args([[]]); + + $services->set('bazinga.jstranslation.translation_dumper', '%bazinga.jstranslation.translation_dumper.class%') + ->public() + ->args([ + service('twig'), + service('bazinga.jstranslation.translation_finder'), + service('filesystem'), + abstract_arg('fallback locale'), + abstract_arg('default domain'), + abstract_arg('active locales'), + abstract_arg('active domains'), + ]); + + $services->set('bazinga.jstranslation.dump_command', \Bazinga\Bundle\JsTranslationBundle\Command\DumpCommand::class) + ->public() + ->args([ + service('bazinga.jstranslation.translation_dumper'), + '%kernel.project_dir%', + ]) + ->tag('console.command', ['command' => 'bazinga:js-translation:dump']); +}; diff --git a/Resources/config/services.xml b/Resources/config/services.xml deleted file mode 100644 index f2fa955a..00000000 --- a/Resources/config/services.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - Bazinga\Bundle\JsTranslationBundle\Finder\TranslationFinder - Bazinga\Bundle\JsTranslationBundle\Dumper\TranslationDumper - - - - - - - - - - - - - - - - - - %kernel.project_dir% - - - - diff --git a/Tests/Fixtures/app/AppKernel.php b/Tests/Fixtures/app/AppKernel.php index 7d007a2e..71806651 100644 --- a/Tests/Fixtures/app/AppKernel.php +++ b/Tests/Fixtures/app/AppKernel.php @@ -68,7 +68,9 @@ public function registerContainerConfiguration(LoaderInterface $loader): void { $loader->load(__DIR__.'/config/'.$this->environment.'.yml'); $loader->load(__DIR__.'/config/base_config.yml'); - $loader->load(__DIR__.'/config/disable_annotations.yml'); + if (self::VERSION_ID < 80000) { + $loader->load(__DIR__.'/config/disable_annotations.yml'); + } if (self::VERSION_ID < 40200 && file_exists(__DIR__.'/Resources/translations') === false) { self::recurseCopy(__DIR__.'/../translations', __DIR__.'/Resources/translations'); diff --git a/composer.json b/composer.json index 258d5ea8..da6e8893 100644 --- a/composer.json +++ b/composer.json @@ -12,19 +12,20 @@ ], "require": { "php": ">=7.4", - "symfony/framework-bundle": "~4.4|~5.0|~6.0|~7.0", - "symfony/finder": "~4.4|~5.0|~6.0|~7.0", - "symfony/console": "~4.4|~5.0|~6.0|~7.0", - "symfony/intl": "~4.4|~5.0|~6.0|~7.0", - "symfony/translation": "~4.4|~5.0|~6.0|~7.0", - "symfony/twig-bundle": "~4.4|~5.0|~6.0|~7.0" + "symfony/dependency-injection": "~5.4|~6.0|~7.0|~8.0", + "symfony/framework-bundle": "~5.4|~6.0|~7.0|~8.0", + "symfony/finder": "~5.4|~6.0|~7.0|~8.0", + "symfony/console": "~5.4|~6.0|~7.0|~8.0", + "symfony/intl": "~5.4|~6.0|~7.0|~8.0", + "symfony/translation": "~5.4|~6.0|~7.0|~8.0", + "symfony/twig-bundle": "~5.4|~6.0|~7.0|~8.0" }, "require-dev": { - "symfony/asset": "~4.4|~5.0|~6.0|~7.0", - "symfony/filesystem": "~4.4|~5.0|~6.0|~7.0", - "symfony/yaml": "~4.4|~5.0|~6.0|~7.0", - "symfony/browser-kit": "~4.4|~5.0|~6.0|~7.0", - "symfony/phpunit-bridge": "^5.0|^6.0|~7.0", + "symfony/asset": "~5.4|~6.0|~7.0|~8.0", + "symfony/filesystem": "~5.4|~6.0|~7.0|~8.0", + "symfony/yaml": "~5.4|~6.0|~7.0|~8.0", + "symfony/browser-kit": "~5.4|~6.0|~7.0|~8.0", + "symfony/phpunit-bridge": "^5.4|^6.0|~7.0|~8.0", "phpunit/phpunit": "^4.8|~5.7|~6.5|~8" }, "replace": {