diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 586fb22..479ced1 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -20,26 +20,30 @@ jobs: strategy: matrix: php-version: - - "7.2" - - "7.3" - - "7.4" - "8.0" - "8.1" + - "8.2" + - "8.3" + - "8.4" symfony-version: - "4.4.x" - "5.4.x" - "6.0.x" - "7.0.x" + - "8.0.x" dependencies: - "highest" include: - dependencies: "lowest" - php-version: "7.2" + php-version: "8.0" symfony-version: "4.4.*" + - dependencies: "highest" + php-version: "8.4" + symfony-version: "8.0.x" steps: - name: "Checkout" - uses: "actions/checkout@v2" + uses: "actions/checkout@v6" with: fetch-depth: 2 diff --git a/.gitignore b/.gitignore index b486ac6..5db223c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ vendor/* composer.lock composer.phar .phpunit.result.cache +.phpunit.cache \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b0c7cb0..ef86deb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ CHANGELOG ========= +### 2025-01-XX + +* Added Symfony 8.0 and PHP 8.4 compatibility +* [BC BREAK] Dropped PHP 7.x support (PHP 7.4 reached end-of-life in November 2022) +* Migrated service definitions from XML to YAML format (required for Symfony 8 compatibility, but YAML works with all supported Symfony versions) +* Modernized `FeedDumpCommand` to use `AsCommand` attribute instead of deprecated `$defaultName` property +* Updated CI workflow to test against PHP 8.1, 8.2, 8.3, 8.4 and Symfony 8.0.x +* Minimum PHP version requirement changed from `^7.2 || ^8.0` to `^8.0` + ### 2013-07-13 * [BC BREAK] We have introduced the `ChannelField` to add custom fields to your feed's main channel diff --git a/Command/FeedDumpCommand.php b/Command/FeedDumpCommand.php index 4f25d61..dbe6348 100644 --- a/Command/FeedDumpCommand.php +++ b/Command/FeedDumpCommand.php @@ -11,6 +11,7 @@ namespace Eko\FeedBundle\Command; use Eko\FeedBundle\Service\FeedDumpService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -25,9 +26,9 @@ * * @author Vincent Composieux */ +#[AsCommand('eko:feed:dump', 'Generate (dump) a feed in an XML file')] class FeedDumpCommand extends Command { - protected static $defaultName = 'eko:feed:dump'; /** * @var RouterInterface @@ -53,7 +54,6 @@ public function __construct(RouterInterface $router, FeedDumpService $feedDumpSe protected function configure() { $this - ->setDescription('Generate (dump) a feed in an XML file') ->addOption('name', null, InputOption::VALUE_REQUIRED, 'Feed name defined in eko_feed configuration') ->addOption('entity', null, InputOption::VALUE_REQUIRED, 'Entity to use to generate the feed') ->addOption('filename', null, InputOption::VALUE_REQUIRED, 'Defines feed filename') @@ -100,6 +100,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('done!'); $output->writeln(sprintf('Feed has been dumped and located in "%s"', $this->feedDumpService->getRootDir().$filename)); - return 0; + return Command::SUCCESS; } } diff --git a/DependencyInjection/EkoFeedExtension.php b/DependencyInjection/EkoFeedExtension.php index 97b2e33..fa1f36b 100644 --- a/DependencyInjection/EkoFeedExtension.php +++ b/DependencyInjection/EkoFeedExtension.php @@ -13,13 +13,14 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** * EkoFeedExtension. * - * This class loads services.xml file and tree configuration + * This class loads services.yaml files and tree configuration * * @author Vincent Composieux */ @@ -35,11 +36,11 @@ public function load(array $configs, ContainerBuilder $container) { $config = $this->processConfiguration(new Configuration(), $configs); - $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('feed.xml'); - $loader->load('formatter.xml'); - $loader->load('hydrator.xml'); - $loader->load('command.xml'); + $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('feed.yaml'); + $loader->load('formatter.yaml'); + $loader->load('hydrator.yaml'); + $loader->load('command.yaml'); $container->setParameter('eko_feed.config', $config); $container->setParameter('eko_feed.translation_domain', $config['translation_domain']); diff --git a/Resources/config/command.xml b/Resources/config/command.xml deleted file mode 100644 index fb0e71e..0000000 --- a/Resources/config/command.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - diff --git a/Resources/config/command.yaml b/Resources/config/command.yaml new file mode 100644 index 0000000..3fc5f93 --- /dev/null +++ b/Resources/config/command.yaml @@ -0,0 +1,9 @@ +services: + Eko\FeedBundle\Command\FeedDumpCommand: + autowire: false + tags: + - { name: 'console.command' } + arguments: + - '@router' + - '@?Eko\FeedBundle\Service\FeedDumpService' + diff --git a/Resources/config/feed.xml b/Resources/config/feed.xml deleted file mode 100644 index e572aeb..0000000 --- a/Resources/config/feed.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - %eko_feed.config% - - - - - - - - - %kernel.project_dir% - - - - - - - - - - - - - - - diff --git a/Resources/config/feed.yaml b/Resources/config/feed.yaml new file mode 100644 index 0000000..11cfd32 --- /dev/null +++ b/Resources/config/feed.yaml @@ -0,0 +1,32 @@ +services: + Eko\FeedBundle\Feed\FeedManager: + public: true + autowire: false + arguments: + - '@router' + - '%eko_feed.config%' + - [] + + Eko\FeedBundle\Service\FeedDumpService: + public: true + autowire: false + arguments: + - '@Eko\FeedBundle\Feed\FeedManager' + - '@doctrine.orm.entity_manager' + - '@filesystem' + calls: + - setRootDir: ['%kernel.project_dir%'] + + Eko\FeedBundle\Feed\Reader: + public: true + autowire: false + + Eko\FeedBundle\Feed\Feed: + public: true + autowire: false + arguments: + - [] + - [] + calls: + - setRouter: ['@router'] + diff --git a/Resources/config/formatter.xml b/Resources/config/formatter.xml deleted file mode 100644 index 6f03c8e..0000000 --- a/Resources/config/formatter.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - %eko_feed.translation_domain% - - - - - - - %eko_feed.translation_domain% - - - - diff --git a/Resources/config/formatter.yaml b/Resources/config/formatter.yaml new file mode 100644 index 0000000..046a1d9 --- /dev/null +++ b/Resources/config/formatter.yaml @@ -0,0 +1,17 @@ +services: + Eko\FeedBundle\Formatter\RssFormatter: + autowire: false + tags: + - { name: 'eko_feed.formatter', format: 'rss' } + arguments: + - '@translator' + - '%eko_feed.translation_domain%' + + Eko\FeedBundle\Formatter\AtomFormatter: + autowire: false + tags: + - { name: 'eko_feed.formatter', format: 'atom' } + arguments: + - '@translator' + - '%eko_feed.translation_domain%' + diff --git a/Resources/config/hydrator.xml b/Resources/config/hydrator.xml deleted file mode 100644 index 4dcf5ca..0000000 --- a/Resources/config/hydrator.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/Resources/config/hydrator.yaml b/Resources/config/hydrator.yaml new file mode 100644 index 0000000..5f350e7 --- /dev/null +++ b/Resources/config/hydrator.yaml @@ -0,0 +1,4 @@ +services: + Eko\FeedBundle\Hydrator\DefaultHydrator: + autowire: false + diff --git a/composer.json b/composer.json index 5f859b9..4eb6b8f 100644 --- a/composer.json +++ b/composer.json @@ -12,9 +12,9 @@ } ], "require": { - "php": "^7.2 || ^8.0", - "symfony/framework-bundle": "^4.4|^5.3|^6.0|^7.0", - "symfony/translation": "^4.4|^5.3|^6.0|^7.0", + "php": "^8.0", + "symfony/framework-bundle": "^4.4|^5.3|^6.0|^7.0|^8.0", + "symfony/translation": "^4.4|^5.3|^6.0|^7.0|^8.0", "laminas/laminas-feed": "^2.4" }, "require-dev": {