From 91ffb98629f15d3ce746dcfedb7e6550247b9bdf Mon Sep 17 00:00:00 2001 From: Greg Brown Date: Fri, 16 Dec 2022 14:20:44 -0800 Subject: [PATCH] v3.1.0 -- Use new symfony/php attributes instead of annotations. --- CHANGELOG-3.x.md | 5 +++++ composer.json | 2 +- src/Command/CreateSearchStorageCommand.php | 10 +++------- src/Command/CreateStorageCommand.php | 10 +++------- src/Command/DescribeSearchStorageCommand.php | 10 +++------- src/Command/DescribeStorageCommand.php | 10 +++------- src/Command/ExportNodesCommand.php | 10 +++------- src/Command/GetNodeCommand.php | 10 +++------- src/Command/ReindexNodesCommand.php | 17 +++++++---------- src/Command/SyncNodeCommand.php | 20 ++++++++------------ src/Command/SyncNodesCommand.php | 20 ++++++++------------ 11 files changed, 47 insertions(+), 77 deletions(-) diff --git a/CHANGELOG-3.x.md b/CHANGELOG-3.x.md index df9b8ca..9338c85 100644 --- a/CHANGELOG-3.x.md +++ b/CHANGELOG-3.x.md @@ -2,6 +2,11 @@ This changelog references the relevant changes done in 3.x versions. +## v3.1.0 +* Require gdbots/pbjx-bundle 3.1.x +* Use new symfony/php attributes instead of annotations. + + ## v3.0.1 * Fix bug with sprintf and enum (can't cast to string) in ReindexNodesCommand and SyncNodesCommand. diff --git a/composer.json b/composer.json index 3100661..6166a65 100755 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "require": { "php": ">=8.1", "gdbots/ncr": "^3.0", - "gdbots/pbjx-bundle": "^3.0" + "gdbots/pbjx-bundle": "^3.1" }, "require-dev": { "phpunit/phpunit": "^9.5", diff --git a/src/Command/CreateSearchStorageCommand.php b/src/Command/CreateSearchStorageCommand.php index 0cb6aac..ff898cf 100644 --- a/src/Command/CreateSearchStorageCommand.php +++ b/src/Command/CreateSearchStorageCommand.php @@ -7,6 +7,7 @@ use Gdbots\Pbj\MessageResolver; use Gdbots\Pbj\SchemaCurie; use Gdbots\Pbj\SchemaQName; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -15,16 +16,11 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\ContainerInterface; +#[AsCommand(name: 'ncr:create-search-storage')] final class CreateSearchStorageCommand extends Command { - protected static $defaultName = 'ncr:create-search-storage'; - protected ContainerInterface $container; - protected NcrSearch $ncrSearch; - - public function __construct(ContainerInterface $container, NcrSearch $ncrSearch) + public function __construct(protected ContainerInterface $container, protected NcrSearch $ncrSearch) { - $this->container = $container; - $this->ncrSearch = $ncrSearch; parent::__construct(); } diff --git a/src/Command/CreateStorageCommand.php b/src/Command/CreateStorageCommand.php index 4a4135f..afd75a4 100644 --- a/src/Command/CreateStorageCommand.php +++ b/src/Command/CreateStorageCommand.php @@ -7,6 +7,7 @@ use Gdbots\Pbj\MessageResolver; use Gdbots\Pbj\SchemaCurie; use Gdbots\Pbj\SchemaQName; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -15,16 +16,11 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\ContainerInterface; +#[AsCommand(name: 'ncr:create-storage')] final class CreateStorageCommand extends Command { - protected static $defaultName = 'ncr:create-storage'; - protected ContainerInterface $container; - protected Ncr $ncr; - - public function __construct(ContainerInterface $container, Ncr $ncr) + public function __construct(protected ContainerInterface $container, protected Ncr $ncr) { - $this->container = $container; - $this->ncr = $ncr; parent::__construct(); } diff --git a/src/Command/DescribeSearchStorageCommand.php b/src/Command/DescribeSearchStorageCommand.php index e672ccd..a79cfd5 100644 --- a/src/Command/DescribeSearchStorageCommand.php +++ b/src/Command/DescribeSearchStorageCommand.php @@ -7,6 +7,7 @@ use Gdbots\Pbj\MessageResolver; use Gdbots\Pbj\SchemaCurie; use Gdbots\Pbj\SchemaQName; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -15,16 +16,11 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\ContainerInterface; +#[AsCommand(name: 'ncr:describe-search-storage')] final class DescribeSearchStorageCommand extends Command { - protected static $defaultName = 'ncr:describe-search-storage'; - protected ContainerInterface $container; - protected NcrSearch $ncrSearch; - - public function __construct(ContainerInterface $container, NcrSearch $ncrSearch) + public function __construct(protected ContainerInterface $container, protected NcrSearch $ncrSearch) { - $this->container = $container; - $this->ncrSearch = $ncrSearch; parent::__construct(); } diff --git a/src/Command/DescribeStorageCommand.php b/src/Command/DescribeStorageCommand.php index 2baf029..4f1b076 100644 --- a/src/Command/DescribeStorageCommand.php +++ b/src/Command/DescribeStorageCommand.php @@ -7,6 +7,7 @@ use Gdbots\Pbj\MessageResolver; use Gdbots\Pbj\SchemaCurie; use Gdbots\Pbj\SchemaQName; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -15,16 +16,11 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\ContainerInterface; +#[AsCommand(name: 'ncr:describe-storage')] final class DescribeStorageCommand extends Command { - protected static $defaultName = 'ncr:describe-storage'; - protected ContainerInterface $container; - protected Ncr $ncr; - - public function __construct(ContainerInterface $container, Ncr $ncr) + public function __construct(protected ContainerInterface $container, protected Ncr $ncr) { - $this->container = $container; - $this->ncr = $ncr; parent::__construct(); } diff --git a/src/Command/ExportNodesCommand.php b/src/Command/ExportNodesCommand.php index 367fe97..8f137bd 100644 --- a/src/Command/ExportNodesCommand.php +++ b/src/Command/ExportNodesCommand.php @@ -8,6 +8,7 @@ use Gdbots\Pbj\SchemaCurie; use Gdbots\Pbj\SchemaQName; use Gdbots\Pbj\Util\NumberUtil; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -16,16 +17,11 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\DependencyInjection\ContainerInterface; +#[AsCommand(name: 'ncr:export-nodes')] final class ExportNodesCommand extends Command { - protected static $defaultName = 'ncr:export-nodes'; - protected ContainerInterface $container; - protected Ncr $ncr; - - public function __construct(ContainerInterface $container, Ncr $ncr) + public function __construct(protected ContainerInterface $container, protected Ncr $ncr) { - $this->container = $container; - $this->ncr = $ncr; parent::__construct(); } diff --git a/src/Command/GetNodeCommand.php b/src/Command/GetNodeCommand.php index f0a6e4c..ea731b0 100644 --- a/src/Command/GetNodeCommand.php +++ b/src/Command/GetNodeCommand.php @@ -5,6 +5,7 @@ use Gdbots\Ncr\Ncr; use Gdbots\Pbj\WellKnown\NodeRef; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -13,16 +14,11 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\DependencyInjection\ContainerInterface; +#[AsCommand(name: 'ncr:get-node')] final class GetNodeCommand extends Command { - protected static $defaultName = 'ncr:get-node'; - protected ContainerInterface $container; - protected Ncr $ncr; - - public function __construct(ContainerInterface $container, Ncr $ncr) + public function __construct(protected ContainerInterface $container, protected Ncr $ncr) { - $this->container = $container; - $this->ncr = $ncr; parent::__construct(); } diff --git a/src/Command/ReindexNodesCommand.php b/src/Command/ReindexNodesCommand.php index 60b7a3a..785d376 100644 --- a/src/Command/ReindexNodesCommand.php +++ b/src/Command/ReindexNodesCommand.php @@ -10,6 +10,7 @@ use Gdbots\Pbj\SchemaCurie; use Gdbots\Pbj\SchemaQName; use Gdbots\Pbj\Util\NumberUtil; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -18,18 +19,14 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\ContainerInterface; +#[AsCommand(name: 'ncr:reindex-nodes')] final class ReindexNodesCommand extends Command { - protected static $defaultName = 'ncr:reindex-nodes'; - protected ContainerInterface $container; - protected Ncr $ncr; - protected NcrSearch $ncrSearch; - - public function __construct(ContainerInterface $container, Ncr $ncr, NcrSearch $ncrSearch) - { - $this->container = $container; - $this->ncr = $ncr; - $this->ncrSearch = $ncrSearch; + public function __construct( + protected ContainerInterface $container, + protected Ncr $ncr, + protected NcrSearch $ncrSearch + ) { parent::__construct(); } diff --git a/src/Command/SyncNodeCommand.php b/src/Command/SyncNodeCommand.php index b300e47..041281e 100644 --- a/src/Command/SyncNodeCommand.php +++ b/src/Command/SyncNodeCommand.php @@ -9,6 +9,7 @@ use Gdbots\Ncr\NcrSearch; use Gdbots\Pbj\WellKnown\NodeRef; use Gdbots\Pbjx\Pbjx; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -17,20 +18,15 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\ContainerInterface; +#[AsCommand(name: 'ncr:sync-node')] final class SyncNodeCommand extends Command { - protected static $defaultName = 'ncr:sync-node'; - protected ContainerInterface $container; - protected Ncr $ncr; - protected NcrSearch $ncrSearch; - protected Pbjx $pbjx; - - public function __construct(ContainerInterface $container, Ncr $ncr, NcrSearch $ncrSearch, Pbjx $pbjx) - { - $this->container = $container; - $this->ncr = $ncr; - $this->ncrSearch = $ncrSearch; - $this->pbjx = $pbjx; + public function __construct( + protected ContainerInterface $container, + protected Ncr $ncr, + protected NcrSearch $ncrSearch, + protected Pbjx $pbjx + ) { parent::__construct(); } diff --git a/src/Command/SyncNodesCommand.php b/src/Command/SyncNodesCommand.php index 78e85e2..922df06 100644 --- a/src/Command/SyncNodesCommand.php +++ b/src/Command/SyncNodesCommand.php @@ -12,6 +12,7 @@ use Gdbots\Pbj\SchemaQName; use Gdbots\Pbj\Util\NumberUtil; use Gdbots\Pbjx\Pbjx; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -20,20 +21,15 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\ContainerInterface; +#[AsCommand(name: 'ncr:sync-nodes')] final class SyncNodesCommand extends Command { - protected static $defaultName = 'ncr:sync-nodes'; - protected ContainerInterface $container; - protected Ncr $ncr; - protected NcrSearch $ncrSearch; - protected Pbjx $pbjx; - - public function __construct(ContainerInterface $container, Ncr $ncr, NcrSearch $ncrSearch, Pbjx $pbjx) - { - $this->container = $container; - $this->ncr = $ncr; - $this->ncrSearch = $ncrSearch; - $this->pbjx = $pbjx; + public function __construct( + protected ContainerInterface $container, + protected Ncr $ncr, + protected NcrSearch $ncrSearch, + protected Pbjx $pbjx + ) { parent::__construct(); }