@@ -21,7 +21,7 @@ class InstallCommand extends Command
2121
2222 public $ description = 'Installs the package. ' ;
2323
24- public function handle ()
24+ public function handle (): int
2525 {
2626 if (! $ this ->option ('no-model ' )) {
2727 $ this ->publishMigration ();
@@ -39,7 +39,7 @@ public function handle()
3939 return self ::SUCCESS ;
4040 }
4141
42- private function publishMigration ()
42+ private function publishMigration (): void
4343 {
4444 FacadesProcess::forever ()->run ([
4545 $ this ->phpBinary (),
@@ -50,7 +50,7 @@ private function publishMigration()
5050 ], fn ($ _type , $ output ) => $ this ->output ->write ($ output ));
5151 }
5252
53- private function updateJsDependencies ()
53+ private function updateJsDependencies (): void
5454 {
5555 if ($ this ->usingImportmaps ()) {
5656 $ this ->installJsDependenciesWithImportmaps ();
@@ -59,7 +59,7 @@ private function updateJsDependencies()
5959 }
6060 }
6161
62- private function runDatabaseMigrations ()
62+ private function runDatabaseMigrations (): void
6363 {
6464 if (! $ this ->confirm ('A new migration was published to your app. Do you want to run it now? ' , true )) {
6565 return ;
@@ -99,9 +99,7 @@ private function jsDependencies(): array
9999
100100 private function updateJsDependenciesWithNpm (): void
101101 {
102- $ this ->updateNodePackages (function ($ packages ) {
103- return $ this ->jsDependencies () + $ packages ;
104- });
102+ static ::updateNodePackages (fn ($ packages ): array => $ this ->jsDependencies () + $ packages );
105103
106104 if (file_exists (base_path ('pnpm-lock.yaml ' ))) {
107105 $ this ->runCommands (['pnpm install ' , 'pnpm run build ' ]);
@@ -112,7 +110,7 @@ private function updateJsDependenciesWithNpm(): void
112110 }
113111 }
114112
115- private function runCommands ($ commands )
113+ private function runCommands (array $ commands ): void
116114 {
117115 $ process = Process::fromShellCommandline (implode (' && ' , $ commands ), null , null , null , null );
118116
@@ -124,7 +122,7 @@ private function runCommands($commands)
124122 }
125123 }
126124
127- $ process ->run (function ($ type , $ line ) {
125+ $ process ->run (function ($ type , string $ line ): void {
128126 $ this ->output ->write (' ' .$ line );
129127 });
130128 }
@@ -154,7 +152,7 @@ private function ensureTrixLibIsImported(): void
154152 $ entrypoint = Arr::first ([
155153 resource_path ('js/libs/index.js ' ),
156154 resource_path ('js/app.js ' ),
157- ], fn ($ file ) => file_exists ($ file ));
155+ ], fn ($ file ): bool => file_exists ($ file ));
158156
159157 if (! $ entrypoint ) {
160158 return ;
@@ -188,7 +186,7 @@ private function updateAppLayoutFiles(): void
188186 return ;
189187 }
190188
191- $ layouts ->each (function ($ file ) {
189+ $ layouts ->each (function ($ file ): void {
192190 $ contents = File::get ($ file );
193191
194192 if (str_contains ($ contents , '<x-rich-text::styles ' )) {
@@ -235,7 +233,7 @@ protected static function updateNodePackages(callable $callback, $dev = true)
235233 );
236234 }
237235
238- private function phpBinary ()
236+ private function phpBinary (): string
239237 {
240238 return (new PhpExecutableFinder )->find (false ) ?: 'php ' ;
241239 }
0 commit comments