44
55namespace DevWizardHQ \Enumify \Commands ;
66
7- use Exception ;
87use Illuminate \Console \Command ;
98use Illuminate \Support \Facades \File ;
9+ use Exception ;
1010use ReflectionEnum ;
1111
1212use function Laravel \Prompts \confirm ;
@@ -208,7 +208,7 @@ private function runInteractive(): int
208208 // Convert relative to absolute
209209 $ fullPath = base_path ($ path );
210210 if (! is_dir ($ fullPath )) {
211- $ this ->components -> error ("Directory not found: {$ path }" );
211+ $ this ->error ("Directory not found: {$ path }" );
212212
213213 return self ::FAILURE ;
214214 }
@@ -217,7 +217,7 @@ private function runInteractive(): int
217217 $ this ->scanDirectory ($ fullPath , $ selectedEnums );
218218
219219 if (empty ($ this ->issues )) {
220- $ this ->components -> info ('✅ No hardcoded enum values found! ' );
220+ $ this ->info ('✅ No hardcoded enum values found! ' );
221221
222222 return self ::SUCCESS ;
223223 }
@@ -230,7 +230,7 @@ private function runInteractive(): int
230230
231231 // Preview or apply
232232 if ($ mode === 'fix ' ) {
233- $ this ->components -> info ('🔍 Dry-run mode — showing proposed changes: ' );
233+ $ this ->info ('🔍 Dry-run mode — showing proposed changes: ' );
234234 $ this ->showProposedChanges ();
235235
236236 if (confirm ('Would you like to apply these changes? ' , false )) {
@@ -279,7 +279,7 @@ private function runNormalizeKeys(): int
279279
280280 if ($ isDryRun ) {
281281 $ this ->newLine ();
282- $ this ->components -> warn ('Dry-run mode — no changes made. Run with --fix to apply. ' );
282+ $ this ->warn ('Dry-run mode — no changes made. Run with --fix to apply. ' );
283283
284284 return self ::SUCCESS ;
285285 }
@@ -291,7 +291,7 @@ private function runNormalizeKeys(): int
291291 }
292292
293293 $ this ->newLine ();
294- $ this ->components -> info ('💡 Run with <fg=yellow>--dry-run</> to preview or <fg=yellow>--fix</> to apply changes. ' );
294+ $ this ->info ('💡 Run with <fg=yellow>--dry-run</> to preview or <fg=yellow>--fix</> to apply changes. ' );
295295
296296 return self ::SUCCESS ;
297297 }
@@ -306,7 +306,7 @@ private function runNormalizeKeysInteractive(): int
306306 $ this ->loadEnumsWithPaths ();
307307
308308 if (count ($ this ->enums ) === 0 ) {
309- $ this ->components -> error ('No enums found. ' );
309+ $ this ->error ('No enums found. ' );
310310
311311 return self ::FAILURE ;
312312 }
@@ -340,7 +340,7 @@ private function loadEnums(): void
340340 /** @var array<string> $paths */
341341 $ paths = config ('enumify.paths.enums ' , ['app/Enums ' ]);
342342
343- $ this ->components -> info ('📦 Loading enums... ' );
343+ $ this ->info ('📦 Loading enums... ' );
344344
345345 $ targetEnum = $ this ->option ('enum ' );
346346
@@ -398,7 +398,7 @@ private function loadEnums(): void
398398 }
399399
400400 $ count = count ($ this ->enums );
401- $ this ->components -> info ("✅ Loaded {$ count } enum " .($ count !== 1 ? 's ' : '' ));
401+ $ this ->info ("✅ Loaded {$ count } enum " .($ count !== 1 ? 's ' : '' ));
402402 $ this ->newLine ();
403403 }
404404
@@ -443,7 +443,7 @@ private function getClassFromFile(string $path): ?string
443443 */
444444 private function findNonUppercaseKeys (): void
445445 {
446- $ this ->components -> info ('🔍 Scanning for non-UPPERCASE enum keys... ' );
446+ $ this ->info ('🔍 Scanning for non-UPPERCASE enum keys... ' );
447447 $ this ->newLine ();
448448
449449 foreach ($ this ->enums as $ className => $ enumData ) {
@@ -520,7 +520,7 @@ private function findEnumReferences(string $enumName, string $caseName): array
520520 */
521521 private function displayKeyNormalizationResults (): void
522522 {
523- $ this ->components -> warn ('⚠️ Found ' .count ($ this ->keyNormalizationIssues ).' key(s) to normalize: ' );
523+ $ this ->warn ('⚠️ Found ' .count ($ this ->keyNormalizationIssues ).' key(s) to normalize: ' );
524524 $ this ->newLine ();
525525
526526 $ totalRefs = 0 ;
@@ -540,15 +540,15 @@ private function displayKeyNormalizationResults(): void
540540 }
541541
542542 $ this ->newLine ();
543- $ this ->components -> info ('📊 Total: ' .count ($ this ->keyNormalizationIssues )." keys, {$ totalRefs } references " );
543+ $ this ->info ('📊 Total: ' .count ($ this ->keyNormalizationIssues )." keys, {$ totalRefs } references " );
544544 }
545545
546546 /**
547547 * Apply key normalization changes.
548548 */
549549 private function applyKeyNormalization (bool $ withBackup ): int
550550 {
551- $ this ->components -> info ('✏️ Applying key normalization... ' );
551+ $ this ->info ('✏️ Applying key normalization... ' );
552552 $ this ->newLine ();
553553
554554 $ filesChanged = 0 ;
@@ -633,7 +633,7 @@ private function applyKeyNormalization(bool $withBackup): int
633633 }
634634
635635 $ this ->newLine ();
636- $ this ->components -> info ("✅ Normalized {$ keysChanged } keys, updated {$ refsUpdated } references in {$ filesChanged } file(s) " );
636+ $ this ->info ("✅ Normalized {$ keysChanged } keys, updated {$ refsUpdated } references in {$ filesChanged } file(s) " );
637637
638638 if ($ withBackup ) {
639639 $ this ->line ('<fg=gray>Backups saved to: storage/app/enumify-refactor-backups/</> ' );
@@ -657,12 +657,12 @@ private function scan(): int
657657 }
658658
659659 if (! is_dir ($ path )) {
660- $ this ->components -> error ("Directory not found: {$ pathOption }" );
660+ $ this ->error ("Directory not found: {$ pathOption }" );
661661
662662 return self ::FAILURE ;
663663 }
664664
665- $ this ->components -> info ("🔍 Scanning: {$ path }" );
665+ $ this ->info ("🔍 Scanning: {$ path }" );
666666 $ this ->newLine ();
667667
668668 $ this ->scanDirectory ($ path );
@@ -709,7 +709,7 @@ private function scanDirectory(string $path, ?array $targetEnums = null): void
709709 $ phpFiles = array_values ($ phpFiles );
710710
711711 if (empty ($ phpFiles )) {
712- $ this ->components -> warn ('No PHP files found to scan. ' );
712+ $ this ->warn ('No PHP files found to scan. ' );
713713
714714 return ;
715715 }
@@ -867,12 +867,12 @@ private function checkAndAddIssue(
867867 private function displayResults (): void
868868 {
869869 if (empty ($ this ->issues )) {
870- $ this ->components -> info ('✅ No hardcoded enum values found! ' );
870+ $ this ->info ('✅ No hardcoded enum values found! ' );
871871
872872 return ;
873873 }
874874
875- $ this ->components -> warn ('⚠️ Found ' .count ($ this ->issues ).' potential hardcoded enum value(s): ' );
875+ $ this ->warn ('⚠️ Found ' .count ($ this ->issues ).' potential hardcoded enum value(s): ' );
876876 $ this ->newLine ();
877877
878878 $ byFile = [];
@@ -912,7 +912,7 @@ private function displaySummaryTable(): void
912912 $ byType [$ issue ['type ' ]] = ($ byType [$ issue ['type ' ]] ?? 0 ) + 1 ;
913913 }
914914
915- $ this ->components -> info ('📊 Summary: ' );
915+ $ this ->info ('📊 Summary: ' );
916916 $ this ->newLine ();
917917
918918 $ enumRows = [];
@@ -930,7 +930,7 @@ private function displaySummaryTable(): void
930930 $ this ->table (['Pattern Type ' , 'Issues ' ], $ typeRows );
931931
932932 $ this ->newLine ();
933- $ this ->components -> info ('💡 Run with <fg=yellow>--dry-run</> (-d) to preview changes or <fg=yellow>--fix</> (-f) to apply them. ' );
933+ $ this ->info ('💡 Run with <fg=yellow>--dry-run</> (-d) to preview changes or <fg=yellow>--fix</> (-f) to apply them. ' );
934934 }
935935
936936 /**
@@ -962,9 +962,9 @@ private function generateSuggestion(array $issue): string
962962 private function fix (bool $ dryRun ): int
963963 {
964964 if ($ dryRun ) {
965- $ this ->components -> info ('🔍 <fg=yellow>DRY-RUN MODE</> — No changes will be made ' );
965+ $ this ->info ('🔍 <fg=yellow>DRY-RUN MODE</> — No changes will be made ' );
966966 } else {
967- $ this ->components -> info ('✏️ <fg=green>APPLY MODE</> — Changes will be written to files ' );
967+ $ this ->info ('✏️ <fg=green>APPLY MODE</> — Changes will be written to files ' );
968968 }
969969 $ this ->newLine ();
970970
@@ -976,7 +976,7 @@ private function fix(bool $dryRun): int
976976 $ this ->scanDirectory ($ path );
977977
978978 if (empty ($ this ->issues )) {
979- $ this ->components -> info ('✅ No issues to fix! ' );
979+ $ this ->info ('✅ No issues to fix! ' );
980980
981981 return self ::SUCCESS ;
982982 }
@@ -985,7 +985,7 @@ private function fix(bool $dryRun): int
985985
986986 if ($ dryRun ) {
987987 $ this ->newLine ();
988- $ this ->components -> info ('Run with <fg=yellow>--fix</> (-f) to apply these changes. ' );
988+ $ this ->info ('Run with <fg=yellow>--fix</> (-f) to apply these changes. ' );
989989
990990 return self ::SUCCESS ;
991991 }
@@ -1000,7 +1000,7 @@ private function fix(bool $dryRun): int
10001000 */
10011001 private function showProposedChanges (): void
10021002 {
1003- $ this ->components -> info ('📝 Proposed Changes: ' );
1003+ $ this ->info ('📝 Proposed Changes: ' );
10041004 $ this ->newLine ();
10051005
10061006 $ byFile = [];
@@ -1036,7 +1036,7 @@ private function applyChanges(bool $withBackup): int
10361036 foreach ($ byFile as $ file => $ issues ) {
10371037 $ fullPath = $ this ->isAbsolutePath ($ file ) ? $ file : base_path ($ file );
10381038 if (! file_exists ($ fullPath )) {
1039- $ this ->components -> warn ("File not found: {$ fullPath }" );
1039+ $ this ->warn ("File not found: {$ fullPath }" );
10401040
10411041 continue ;
10421042 }
@@ -1071,7 +1071,7 @@ private function applyChanges(bool $withBackup): int
10711071 }
10721072
10731073 $ this ->newLine ();
1074- $ this ->components -> info ("✅ Applied {$ changesApplied } changes in {$ filesChanged } file(s) " );
1074+ $ this ->info ("✅ Applied {$ changesApplied } changes in {$ filesChanged } file(s) " );
10751075
10761076 if ($ withBackup ) {
10771077 $ this ->line ('<fg=gray>Backups saved to: storage/app/enumify-refactor-backups/</> ' );
@@ -1179,7 +1179,7 @@ private function exportReport(string $path): void
11791179 };
11801180
11811181 file_put_contents ($ path , $ content );
1182- $ this ->components -> info ("📄 Report exported to: {$ path }" );
1182+ $ this ->info ("📄 Report exported to: {$ path }" );
11831183 }
11841184
11851185 /**
0 commit comments