12
12
namespace FOS \HttpCacheBundle \Command ;
13
13
14
14
use FOS \HttpCacheBundle \CacheManager ;
15
+ use Symfony \Component \Console \Attribute \AsCommand ;
15
16
use Symfony \Component \Console \Input \InputArgument ;
16
17
use Symfony \Component \Console \Input \InputInterface ;
17
18
use Symfony \Component \Console \Output \OutputInterface ;
22
23
* @author Christian Stocker <[email protected] >
23
24
* @author David Buchmann <[email protected] >
24
25
*/
26
+ #[AsCommand(name: 'fos:httpcache:invalidate:regex ' )]
25
27
class InvalidateRegexCommand extends BaseInvalidateCommand
26
28
{
27
- protected static $ defaultName = 'fos:httpcache:invalidate:regex ' ;
28
-
29
29
/**
30
30
* If no cache manager is specified explicitly, fos_http_cache.cache_manager
31
31
* is automatically loaded.
@@ -34,11 +34,12 @@ class InvalidateRegexCommand extends BaseInvalidateCommand
34
34
*/
35
35
public function __construct (CacheManager $ cacheManager = null , $ commandName = 'fos:httpcache:invalidate:regex ' )
36
36
{
37
+ parent ::__construct ($ cacheManager );
38
+
37
39
if (2 <= func_num_args ()) {
38
40
@trigger_error ('Passing a command name in the constructor is deprecated and will be removed in version 3 ' , E_USER_DEPRECATED );
39
- static :: $ defaultName = func_get_arg (1 );
41
+ $ this -> setName ( func_get_arg (1 ) );
40
42
}
41
- parent ::__construct ($ cacheManager );
42
43
}
43
44
44
45
/**
@@ -47,6 +48,7 @@ public function __construct(CacheManager $cacheManager = null, $commandName = 'f
47
48
protected function configure ()
48
49
{
49
50
$ this
51
+ ->setName ('fos:httpcache:invalidate:regex ' )
50
52
->setDescription ('Invalidate everything matching a regular expression on all configured caching proxies ' )
51
53
->addArgument (
52
54
'regex ' ,
0 commit comments