18
18
use Symfony \Component \Console \Command \Command ;
19
19
use Symfony \Component \Console \Input \InputArgument ;
20
20
use Symfony \Component \Console \Input \InputInterface ;
21
+ use Symfony \Component \HttpKernel \Kernel ;
21
22
use Symfony \Component \Security \Core \Authorization \Voter \Voter ;
22
23
23
24
/**
@@ -36,15 +37,15 @@ public static function getCommandDescription(): string
36
37
return 'Creates a new security voter class ' ;
37
38
}
38
39
39
- public function configureCommand (Command $ command , InputConfiguration $ inputConf )
40
+ public function configureCommand (Command $ command , InputConfiguration $ inputConfig ): void
40
41
{
41
42
$ command
42
43
->addArgument ('name ' , InputArgument::OPTIONAL , 'The name of the security voter class (e.g. <fg=yellow>BlogPostVoter</>) ' )
43
44
->setHelp (file_get_contents (__DIR__ .'/../Resources/help/MakeVoter.txt ' ))
44
45
;
45
46
}
46
47
47
- public function generate (InputInterface $ input , ConsoleStyle $ io , Generator $ generator )
48
+ public function generate (InputInterface $ input , ConsoleStyle $ io , Generator $ generator ): void
48
49
{
49
50
$ voterClassNameDetails = $ generator ->createClassNameDetails (
50
51
$ input ->getArgument ('name ' ),
@@ -55,7 +56,9 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
55
56
$ generator ->generateClass (
56
57
$ voterClassNameDetails ->getFullName (),
57
58
'security/Voter.tpl.php ' ,
58
- []
59
+ [
60
+ 'use_type_hints ' => 50000 <= Kernel::VERSION_ID ,
61
+ ]
59
62
);
60
63
61
64
$ generator ->writeChanges ();
@@ -68,7 +71,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
68
71
]);
69
72
}
70
73
71
- public function configureDependencies (DependencyBuilder $ dependencies )
74
+ public function configureDependencies (DependencyBuilder $ dependencies ): void
72
75
{
73
76
$ dependencies ->addClassDependency (
74
77
Voter::class,
0 commit comments