mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-15 15:42:22 +00:00
[DX] Add deprecation exception about old ContainerConfigurator, to prepare for removal even in CI
This commit is contained in:
parent
d1b7a49e35
commit
bdf11c5968
|
@ -8,9 +8,9 @@ use Nette\Utils\FileSystem;
|
|||
use Psr\Container\ContainerInterface;
|
||||
use Rector\Caching\Detector\ChangedFilesDetector;
|
||||
use Rector\Core\Autoloading\BootstrapFilesIncluder;
|
||||
use Rector\Core\Exception\DeprecatedException;
|
||||
use Rector\Core\Kernel\RectorKernel;
|
||||
use Rector\Core\ValueObject\Bootstrap\BootstrapConfigs;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
final class RectorContainerFactory
|
||||
{
|
||||
|
@ -24,17 +24,12 @@ final class RectorContainerFactory
|
|||
// warning about old syntax before RectorConfig
|
||||
$fileContents = FileSystem::read($mainConfigFile);
|
||||
if (str_contains($fileContents, 'ContainerConfigurator $containerConfigurator')) {
|
||||
/** @var SymfonyStyle $symfonyStyle */
|
||||
$symfonyStyle = $container->get(SymfonyStyle::class);
|
||||
|
||||
$warningMessage = sprintf(
|
||||
'Your "%s" config is using old syntax with "ContainerConfigurator".%sUpgrade to "RectorConfig" that allows better autocomplete and future standard: https://getrector.org/blog/new-in-rector-012-introducing-rector-config-with-autocomplete',
|
||||
'Your "%s" config uses deprecated syntax with "ContainerConfigurator".%sUpgrade to "RectorConfig": https://getrector.org/blog/new-in-rector-012-introducing-rector-config-with-autocomplete',
|
||||
$mainConfigFile,
|
||||
PHP_EOL,
|
||||
);
|
||||
$symfonyStyle->error($warningMessage);
|
||||
// to make message noticable
|
||||
sleep(10);
|
||||
throw new DeprecatedException($warningMessage);
|
||||
}
|
||||
|
||||
/** @var ChangedFilesDetector $changedFilesDetector */
|
||||
|
|
11
src/Exception/DeprecatedException.php
Normal file
11
src/Exception/DeprecatedException.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class DeprecatedException extends Exception
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user