Skip to content

Commit 91ffb98

Browse files
committed
v3.1.0 -- Use new symfony/php attributes instead of annotations.
1 parent dc2f94b commit 91ffb98

11 files changed

+47
-77
lines changed

CHANGELOG-3.x.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
This changelog references the relevant changes done in 3.x versions.
33

44

5+
## v3.1.0
6+
* Require gdbots/pbjx-bundle 3.1.x
7+
* Use new symfony/php attributes instead of annotations.
8+
9+
510
## v3.0.1
611
* Fix bug with sprintf and enum (can't cast to string) in ReindexNodesCommand and SyncNodesCommand.
712

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"require": {
88
"php": ">=8.1",
99
"gdbots/ncr": "^3.0",
10-
"gdbots/pbjx-bundle": "^3.0"
10+
"gdbots/pbjx-bundle": "^3.1"
1111
},
1212
"require-dev": {
1313
"phpunit/phpunit": "^9.5",

src/Command/CreateSearchStorageCommand.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Gdbots\Pbj\MessageResolver;
88
use Gdbots\Pbj\SchemaCurie;
99
use Gdbots\Pbj\SchemaQName;
10+
use Symfony\Component\Console\Attribute\AsCommand;
1011
use Symfony\Component\Console\Command\Command;
1112
use Symfony\Component\Console\Input\InputArgument;
1213
use Symfony\Component\Console\Input\InputInterface;
@@ -15,16 +16,11 @@
1516
use Symfony\Component\Console\Style\SymfonyStyle;
1617
use Symfony\Component\DependencyInjection\ContainerInterface;
1718

19+
#[AsCommand(name: 'ncr:create-search-storage')]
1820
final class CreateSearchStorageCommand extends Command
1921
{
20-
protected static $defaultName = 'ncr:create-search-storage';
21-
protected ContainerInterface $container;
22-
protected NcrSearch $ncrSearch;
23-
24-
public function __construct(ContainerInterface $container, NcrSearch $ncrSearch)
22+
public function __construct(protected ContainerInterface $container, protected NcrSearch $ncrSearch)
2523
{
26-
$this->container = $container;
27-
$this->ncrSearch = $ncrSearch;
2824
parent::__construct();
2925
}
3026

src/Command/CreateStorageCommand.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Gdbots\Pbj\MessageResolver;
88
use Gdbots\Pbj\SchemaCurie;
99
use Gdbots\Pbj\SchemaQName;
10+
use Symfony\Component\Console\Attribute\AsCommand;
1011
use Symfony\Component\Console\Command\Command;
1112
use Symfony\Component\Console\Input\InputArgument;
1213
use Symfony\Component\Console\Input\InputInterface;
@@ -15,16 +16,11 @@
1516
use Symfony\Component\Console\Style\SymfonyStyle;
1617
use Symfony\Component\DependencyInjection\ContainerInterface;
1718

19+
#[AsCommand(name: 'ncr:create-storage')]
1820
final class CreateStorageCommand extends Command
1921
{
20-
protected static $defaultName = 'ncr:create-storage';
21-
protected ContainerInterface $container;
22-
protected Ncr $ncr;
23-
24-
public function __construct(ContainerInterface $container, Ncr $ncr)
22+
public function __construct(protected ContainerInterface $container, protected Ncr $ncr)
2523
{
26-
$this->container = $container;
27-
$this->ncr = $ncr;
2824
parent::__construct();
2925
}
3026

src/Command/DescribeSearchStorageCommand.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Gdbots\Pbj\MessageResolver;
88
use Gdbots\Pbj\SchemaCurie;
99
use Gdbots\Pbj\SchemaQName;
10+
use Symfony\Component\Console\Attribute\AsCommand;
1011
use Symfony\Component\Console\Command\Command;
1112
use Symfony\Component\Console\Input\InputArgument;
1213
use Symfony\Component\Console\Input\InputInterface;
@@ -15,16 +16,11 @@
1516
use Symfony\Component\Console\Style\SymfonyStyle;
1617
use Symfony\Component\DependencyInjection\ContainerInterface;
1718

19+
#[AsCommand(name: 'ncr:describe-search-storage')]
1820
final class DescribeSearchStorageCommand extends Command
1921
{
20-
protected static $defaultName = 'ncr:describe-search-storage';
21-
protected ContainerInterface $container;
22-
protected NcrSearch $ncrSearch;
23-
24-
public function __construct(ContainerInterface $container, NcrSearch $ncrSearch)
22+
public function __construct(protected ContainerInterface $container, protected NcrSearch $ncrSearch)
2523
{
26-
$this->container = $container;
27-
$this->ncrSearch = $ncrSearch;
2824
parent::__construct();
2925
}
3026

src/Command/DescribeStorageCommand.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Gdbots\Pbj\MessageResolver;
88
use Gdbots\Pbj\SchemaCurie;
99
use Gdbots\Pbj\SchemaQName;
10+
use Symfony\Component\Console\Attribute\AsCommand;
1011
use Symfony\Component\Console\Command\Command;
1112
use Symfony\Component\Console\Input\InputArgument;
1213
use Symfony\Component\Console\Input\InputInterface;
@@ -15,16 +16,11 @@
1516
use Symfony\Component\Console\Style\SymfonyStyle;
1617
use Symfony\Component\DependencyInjection\ContainerInterface;
1718

19+
#[AsCommand(name: 'ncr:describe-storage')]
1820
final class DescribeStorageCommand extends Command
1921
{
20-
protected static $defaultName = 'ncr:describe-storage';
21-
protected ContainerInterface $container;
22-
protected Ncr $ncr;
23-
24-
public function __construct(ContainerInterface $container, Ncr $ncr)
22+
public function __construct(protected ContainerInterface $container, protected Ncr $ncr)
2523
{
26-
$this->container = $container;
27-
$this->ncr = $ncr;
2824
parent::__construct();
2925
}
3026

src/Command/ExportNodesCommand.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Gdbots\Pbj\SchemaCurie;
99
use Gdbots\Pbj\SchemaQName;
1010
use Gdbots\Pbj\Util\NumberUtil;
11+
use Symfony\Component\Console\Attribute\AsCommand;
1112
use Symfony\Component\Console\Command\Command;
1213
use Symfony\Component\Console\Input\InputArgument;
1314
use Symfony\Component\Console\Input\InputInterface;
@@ -16,16 +17,11 @@
1617
use Symfony\Component\Console\Output\OutputInterface;
1718
use Symfony\Component\DependencyInjection\ContainerInterface;
1819

20+
#[AsCommand(name: 'ncr:export-nodes')]
1921
final class ExportNodesCommand extends Command
2022
{
21-
protected static $defaultName = 'ncr:export-nodes';
22-
protected ContainerInterface $container;
23-
protected Ncr $ncr;
24-
25-
public function __construct(ContainerInterface $container, Ncr $ncr)
23+
public function __construct(protected ContainerInterface $container, protected Ncr $ncr)
2624
{
27-
$this->container = $container;
28-
$this->ncr = $ncr;
2925
parent::__construct();
3026
}
3127

src/Command/GetNodeCommand.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
use Gdbots\Ncr\Ncr;
77
use Gdbots\Pbj\WellKnown\NodeRef;
8+
use Symfony\Component\Console\Attribute\AsCommand;
89
use Symfony\Component\Console\Command\Command;
910
use Symfony\Component\Console\Input\InputArgument;
1011
use Symfony\Component\Console\Input\InputInterface;
@@ -13,16 +14,11 @@
1314
use Symfony\Component\Console\Output\OutputInterface;
1415
use Symfony\Component\DependencyInjection\ContainerInterface;
1516

17+
#[AsCommand(name: 'ncr:get-node')]
1618
final class GetNodeCommand extends Command
1719
{
18-
protected static $defaultName = 'ncr:get-node';
19-
protected ContainerInterface $container;
20-
protected Ncr $ncr;
21-
22-
public function __construct(ContainerInterface $container, Ncr $ncr)
20+
public function __construct(protected ContainerInterface $container, protected Ncr $ncr)
2321
{
24-
$this->container = $container;
25-
$this->ncr = $ncr;
2622
parent::__construct();
2723
}
2824

src/Command/ReindexNodesCommand.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Gdbots\Pbj\SchemaCurie;
1111
use Gdbots\Pbj\SchemaQName;
1212
use Gdbots\Pbj\Util\NumberUtil;
13+
use Symfony\Component\Console\Attribute\AsCommand;
1314
use Symfony\Component\Console\Command\Command;
1415
use Symfony\Component\Console\Input\InputArgument;
1516
use Symfony\Component\Console\Input\InputInterface;
@@ -18,18 +19,14 @@
1819
use Symfony\Component\Console\Style\SymfonyStyle;
1920
use Symfony\Component\DependencyInjection\ContainerInterface;
2021

22+
#[AsCommand(name: 'ncr:reindex-nodes')]
2123
final class ReindexNodesCommand extends Command
2224
{
23-
protected static $defaultName = 'ncr:reindex-nodes';
24-
protected ContainerInterface $container;
25-
protected Ncr $ncr;
26-
protected NcrSearch $ncrSearch;
27-
28-
public function __construct(ContainerInterface $container, Ncr $ncr, NcrSearch $ncrSearch)
29-
{
30-
$this->container = $container;
31-
$this->ncr = $ncr;
32-
$this->ncrSearch = $ncrSearch;
25+
public function __construct(
26+
protected ContainerInterface $container,
27+
protected Ncr $ncr,
28+
protected NcrSearch $ncrSearch
29+
) {
3330
parent::__construct();
3431
}
3532

src/Command/SyncNodeCommand.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Gdbots\Ncr\NcrSearch;
1010
use Gdbots\Pbj\WellKnown\NodeRef;
1111
use Gdbots\Pbjx\Pbjx;
12+
use Symfony\Component\Console\Attribute\AsCommand;
1213
use Symfony\Component\Console\Command\Command;
1314
use Symfony\Component\Console\Input\InputArgument;
1415
use Symfony\Component\Console\Input\InputInterface;
@@ -17,20 +18,15 @@
1718
use Symfony\Component\Console\Style\SymfonyStyle;
1819
use Symfony\Component\DependencyInjection\ContainerInterface;
1920

21+
#[AsCommand(name: 'ncr:sync-node')]
2022
final class SyncNodeCommand extends Command
2123
{
22-
protected static $defaultName = 'ncr:sync-node';
23-
protected ContainerInterface $container;
24-
protected Ncr $ncr;
25-
protected NcrSearch $ncrSearch;
26-
protected Pbjx $pbjx;
27-
28-
public function __construct(ContainerInterface $container, Ncr $ncr, NcrSearch $ncrSearch, Pbjx $pbjx)
29-
{
30-
$this->container = $container;
31-
$this->ncr = $ncr;
32-
$this->ncrSearch = $ncrSearch;
33-
$this->pbjx = $pbjx;
24+
public function __construct(
25+
protected ContainerInterface $container,
26+
protected Ncr $ncr,
27+
protected NcrSearch $ncrSearch,
28+
protected Pbjx $pbjx
29+
) {
3430
parent::__construct();
3531
}
3632

src/Command/SyncNodesCommand.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Gdbots\Pbj\SchemaQName;
1313
use Gdbots\Pbj\Util\NumberUtil;
1414
use Gdbots\Pbjx\Pbjx;
15+
use Symfony\Component\Console\Attribute\AsCommand;
1516
use Symfony\Component\Console\Command\Command;
1617
use Symfony\Component\Console\Input\InputArgument;
1718
use Symfony\Component\Console\Input\InputInterface;
@@ -20,20 +21,15 @@
2021
use Symfony\Component\Console\Style\SymfonyStyle;
2122
use Symfony\Component\DependencyInjection\ContainerInterface;
2223

24+
#[AsCommand(name: 'ncr:sync-nodes')]
2325
final class SyncNodesCommand extends Command
2426
{
25-
protected static $defaultName = 'ncr:sync-nodes';
26-
protected ContainerInterface $container;
27-
protected Ncr $ncr;
28-
protected NcrSearch $ncrSearch;
29-
protected Pbjx $pbjx;
30-
31-
public function __construct(ContainerInterface $container, Ncr $ncr, NcrSearch $ncrSearch, Pbjx $pbjx)
32-
{
33-
$this->container = $container;
34-
$this->ncr = $ncr;
35-
$this->ncrSearch = $ncrSearch;
36-
$this->pbjx = $pbjx;
27+
public function __construct(
28+
protected ContainerInterface $container,
29+
protected Ncr $ncr,
30+
protected NcrSearch $ncrSearch,
31+
protected Pbjx $pbjx
32+
) {
3733
parent::__construct();
3834
}
3935

0 commit comments

Comments
 (0)