|
4 | 4 |
|
5 | 5 | use Contributte\Console\Extra\Utils\Utils; |
6 | 6 | use Nette\Caching\Cache; |
7 | | -use Nette\Caching\IStorage; |
8 | 7 | use Nette\Caching\Storage; |
| 8 | +use Symfony\Component\Console\Attribute\AsCommand; |
9 | 9 | use Symfony\Component\Console\Command\Command; |
10 | 10 | use Symfony\Component\Console\Input\InputInterface; |
11 | 11 | use Symfony\Component\Console\Input\InputOption; |
12 | 12 | use Symfony\Component\Console\Output\OutputInterface; |
13 | 13 | use Symfony\Component\Console\Style\SymfonyStyle; |
14 | 14 |
|
| 15 | +#[AsCommand( |
| 16 | + name: 'nette:caching:clear', |
| 17 | + description: 'Clear Nette Caching Storage', |
| 18 | +)] |
15 | 19 | class CachingClearCommand extends Command |
16 | 20 | { |
17 | 21 |
|
18 | | - /** @var string */ |
19 | | - protected static $defaultName = 'nette:caching:clear'; |
20 | | - |
21 | | - /** @var IStorage */ |
22 | | - private $storage; |
| 22 | + private Storage $storage; |
23 | 23 |
|
24 | 24 | public function __construct(Storage $storage) |
25 | 25 | { |
26 | 26 | parent::__construct(); |
| 27 | + |
27 | 28 | $this->storage = $storage; |
28 | 29 | } |
29 | 30 |
|
30 | 31 | protected function configure(): void |
31 | 32 | { |
32 | | - $this->setName(static::$defaultName); |
33 | | - $this->setDescription('Clear Nette Caching Storage'); |
34 | 33 | $this->addOption('all', null, InputOption::VALUE_OPTIONAL, 'Clear whole storage', false); |
35 | 34 | $this->addOption('tag', 't', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Clear by tag(s)', []); |
36 | 35 | $this->addOption('priority', 'p', InputOption::VALUE_OPTIONAL, 'Clear by priority'); |
|
0 commit comments