Skip to content

Commit 53d0d21

Browse files
AJenboondrejmirtes
authored andcommitted
Attempt unloading Xdebug before showing warnings
The Xdebug warning was being shown even when XdebugHandler would avoid the slow down by unloading the extension. This avoids showing the warning for users who have not disabled XdebugHandler via env or other means.
1 parent 4e6f468 commit 53d0d21

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Command/CommandHelper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,19 @@ public static function begin(
9393
return new SymfonyOutput($symfonyErrorOutput, new SymfonyStyle(new ErrorsConsoleStyle($input, $symfonyErrorOutput)));
9494
})();
9595

96-
if ($allowXdebug && !XdebugHandler::isXdebugActive()) {
97-
$errorOutput->getStyle()->note('You are running with "--xdebug" enabled, but the Xdebug PHP extension is not active. The process will not halt at breakpoints.');
98-
} elseif (!$allowXdebug && XdebugHandler::isXdebugActive()) {
99-
$errorOutput->getStyle()->note('The Xdebug PHP extension is active, but "--xdebug" is not used. This may slow down performance and the process will not halt at breakpoints.');
100-
}
101-
10296
if (!$allowXdebug) {
10397
$xdebug = new XdebugHandler('phpstan');
10498
$xdebug->setPersistent();
10599
$xdebug->check();
106100
unset($xdebug);
107101
}
108102

103+
if ($allowXdebug && !XdebugHandler::isXdebugActive()) {
104+
$errorOutput->getStyle()->note('You are running with "--xdebug" enabled, but the Xdebug PHP extension is not active. The process will not halt at breakpoints.');
105+
} elseif (!$allowXdebug && XdebugHandler::isXdebugActive()) {
106+
$errorOutput->getStyle()->note('The Xdebug PHP extension is active, but "--xdebug" is not used. This may slow down performance and the process will not halt at breakpoints.');
107+
}
108+
109109
if ($memoryLimit !== null) {
110110
if (Strings::match($memoryLimit, '#^-?\d+[kMG]?$#i') === null) {
111111
$errorOutput->writeLineFormatted(sprintf('Invalid memory limit format "%s".', $memoryLimit));

0 commit comments

Comments
 (0)