20
20
21
21
class StatusCommand extends Command
22
22
{
23
- private $ versionStorage ;
24
- private $ finder ;
25
-
26
23
public function __construct (
27
- VersionStorage $ versionStorage ,
28
- VersionFinder $ finder
24
+ private VersionStorage $ versionStorage ,
25
+ private VersionFinder $ finder,
29
26
) {
30
27
parent ::__construct ();
31
- $ this ->versionStorage = $ versionStorage ;
32
- $ this ->finder = $ finder ;
33
28
}
34
29
35
- public function configure ()
30
+ public function configure (): void
36
31
{
37
32
$ this ->setName ('phpcr:migrations:status ' );
38
33
$ this ->setDescription ('Show the current migration status ' );
@@ -48,10 +43,10 @@ public function configure()
48
43
);
49
44
}
50
45
51
- public function execute (InputInterface $ input , OutputInterface $ output )
46
+ public function execute (InputInterface $ input , OutputInterface $ output ): int
52
47
{
53
48
$ versionCollection = $ this ->finder ->getCollection ();
54
- $ executedVersions = ( array ) $ this ->versionStorage ->getPersistedVersions ();
49
+ $ executedVersions = $ this ->versionStorage ->getPersistedVersions ();
55
50
$ currentVersion = $ this ->versionStorage ->getCurrentVersion ();
56
51
57
52
$ table = new Table ($ output );
@@ -62,7 +57,7 @@ public function execute(InputInterface $input, OutputInterface $output)
62
57
foreach ($ versionCollection ->getAllVersions () as $ versionName => $ versionClass ) {
63
58
$ reflection = new \ReflectionClass ($ versionClass );
64
59
$ table ->addRow ([
65
- $ versionName == $ currentVersion ? '* ' : '' ,
60
+ $ versionName === $ currentVersion ? '* ' : '' ,
66
61
$ versionName ,
67
62
$ this ->getDate ($ versionName ),
68
63
isset ($ executedVersions [$ versionName ]) ? '<info> ' .$ executedVersions [$ versionName ]['executed ' ]->format ('Y-m-d H:i:s ' ).'</info> ' : 'n/a ' ,
@@ -81,7 +76,7 @@ public function execute(InputInterface $input, OutputInterface $output)
81
76
return 0 ;
82
77
}
83
78
84
- private function getDate ($ versionName )
79
+ private function getDate ($ versionName ): string
85
80
{
86
81
return date ('Y-m-d H:i ' , strtotime ($ versionName ));
87
82
}
0 commit comments