88use DirectoryTree \OpenSearchMigrations \Repositories \MigrationRepository ;
99use Illuminate \Console \OutputStyle ;
1010use Illuminate \Support \Collection ;
11+ use Symfony \Component \Console \Output \NullOutput ;
12+ use Symfony \Component \Console \Output \OutputInterface ;
1113
1214/**
1315 * Runs and rolls back OpenSearch migration files.
@@ -17,7 +19,7 @@ class Migrator
1719 /**
1820 * The console output implementation.
1921 */
20- protected OutputStyle $ output ;
22+ protected OutputInterface $ output ;
2123
2224 /**
2325 * Create a new migrator instance.
@@ -26,7 +28,9 @@ public function __construct(
2628 protected MigrationRepository $ migrationRepository ,
2729 protected MigrationStorage $ migrationStorage ,
2830 protected MigrationFactory $ migrationFactory
29- ) {}
31+ ) {
32+ $ this ->output = new NullOutput ;
33+ }
3034
3135 /**
3236 * Set the console output implementation.
@@ -133,7 +137,9 @@ public function showStatus(): self
133137 ];
134138 })->toArray ();
135139
136- $ this ->output ->table ($ headers , $ rows );
140+ if ($ this ->output instanceof OutputStyle) {
141+ $ this ->output ->table ($ headers , $ rows );
142+ }
137143
138144 return $ this ;
139145 }
0 commit comments