1010use Symfony \Component \HttpFoundation \Request ;
1111use Symfony \Component \HttpFoundation \Response ;
1212use Symfony \Component \HttpKernel \DataCollector \DataCollector ;
13+ use Symfony \Component \VarDumper \Cloner \Data ;
14+ use Throwable ;
15+
16+ use function count ;
17+ use function get_class ;
1318
1419class MigrationsCollector extends DataCollector
1520{
@@ -21,20 +26,18 @@ class MigrationsCollector extends DataCollector
2126 public function __construct (DependencyFactory $ dependencyFactory , MigrationsFlattener $ migrationsFlattener )
2227 {
2328 $ this ->dependencyFactory = $ dependencyFactory ;
24- $ this ->flattener = $ migrationsFlattener ;
29+ $ this ->flattener = $ migrationsFlattener ;
2530 }
2631
27- /**
28- * @return void
29- */
30- public function collect (Request $ request , Response $ response , \Throwable $ exception = null )
32+ /** @return void */
33+ public function collect (Request $ request , Response $ response , ?Throwable $ exception = null )
3134 {
32- if (!empty ($ this ->data )) {
35+ if (! empty ($ this ->data )) {
3336 return ;
3437 }
3538
3639 $ metadataStorage = $ this ->dependencyFactory ->getMetadataStorage ();
37- $ planCalculator = $ this ->dependencyFactory ->getMigrationPlanCalculator ();
40+ $ planCalculator = $ this ->dependencyFactory ->getMigrationPlanCalculator ();
3841
3942 try {
4043 $ executedMigrations = $ metadataStorage ->getExecutedMigrations ();
@@ -49,45 +52,42 @@ public function collect(Request $request, Response $response, \Throwable $except
4952
5053 $ availableMigrations = $ planCalculator ->getMigrations ();
5154
52- $ this ->data ['available_migrations_count ' ] = count ($ availableMigrations );
53- $ unavailableMigrations = $ executedMigrations ->unavailableSubset ($ availableMigrations );
55+ $ this ->data ['available_migrations_count ' ] = count ($ availableMigrations );
56+ $ unavailableMigrations = $ executedMigrations ->unavailableSubset ($ availableMigrations );
5457 $ this ->data ['unavailable_migrations_count ' ] = count ($ unavailableMigrations );
5558
56- $ newMigrations = $ availableMigrations ->newSubset ($ executedMigrations );
57- $ this ->data ['new_migrations ' ] = $ this ->flattener ->flattenAvailableMigrations ($ newMigrations );
59+ $ newMigrations = $ availableMigrations ->newSubset ($ executedMigrations );
60+ $ this ->data ['new_migrations ' ] = $ this ->flattener ->flattenAvailableMigrations ($ newMigrations );
5861 $ this ->data ['executed_migrations ' ] = $ this ->flattener ->flattenExecutedMigrations ($ executedMigrations , $ availableMigrations );
5962
6063 $ this ->data ['storage ' ] = get_class ($ metadataStorage );
61- $ configuration = $ this ->dependencyFactory ->getConfiguration ();
62- $ storage = $ configuration ->getMetadataStorageConfiguration ();
64+ $ configuration = $ this ->dependencyFactory ->getConfiguration ();
65+ $ storage = $ configuration ->getMetadataStorageConfiguration ();
6366 if ($ storage instanceof TableMetadataStorageConfiguration) {
64- $ this ->data ['table ' ] = $ storage ->getTableName ();
67+ $ this ->data ['table ' ] = $ storage ->getTableName ();
6568 $ this ->data ['column ' ] = $ storage ->getVersionColumnName ();
6669 }
6770
68- $ connection = $ this ->dependencyFactory ->getConnection ();
71+ $ connection = $ this ->dependencyFactory ->getConnection ();
6972 $ this ->data ['driver ' ] = get_class ($ connection ->getDriver ());
70- $ this ->data ['name ' ] = $ connection ->getDatabase ();
73+ $ this ->data ['name ' ] = $ connection ->getDatabase ();
7174
7275 $ this ->data ['namespaces ' ] = $ configuration ->getMigrationDirectories ();
7376 }
7477
75- /**
76- * @return string
77- */
78+ /** @return string */
7879 public function getName ()
7980 {
8081 return 'doctrine_migrations ' ;
8182 }
8283
84+ /** @return array<string, mixed>|Data */
8385 public function getData ()
8486 {
8587 return $ this ->data ;
8688 }
8789
88- /**
89- * @return void
90- */
90+ /** @return void */
9191 public function reset ()
9292 {
9393 $ this ->data = [];
0 commit comments