mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
add --xdebug option
This commit is contained in:
parent
51403e5348
commit
e5194fecc2
@ -51,12 +51,6 @@ script:
|
||||
php bin/run_all_sets.php
|
||||
fi
|
||||
|
||||
# try #2205 w/ xdebug
|
||||
- |
|
||||
if [[ $COVERAGE == true ]]; then
|
||||
bin/rector -c
|
||||
fi
|
||||
|
||||
# Eat your own dog food
|
||||
- |
|
||||
if [[ $DOG_FOOD == true ]]; then
|
||||
|
@ -25,16 +25,7 @@ try {
|
||||
}
|
||||
|
||||
// And from --config or default one
|
||||
$argInput = new ArgvInput();
|
||||
|
||||
// https://github.com/rectorphp/rector/issues/2205
|
||||
$configOptionValue = ConfigFileFinder::getOptionValue($argInput, ['-c', '--config']);
|
||||
if ($configOptionValue === '--ansi') {
|
||||
// empty --config with xdebug handler
|
||||
die('Option "-c" or "--config" cannot be empty. Provide path to config file' . PHP_EOL);
|
||||
}
|
||||
|
||||
ConfigFileFinder::detectFromInput('rector', $argInput);
|
||||
ConfigFileFinder::detectFromInput('rector', new ArgvInput());
|
||||
$configs[] = ConfigFileFinder::provide('rector', ['rector.yml', 'rector.yaml']);
|
||||
|
||||
// remove empty values
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Composer\XdebugHandler\XdebugHandler;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Rector\Console\Application;
|
||||
|
||||
@ -15,10 +14,6 @@ gc_disable();
|
||||
// Require Composer autoload.php
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
$xdebug = new XdebugHandler('rector', '--ansi');
|
||||
$xdebug->check();
|
||||
unset($xdebug);
|
||||
|
||||
/** @var ContainerInterface $container */
|
||||
$container = require_once __DIR__ . '/container.php';
|
||||
|
||||
|
1
ecs.yaml
1
ecs.yaml
@ -46,6 +46,7 @@ services:
|
||||
- 'Symfony\Component\Console\Input\*Input'
|
||||
- 'PHPStan\Analyser\NameScope'
|
||||
- 'PHPStan\Rules\RuleErrors\RuleError*'
|
||||
- '*\XdebugHandler'
|
||||
|
||||
Symplify\CodingStandard\Fixer\Naming\PropertyNameMatchingTypeFixer:
|
||||
extra_skipped_classes:
|
||||
|
@ -167,6 +167,13 @@ final class Application extends SymfonyApplication
|
||||
'Enable debug verbosity (-vvv)'
|
||||
));
|
||||
|
||||
$inputDefinition->addOption(new InputOption(
|
||||
'xdebug',
|
||||
null,
|
||||
InputOption::VALUE_NONE,
|
||||
'Allow running xdebug'
|
||||
));
|
||||
|
||||
$inputDefinition->addOption(new InputOption(
|
||||
'--working-dir',
|
||||
'-d',
|
||||
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\Console\Command;
|
||||
|
||||
use Composer\XdebugHandler\XdebugHandler;
|
||||
use Nette\Utils\Strings;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Descriptor\TextDescriptor;
|
||||
@ -60,5 +61,12 @@ abstract class AbstractCommand extends Command
|
||||
|
||||
$this->getApplication()->setCatchExceptions(false);
|
||||
}
|
||||
|
||||
// @fixes https://github.com/rectorphp/rector/issues/2205
|
||||
if ($input->getOption('xdebug')) {
|
||||
$xdebug = new XdebugHandler('rector', '--ansi');
|
||||
$xdebug->check();
|
||||
unset($xdebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user