@@ -56,7 +56,7 @@ protected function configure(): void
5656 self ::OPTION_INCLUDE_VENDOR ,
5757 null ,
5858 InputOption::VALUE_NONE ,
59- 'Include vendor modules in scan (default: excluded, but included with -- third-party- only) '
59+ 'Include Magento core modules (default: third-party modules only) '
6060 )
6161 ->addOption (
6262 self ::OPTION_DETAILED ,
@@ -96,7 +96,8 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp
9696 label: 'Select scan options ' ,
9797 options: [
9898 'show-all ' => 'Show all modules including compatible ones ' ,
99- 'include-vendor ' => 'Include vendor modules (default: excluded) ' ,
99+ 'incompatible-only ' => 'Show only incompatible modules (default behavior) ' ,
100+ 'include-vendor ' => 'Include Magento core modules (default: third-party only) ' ,
100101 'detailed ' => 'Show detailed file-level issues with line numbers ' ,
101102 ],
102103 default: [],
@@ -110,6 +111,7 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp
110111
111112 // Apply selected options to input
112113 $ showAll = in_array ('show-all ' , $ selectedOptions );
114+ $ incompatibleOnly = in_array ('incompatible-only ' , $ selectedOptions );
113115 $ includeVendor = in_array ('include-vendor ' , $ selectedOptions );
114116 $ detailed = in_array ('detailed ' , $ selectedOptions );
115117 $ thirdPartyOnly = false ; // Not needed in interactive mode
@@ -119,11 +121,13 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp
119121 $ config = [];
120122 if ($ showAll ) {
121123 $ config [] = 'Show all modules ' ;
124+ } elseif ($ incompatibleOnly ) {
125+ $ config [] = 'Show incompatible only ' ;
122126 } else {
123127 $ config [] = 'Show modules with issues ' ;
124128 }
125129 if ($ includeVendor ) {
126- $ config [] = 'Include vendor modules ' ;
130+ $ config [] = 'Include Magento core ' ;
127131 } else {
128132 $ config [] = 'Third-party modules only ' ;
129133 }
@@ -133,8 +137,8 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp
133137 $ this ->io ->comment ('Configuration: ' . implode (', ' , $ config ));
134138 $ this ->io ->newLine ();
135139
136- // Run scan with selected options
137- return $ this ->runScan ($ showAll , $ thirdPartyOnly , $ includeVendor , $ detailed , false , $ output );
140+ // Run scan with selected options (pass incompatibleOnly flag)
141+ return $ this ->runScan ($ showAll , $ thirdPartyOnly , $ includeVendor , $ detailed , $ incompatibleOnly , $ output );
138142 } catch (\Exception $ e ) {
139143 $ this ->resetPromptEnvironment ();
140144 $ this ->io ->error ('Interactive mode failed: ' . $ e ->getMessage ());
@@ -171,12 +175,12 @@ private function runScan(
171175 OutputInterface $ output
172176 ): int {
173177
174- // Determine filter logic for vendor and third-party modules :
175- // - By default (no flags): scan third-party modules excluding those in vendor/
176- // - With --include-vendor: include vendor modules in the scan
177- // - With --third-party-only: explicitly scan only third-party modules
178- $ scanThirdPartyOnly = $ thirdPartyOnly || ( !$ includeVendor && ! $ thirdPartyOnly ) ;
179- $ excludeVendor = ! $ includeVendor ;
178+ // Determine filter logic:
179+ // - thirdPartyOnly: Only scan non-Magento_* modules (default behavior)
180+ // - includeVendor: Also scan Magento_* core modules
181+ // - excludeVendor: Whether to exclude vendor/ directory (always false for now)
182+ $ scanThirdPartyOnly = !$ includeVendor ;
183+ $ excludeVendor = false ;
180184
181185 // Run the compatibility check
182186 $ results = $ this ->compatibilityChecker ->check (
@@ -187,17 +191,14 @@ private function runScan(
187191 $ excludeVendor
188192 );
189193
190- // Determine display mode based on flags
191- // If incompatibleOnly is set, only show modules with issues
192- // If showAll is set, show everything
193- // Otherwise, show default (incompatible only)
194- $ displayShowAll = $ showAll ;
195- if ($ incompatibleOnly && !$ showAll ) {
196- $ displayShowAll = false ; // Only show incompatible
197- }
194+ // Determine display mode:
195+ // showAll = show all modules including compatible ones
196+ // incompatibleOnly = show only modules with critical issues
197+ // default = show modules with any issues (critical or warnings)
198+ $ displayShowAll = $ showAll && !$ incompatibleOnly ;
198199
199200 // Display results
200- $ this ->displayResults ($ results , $ displayShowAll || $ detailed );
201+ $ this ->displayResults ($ results , $ displayShowAll );
201202
202203 // Display detailed issues if requested
203204 if ($ detailed && $ results ['hasIncompatibilities ' ]) {
@@ -364,25 +365,9 @@ private function isInteractiveTerminal(OutputInterface $output): bool
364365 }
365366 }
366367
367- // Additional check: detect if running in a proper TTY using safer methods
368- if (\function_exists ('stream_isatty ' ) && \defined ('STDIN ' )) {
369- try {
370- return \stream_isatty (\STDIN );
371- } catch (\Throwable $ e ) {
372- // Fall through to next check
373- }
374- }
375-
376- if (\function_exists ('posix_isatty ' ) && \defined ('STDIN ' )) {
377- try {
378- return \posix_isatty (\STDIN );
379- } catch (\Throwable $ e ) {
380- // Fall through to default
381- }
382- }
383-
384- // Conservative default if no TTY-detection functions are available
385- return false ;
368+ // Additional check: try to detect if running in a proper TTY
369+ $ sttyOutput = shell_exec ('stty -g 2>/dev/null ' );
370+ return !empty ($ sttyOutput );
386371 }
387372
388373 /**
@@ -425,11 +410,7 @@ private function resetPromptEnvironment(): void
425410 */
426411 private function removeSecureEnvironmentValue (string $ name ): void
427412 {
428- // Remove the specific variable from our secure storage
429413 unset($ this ->secureEnvStorage [$ name ]);
430-
431- // Clear the static cache to force refresh on next access
432- $ this ->clearEnvironmentCache ();
433414 }
434415
435416 /**
@@ -461,19 +442,8 @@ private function getServerVar(string $name): ?string
461442 private function setEnvVar (string $ name , string $ value ): void
462443 {
463444 $ this ->secureEnvStorage [$ name ] = $ value ;
464- $ _SERVER [ $ name] = $ value ;
445+ putenv ( " $ name= $ value" ) ;
465446 }
466447
467- /**
468- * Clear environment cache
469- */
470- private function clearEnvironmentCache (): void
471- {
472- // Force refresh on next access by clearing our storage
473- $ this ->secureEnvStorage = array_filter (
474- $ this ->secureEnvStorage ,
475- fn ($ key ) => in_array ($ key , ['COLUMNS ' , 'LINES ' , 'TERM ' ]),
476- ARRAY_FILTER_USE_KEY
477- );
478- }
448+
479449}
0 commit comments