2020-07-16 13:07:08 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-12-29 01:32:48 +01:00
|
|
|
use Composer\Semver\VersionParser;
|
2020-07-28 00:19:38 +08:00
|
|
|
use Doctrine\Inflector\Inflector;
|
|
|
|
use Doctrine\Inflector\Rules\English\InflectorFactory;
|
2020-07-16 13:07:08 +02:00
|
|
|
use PhpParser\BuilderFactory;
|
|
|
|
use PhpParser\Lexer;
|
|
|
|
use PhpParser\NodeFinder;
|
|
|
|
use PhpParser\NodeVisitor\CloningVisitor;
|
|
|
|
use PhpParser\Parser;
|
|
|
|
use PhpParser\ParserFactory;
|
2020-10-10 19:42:43 +02:00
|
|
|
use Rector\Core\Bootstrap\NoRectorsLoadedReporter;
|
2020-11-23 15:10:13 +01:00
|
|
|
use Rector\Core\Configuration\RectorClassesProvider;
|
2020-11-23 20:16:48 +01:00
|
|
|
use Rector\Core\Console\ConsoleApplication;
|
2020-07-16 13:07:08 +02:00
|
|
|
use Rector\Core\PhpParser\Parser\NikicPhpParserFactory;
|
2020-10-05 00:19:25 +02:00
|
|
|
use Rector\Core\PhpParser\Parser\PhpParserLexerFactory;
|
2020-07-16 13:07:08 +02:00
|
|
|
use Symfony\Component\Console\Application as SymfonyApplication;
|
|
|
|
use Symfony\Component\Console\Descriptor\TextDescriptor;
|
2020-07-19 10:34:30 +02:00
|
|
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
2020-07-18 11:24:54 +02:00
|
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
2021-01-08 15:04:35 +01:00
|
|
|
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
|
2020-07-16 13:07:08 +02:00
|
|
|
use Symfony\Component\Filesystem\Filesystem;
|
2020-11-23 20:16:48 +01:00
|
|
|
use Symplify\PackageBuilder\Console\Command\CommandNaming;
|
2020-07-20 10:20:23 +02:00
|
|
|
use Symplify\PackageBuilder\Console\Style\SymfonyStyleFactory;
|
2020-07-16 13:07:08 +02:00
|
|
|
use Symplify\PackageBuilder\Parameter\ParameterProvider;
|
|
|
|
use Symplify\PackageBuilder\Reflection\PrivatesAccessor;
|
|
|
|
use Symplify\PackageBuilder\Reflection\PrivatesCaller;
|
|
|
|
use Symplify\PackageBuilder\Strings\StringFormatConverter;
|
|
|
|
use Symplify\SmartFileSystem\FileSystemFilter;
|
|
|
|
use Symplify\SmartFileSystem\Finder\FinderSanitizer;
|
2020-07-20 00:48:51 +02:00
|
|
|
use Symplify\SmartFileSystem\SmartFileSystem;
|
2020-07-16 13:07:08 +02:00
|
|
|
|
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
|
|
$services = $containerConfigurator->services();
|
|
|
|
|
|
|
|
$services->defaults()
|
|
|
|
->public()
|
2020-09-23 11:16:40 +02:00
|
|
|
->autowire()
|
|
|
|
->autoconfigure();
|
2020-07-16 13:07:08 +02:00
|
|
|
|
|
|
|
$services->load('Rector\Core\\', __DIR__ . '/../src')
|
|
|
|
->exclude([
|
2020-09-23 11:16:40 +02:00
|
|
|
__DIR__ . '/../src/Rector',
|
|
|
|
__DIR__ . '/../src/Exception',
|
|
|
|
__DIR__ . '/../src/DependencyInjection/CompilerPass',
|
|
|
|
__DIR__ . '/../src/DependencyInjection/Loader',
|
|
|
|
__DIR__ . '/../src/HttpKernel',
|
|
|
|
__DIR__ . '/../src/ValueObject',
|
|
|
|
__DIR__ . '/../src/Bootstrap',
|
2020-10-05 10:39:02 +02:00
|
|
|
__DIR__ . '/../src/PhpParser/Node/CustomNode',
|
2020-07-16 13:07:08 +02:00
|
|
|
]);
|
|
|
|
|
2020-11-23 20:16:48 +01:00
|
|
|
$services->alias(SymfonyApplication::class, ConsoleApplication::class);
|
2020-07-16 13:07:08 +02:00
|
|
|
|
2020-10-10 19:42:43 +02:00
|
|
|
$services->set(NoRectorsLoadedReporter::class);
|
|
|
|
|
2020-07-16 13:07:08 +02:00
|
|
|
$services->set(TextDescriptor::class);
|
|
|
|
|
|
|
|
$services->set(ParserFactory::class);
|
|
|
|
$services->set(BuilderFactory::class);
|
|
|
|
$services->set(CloningVisitor::class);
|
|
|
|
$services->set(NodeFinder::class);
|
|
|
|
|
|
|
|
$services->set(Parser::class)
|
2021-01-08 15:04:35 +01:00
|
|
|
->factory([service(NikicPhpParserFactory::class), 'create']);
|
2020-07-16 13:07:08 +02:00
|
|
|
|
|
|
|
$services->set(Lexer::class)
|
2021-01-08 15:04:35 +01:00
|
|
|
->factory([service(PhpParserLexerFactory::class), 'create']);
|
2020-07-16 13:07:08 +02:00
|
|
|
|
2020-11-23 20:16:48 +01:00
|
|
|
// symplify/package-builder
|
2020-07-16 13:07:08 +02:00
|
|
|
$services->set(Filesystem::class);
|
|
|
|
$services->set(PrivatesAccessor::class);
|
2020-09-23 11:16:40 +02:00
|
|
|
$services->set(PrivatesCaller::class);
|
2020-07-16 13:07:08 +02:00
|
|
|
$services->set(FinderSanitizer::class);
|
|
|
|
$services->set(FileSystemFilter::class);
|
|
|
|
$services->set(ParameterProvider::class);
|
2020-11-23 15:10:13 +01:00
|
|
|
$services->set(ParameterProvider::class)
|
2021-01-08 15:04:35 +01:00
|
|
|
->arg('$container', service('service_container'));
|
2020-11-23 15:10:13 +01:00
|
|
|
|
|
|
|
$services->set(RectorClassesProvider::class)
|
2021-01-08 15:04:35 +01:00
|
|
|
->arg('$container', service('service_container'));
|
2020-11-23 15:10:13 +01:00
|
|
|
|
2020-11-23 20:16:48 +01:00
|
|
|
$services->set(CommandNaming::class);
|
|
|
|
|
2020-09-23 11:16:40 +02:00
|
|
|
$services->set(SmartFileSystem::class);
|
2020-07-16 13:07:08 +02:00
|
|
|
|
|
|
|
$services->set(StringFormatConverter::class);
|
|
|
|
|
2020-07-19 10:34:30 +02:00
|
|
|
$services->set(SymfonyStyleFactory::class);
|
|
|
|
$services->set(SymfonyStyle::class)
|
2021-01-08 15:04:35 +01:00
|
|
|
->factory([service(SymfonyStyleFactory::class), 'create']);
|
2020-07-28 00:19:38 +08:00
|
|
|
|
|
|
|
$services->set(InflectorFactory::class);
|
|
|
|
|
|
|
|
$services->set(Inflector::class)
|
2021-01-08 15:04:35 +01:00
|
|
|
->factory([service(InflectorFactory::class), 'build']);
|
2020-12-29 01:32:48 +01:00
|
|
|
|
|
|
|
$services->set(VersionParser::class);
|
2020-07-16 13:07:08 +02:00
|
|
|
};
|