2020
2121class StatusCommand extends Command
2222{
23- private $ versionStorage ;
24- private $ finder ;
25-
2623 public function __construct (
27- VersionStorage $ versionStorage ,
28- VersionFinder $ finder
24+ private VersionStorage $ versionStorage ,
25+ private VersionFinder $ finder,
2926 ) {
3027 parent ::__construct ();
31- $ this ->versionStorage = $ versionStorage ;
32- $ this ->finder = $ finder ;
3328 }
3429
35- public function configure ()
30+ public function configure (): void
3631 {
3732 $ this ->setName ('phpcr:migrations:status ' );
3833 $ this ->setDescription ('Show the current migration status ' );
@@ -48,10 +43,10 @@ public function configure()
4843 );
4944 }
5045
51- public function execute (InputInterface $ input , OutputInterface $ output )
46+ public function execute (InputInterface $ input , OutputInterface $ output ): int
5247 {
5348 $ versionCollection = $ this ->finder ->getCollection ();
54- $ executedVersions = ( array ) $ this ->versionStorage ->getPersistedVersions ();
49+ $ executedVersions = $ this ->versionStorage ->getPersistedVersions ();
5550 $ currentVersion = $ this ->versionStorage ->getCurrentVersion ();
5651
5752 $ table = new Table ($ output );
@@ -62,7 +57,7 @@ public function execute(InputInterface $input, OutputInterface $output)
6257 foreach ($ versionCollection ->getAllVersions () as $ versionName => $ versionClass ) {
6358 $ reflection = new \ReflectionClass ($ versionClass );
6459 $ table ->addRow ([
65- $ versionName == $ currentVersion ? '* ' : '' ,
60+ $ versionName === $ currentVersion ? '* ' : '' ,
6661 $ versionName ,
6762 $ this ->getDate ($ versionName ),
6863 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)
8176 return 0 ;
8277 }
8378
84- private function getDate ($ versionName )
79+ private function getDate ($ versionName ): string
8580 {
8681 return date ('Y-m-d H:i ' , strtotime ($ versionName ));
8782 }
0 commit comments