66
77use InvalidArgumentException ;
88use Laravel \Prompts \SearchPrompt ;
9+ use Magento \Framework \Console \Cli ;
910use Magento \Framework \Filesystem \DirectoryList ;
1011use Magento \Framework \Filesystem ;
1112use OpenForgeProject \MageForge \Console \Command \AbstractCommand ;
@@ -57,7 +58,7 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
5758
5859 if (!file_exists ($ absoluteSourcePath )) {
5960 $ this ->io ->error ("Source file not found: $ absoluteSourcePath " );
60- return self ::RETURN_FAILURE ;
61+ return Cli ::RETURN_FAILURE ;
6162 }
6263
6364 // 2. Select Theme if missing
@@ -70,7 +71,7 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
7071
7172 if (empty ($ options )) {
7273 $ this ->io ->error ('No themes found to copy to. ' );
73- return self ::RETURN_FAILURE ;
74+ return Cli ::RETURN_FAILURE ;
7475 }
7576
7677 // Fix Environment for DDEV (Required for Laravel Prompts)
@@ -90,10 +91,10 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
9091 $ theme = $ this ->themeList ->getThemeByCode ($ themeCode );
9192 if (!$ theme ) {
9293 $ this ->io ->error ("Theme not found: $ themeCode " );
93- return self ::RETURN_FAILURE ;
94+ return Cli ::RETURN_FAILURE ;
9495 }
95-
96- // Use View\Design\ThemeInterface::getFullPath() if available,
96+
97+ // Use View\Design\ThemeInterface::getFullPath() if available,
9798 // fallback to calculating path assuming app/design/frontend structure if needed,
9899 // but Theme model normally has getFullPath().
99100 // Let's verify what interface we have. We likely have Magento\Theme\Model\Theme which has getFullPath().
@@ -115,7 +116,7 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
115116 $ destinationRelative = $ this ->vendorFileMapper ->mapToThemePath ($ sourceFile , $ themePath );
116117 } catch (\Exception $ e ) {
117118 $ this ->io ->error ($ e ->getMessage ());
118- return self ::RETURN_FAILURE ;
119+ return Cli ::RETURN_FAILURE ;
119120 }
120121
121122 $ absoluteDestPath = $ rootPath . '/ ' . $ destinationRelative ;
@@ -131,11 +132,11 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
131132 if (file_exists ($ absoluteDestPath )) {
132133 $ this ->io ->warning ("File already exists at destination! " );
133134 if (!$ this ->io ->confirm ('Overwrite existing file? ' , false )) {
134- return self ::RETURN_SUCCESS ;
135+ return Cli ::RETURN_SUCCESS ;
135136 }
136137 } else {
137138 if (!$ this ->io ->confirm ('Proceed with copy? ' , true )) {
138- return self ::RETURN_SUCCESS ;
139+ return Cli ::RETURN_SUCCESS ;
139140 }
140141 }
141142
@@ -151,12 +152,10 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
151152 $ this ->io ->success ("File copied successfully. " );
152153 } catch (\Exception $ e ) {
153154 $ this ->io ->error ("Failed to copy file: " . $ e ->getMessage ());
154- return self ::RETURN_FAILURE ;
155+ return Cli ::RETURN_FAILURE ;
155156 }
156157
157- return self ::RETURN_SUCCESS ;
158- }
159-
158+ return Cli::RETURN_SUCCESS ;
160159 private function fixPromptEnvironment (): void
161160 {
162161 if (getenv ('DDEV_PROJECT ' )) {
0 commit comments