mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 0eba231b07
0eba231b07
[PHP 8.1] Move ConstantListClassToEnumRector to PHP 8.1 (#2444)
This commit is contained in:
parent
a28f4b14a4
commit
aa2cb1b997
|
@ -4,13 +4,13 @@ declare (strict_types=1);
|
|||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Nette\Utils\Json;
|
||||
use RectorPrefix20220606\Rector\ChangesReporting\Output\JsonOutputFormatter;
|
||||
use RectorPrefix20220606\Rector\Core\Bootstrap\RectorConfigsResolver;
|
||||
use RectorPrefix20220606\Rector\Core\Configuration\Option;
|
||||
use RectorPrefix20220606\Rector\Core\Console\ConsoleApplication;
|
||||
use RectorPrefix20220606\Rector\Core\Console\Style\RectorConsoleOutputStyleFactory;
|
||||
use RectorPrefix20220606\Rector\Core\DependencyInjection\RectorContainerFactory;
|
||||
use RectorPrefix20220606\Rector\Core\Kernel\RectorKernel;
|
||||
use Rector\ChangesReporting\Output\JsonOutputFormatter;
|
||||
use Rector\Core\Bootstrap\RectorConfigsResolver;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Console\ConsoleApplication;
|
||||
use Rector\Core\Console\Style\RectorConsoleOutputStyleFactory;
|
||||
use Rector\Core\DependencyInjection\RectorContainerFactory;
|
||||
use Rector\Core\Kernel\RectorKernel;
|
||||
use RectorPrefix20220606\Symfony\Component\Console\Command\Command;
|
||||
use RectorPrefix20220606\Symfony\Component\Console\Input\ArgvInput;
|
||||
use RectorPrefix20220606\Symplify\PackageBuilder\Reflection\PrivatesCaller;
|
||||
|
@ -20,9 +20,9 @@ use RectorPrefix20220606\Symplify\PackageBuilder\Reflection\PrivatesCaller;
|
|||
\error_reporting(\E_ALL);
|
||||
\ini_set('display_errors', 'stderr');
|
||||
\gc_disable();
|
||||
\define('RectorPrefix20220606\\__RECTOR_RUNNING__', \true);
|
||||
\define('__RECTOR_RUNNING__', \true);
|
||||
// Require Composer autoload.php
|
||||
$autoloadIncluder = new AutoloadIncluder();
|
||||
$autoloadIncluder = new \RectorPrefix20220606\AutoloadIncluder();
|
||||
$autoloadIncluder->includeDependencyOrRepositoryVendorAutoloadIfExists();
|
||||
final class AutoloadIncluder
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ final class AutoloadIncluder
|
|||
public function includeDependencyOrRepositoryVendorAutoloadIfExists() : void
|
||||
{
|
||||
// Rector's vendor is already loaded
|
||||
if (\class_exists(RectorKernel::class)) {
|
||||
if (\class_exists(\Rector\Core\Kernel\RectorKernel::class)) {
|
||||
return;
|
||||
}
|
||||
// in Rector develop repository
|
||||
|
@ -95,6 +95,7 @@ final class AutoloadIncluder
|
|||
require_once $filePath;
|
||||
}
|
||||
}
|
||||
\class_alias('RectorPrefix20220606\\AutoloadIncluder', 'AutoloadIncluder', \false);
|
||||
if (\file_exists(__DIR__ . '/../preload.php') && \is_dir(__DIR__ . '/../vendor')) {
|
||||
require_once __DIR__ . '/../preload.php';
|
||||
}
|
||||
|
@ -103,26 +104,26 @@ $autoloadIncluder->loadIfExistsAndNotLoadedYet(__DIR__ . '/../vendor/scoper-auto
|
|||
$autoloadIncluder->autoloadProjectAutoloaderFile();
|
||||
$autoloadIncluder->autoloadRectorInstalledAsGlobalDependency();
|
||||
$autoloadIncluder->autoloadFromCommandLine();
|
||||
$rectorConfigsResolver = new RectorConfigsResolver();
|
||||
$rectorConfigsResolver = new \Rector\Core\Bootstrap\RectorConfigsResolver();
|
||||
try {
|
||||
$bootstrapConfigs = $rectorConfigsResolver->provide();
|
||||
$rectorContainerFactory = new RectorContainerFactory();
|
||||
$rectorContainerFactory = new \Rector\Core\DependencyInjection\RectorContainerFactory();
|
||||
$container = $rectorContainerFactory->createFromBootstrapConfigs($bootstrapConfigs);
|
||||
} catch (\Throwable $throwable) {
|
||||
// for json output
|
||||
$argvInput = new ArgvInput();
|
||||
$outputFormat = $argvInput->getParameterOption('--' . Option::OUTPUT_FORMAT);
|
||||
$argvInput = new \RectorPrefix20220606\Symfony\Component\Console\Input\ArgvInput();
|
||||
$outputFormat = $argvInput->getParameterOption('--' . \Rector\Core\Configuration\Option::OUTPUT_FORMAT);
|
||||
// report fatal error in json format
|
||||
if ($outputFormat === JsonOutputFormatter::NAME) {
|
||||
echo Json::encode(['fatal_errors' => [$throwable->getMessage()]]);
|
||||
if ($outputFormat === \Rector\ChangesReporting\Output\JsonOutputFormatter::NAME) {
|
||||
echo \RectorPrefix20220606\Nette\Utils\Json::encode(['fatal_errors' => [$throwable->getMessage()]]);
|
||||
} else {
|
||||
// report fatal errors in console format
|
||||
$rectorConsoleOutputStyleFactory = new RectorConsoleOutputStyleFactory(new PrivatesCaller());
|
||||
$rectorConsoleOutputStyleFactory = new \Rector\Core\Console\Style\RectorConsoleOutputStyleFactory(new \RectorPrefix20220606\Symplify\PackageBuilder\Reflection\PrivatesCaller());
|
||||
$rectorConsoleOutputStyle = $rectorConsoleOutputStyleFactory->create();
|
||||
$rectorConsoleOutputStyle->error($throwable->getMessage());
|
||||
}
|
||||
exit(Command::FAILURE);
|
||||
exit(\RectorPrefix20220606\Symfony\Component\Console\Command\Command::FAILURE);
|
||||
}
|
||||
/** @var ConsoleApplication $application */
|
||||
$application = $container->get(ConsoleApplication::class);
|
||||
$application = $container->get(\Rector\Core\Console\ConsoleApplication::class);
|
||||
exit($application->run());
|
||||
|
|
|
@ -7,36 +7,36 @@ use RectorPrefix20220606\Composer\Semver\VersionParser;
|
|||
use RectorPrefix20220606\Doctrine\Inflector\Inflector;
|
||||
use RectorPrefix20220606\Doctrine\Inflector\Rules\English\InflectorFactory;
|
||||
use RectorPrefix20220606\OndraM\CiDetector\CiDetector;
|
||||
use RectorPrefix20220606\PhpParser\BuilderFactory;
|
||||
use RectorPrefix20220606\PhpParser\Lexer;
|
||||
use RectorPrefix20220606\PhpParser\NodeFinder;
|
||||
use RectorPrefix20220606\PhpParser\NodeVisitor\CloningVisitor;
|
||||
use RectorPrefix20220606\PhpParser\NodeVisitor\NodeConnectingVisitor;
|
||||
use RectorPrefix20220606\PHPStan\Analyser\NodeScopeResolver;
|
||||
use RectorPrefix20220606\PHPStan\Analyser\ScopeFactory;
|
||||
use RectorPrefix20220606\PHPStan\Dependency\DependencyResolver;
|
||||
use RectorPrefix20220606\PHPStan\File\FileHelper;
|
||||
use RectorPrefix20220606\PHPStan\Parser\Parser;
|
||||
use RectorPrefix20220606\PHPStan\PhpDoc\TypeNodeResolver;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Parser\PhpDocParser;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Parser\TypeParser;
|
||||
use RectorPrefix20220606\PHPStan\Reflection\ReflectionProvider;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocParser\BetterPhpDocParser;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocParser\BetterTypeParser;
|
||||
use RectorPrefix20220606\Rector\Caching\Cache;
|
||||
use RectorPrefix20220606\Rector\Caching\CacheFactory;
|
||||
use RectorPrefix20220606\Rector\Caching\ValueObject\Storage\MemoryCacheStorage;
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\Bootstrap\ExtensionConfigResolver;
|
||||
use RectorPrefix20220606\Rector\Core\Console\ConsoleApplication;
|
||||
use RectorPrefix20220606\Rector\Core\Console\Style\RectorConsoleOutputStyle;
|
||||
use RectorPrefix20220606\Rector\Core\Console\Style\RectorConsoleOutputStyleFactory;
|
||||
use RectorPrefix20220606\Rector\Core\Validation\Collector\EmptyConfigurableRectorCollector;
|
||||
use RectorPrefix20220606\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory;
|
||||
use RectorPrefix20220606\Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocator\IntermediateSourceLocator;
|
||||
use RectorPrefix20220606\Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider;
|
||||
use RectorPrefix20220606\Rector\PSR4\Composer\PSR4NamespaceMatcher;
|
||||
use RectorPrefix20220606\Rector\PSR4\Contract\PSR4AutoloadNamespaceMatcherInterface;
|
||||
use PhpParser\BuilderFactory;
|
||||
use PhpParser\Lexer;
|
||||
use PhpParser\NodeFinder;
|
||||
use PhpParser\NodeVisitor\CloningVisitor;
|
||||
use PhpParser\NodeVisitor\NodeConnectingVisitor;
|
||||
use PHPStan\Analyser\NodeScopeResolver;
|
||||
use PHPStan\Analyser\ScopeFactory;
|
||||
use PHPStan\Dependency\DependencyResolver;
|
||||
use PHPStan\File\FileHelper;
|
||||
use PHPStan\Parser\Parser;
|
||||
use PHPStan\PhpDoc\TypeNodeResolver;
|
||||
use PHPStan\PhpDocParser\Parser\PhpDocParser;
|
||||
use PHPStan\PhpDocParser\Parser\TypeParser;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use Rector\BetterPhpDocParser\PhpDocParser\BetterPhpDocParser;
|
||||
use Rector\BetterPhpDocParser\PhpDocParser\BetterTypeParser;
|
||||
use Rector\Caching\Cache;
|
||||
use Rector\Caching\CacheFactory;
|
||||
use Rector\Caching\ValueObject\Storage\MemoryCacheStorage;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\Bootstrap\ExtensionConfigResolver;
|
||||
use Rector\Core\Console\ConsoleApplication;
|
||||
use Rector\Core\Console\Style\RectorConsoleOutputStyle;
|
||||
use Rector\Core\Console\Style\RectorConsoleOutputStyleFactory;
|
||||
use Rector\Core\Validation\Collector\EmptyConfigurableRectorCollector;
|
||||
use Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory;
|
||||
use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocator\IntermediateSourceLocator;
|
||||
use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider;
|
||||
use Rector\PSR4\Composer\PSR4NamespaceMatcher;
|
||||
use Rector\PSR4\Contract\PSR4AutoloadNamespaceMatcherInterface;
|
||||
use RectorPrefix20220606\Symfony\Component\Console\Application;
|
||||
use function RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service;
|
||||
use RectorPrefix20220606\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser;
|
||||
|
@ -51,9 +51,9 @@ use RectorPrefix20220606\Symplify\SmartFileSystem\FileSystemGuard;
|
|||
use RectorPrefix20220606\Symplify\SmartFileSystem\Finder\FinderSanitizer;
|
||||
use RectorPrefix20220606\Symplify\SmartFileSystem\Json\JsonFileSystem;
|
||||
use RectorPrefix20220606\Symplify\SmartFileSystem\SmartFileSystem;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
// make use of https://github.com/symplify/easy-parallel
|
||||
$rectorConfig->import(EasyParallelConfig::FILE_PATH);
|
||||
$rectorConfig->import(\RectorPrefix20220606\Symplify\EasyParallel\ValueObject\EasyParallelConfig::FILE_PATH);
|
||||
$rectorConfig->paths([]);
|
||||
$rectorConfig->skip([]);
|
||||
$rectorConfig->autoloadPaths([]);
|
||||
|
@ -81,17 +81,17 @@ return static function (RectorConfig $rectorConfig) : void {
|
|||
__DIR__ . '/../packages/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php',
|
||||
]);
|
||||
// psr-4
|
||||
$services->alias(PSR4AutoloadNamespaceMatcherInterface::class, PSR4NamespaceMatcher::class);
|
||||
$services->alias(\Rector\PSR4\Contract\PSR4AutoloadNamespaceMatcherInterface::class, \Rector\PSR4\Composer\PSR4NamespaceMatcher::class);
|
||||
$services->load('Rector\\', __DIR__ . '/../rules')->exclude([__DIR__ . '/../rules/*/ValueObject/*', __DIR__ . '/../rules/*/Rector/*', __DIR__ . '/../rules/*/Contract/*', __DIR__ . '/../rules/*/Exception/*', __DIR__ . '/../rules/*/Enum/*', __DIR__ . '/../rules/DowngradePhp80/Reflection/SimplePhpParameterReflection.php']);
|
||||
// parallel
|
||||
$services->set(ParametersMerger::class);
|
||||
$services->set(\RectorPrefix20220606\Symplify\PackageBuilder\Yaml\ParametersMerger::class);
|
||||
// use faster in-memory cache in CI.
|
||||
// CI always starts from scratch, therefore IO intensive caching is not worth it
|
||||
$ciDetector = new CiDetector();
|
||||
$ciDetector = new \RectorPrefix20220606\OndraM\CiDetector\CiDetector();
|
||||
if ($ciDetector->isCiDetected()) {
|
||||
$rectorConfig->cacheClass(MemoryCacheStorage::class);
|
||||
$rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\MemoryCacheStorage::class);
|
||||
}
|
||||
$extensionConfigResolver = new ExtensionConfigResolver();
|
||||
$extensionConfigResolver = new \Rector\Core\Bootstrap\ExtensionConfigResolver();
|
||||
$extensionConfigFiles = $extensionConfigResolver->provide();
|
||||
foreach ($extensionConfigFiles as $extensionConfigFile) {
|
||||
$rectorConfig->import($extensionConfigFile->getRealPath());
|
||||
|
@ -99,43 +99,43 @@ return static function (RectorConfig $rectorConfig) : void {
|
|||
// require only in dev
|
||||
$rectorConfig->import(__DIR__ . '/../utils/compiler/config/config.php', null, 'not_found');
|
||||
$services->load('Rector\\Core\\', __DIR__ . '/../src')->exclude([__DIR__ . '/../src/Rector', __DIR__ . '/../src/Console/Style/RectorConsoleOutputStyle.php', __DIR__ . '/../src/Exception', __DIR__ . '/../src/DependencyInjection/CompilerPass', __DIR__ . '/../src/DependencyInjection/Loader', __DIR__ . '/../src/Kernel', __DIR__ . '/../src/ValueObject', __DIR__ . '/../src/Bootstrap', __DIR__ . '/../src/Enum', __DIR__ . '/../src/PhpParser/Node/CustomNode', __DIR__ . '/../src/PhpParser/ValueObject', __DIR__ . '/../src/functions', __DIR__ . '/../src/constants.php']);
|
||||
$services->alias(Application::class, ConsoleApplication::class);
|
||||
$services->set(EmptyConfigurableRectorCollector::class)->arg('$containerBuilder', service('service_container'));
|
||||
$services->set(SimpleCallableNodeTraverser::class);
|
||||
$services->set(BuilderFactory::class);
|
||||
$services->set(CloningVisitor::class);
|
||||
$services->set(NodeConnectingVisitor::class);
|
||||
$services->set(NodeFinder::class);
|
||||
$services->set(RectorConsoleOutputStyle::class)->factory([service(RectorConsoleOutputStyleFactory::class), 'create']);
|
||||
$services->set(Parser::class)->factory([service(PHPStanServicesFactory::class), 'createPHPStanParser']);
|
||||
$services->set(Lexer::class)->factory([service(PHPStanServicesFactory::class), 'createEmulativeLexer']);
|
||||
$services->alias(\RectorPrefix20220606\Symfony\Component\Console\Application::class, \Rector\Core\Console\ConsoleApplication::class);
|
||||
$services->set(\Rector\Core\Validation\Collector\EmptyConfigurableRectorCollector::class)->arg('$containerBuilder', \RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service('service_container'));
|
||||
$services->set(\RectorPrefix20220606\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser::class);
|
||||
$services->set(\PhpParser\BuilderFactory::class);
|
||||
$services->set(\PhpParser\NodeVisitor\CloningVisitor::class);
|
||||
$services->set(\PhpParser\NodeVisitor\NodeConnectingVisitor::class);
|
||||
$services->set(\PhpParser\NodeFinder::class);
|
||||
$services->set(\Rector\Core\Console\Style\RectorConsoleOutputStyle::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\Core\Console\Style\RectorConsoleOutputStyleFactory::class), 'create']);
|
||||
$services->set(\PHPStan\Parser\Parser::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory::class), 'createPHPStanParser']);
|
||||
$services->set(\PhpParser\Lexer::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory::class), 'createEmulativeLexer']);
|
||||
// symplify/package-builder
|
||||
$services->set(FileSystemGuard::class);
|
||||
$services->set(PrivatesAccessor::class);
|
||||
$services->set(PrivatesCaller::class);
|
||||
$services->set(FinderSanitizer::class);
|
||||
$services->set(FileSystemFilter::class);
|
||||
$services->set(ParameterProvider::class)->arg('$container', service('service_container'));
|
||||
$services->set(SmartFileSystem::class);
|
||||
$services->set(JsonFileSystem::class);
|
||||
$services->set(InflectorFactory::class);
|
||||
$services->set(Inflector::class)->factory([service(InflectorFactory::class), 'build']);
|
||||
$services->set(VersionParser::class);
|
||||
$services->set(TypeChecker::class);
|
||||
$services->set(\RectorPrefix20220606\Symplify\SmartFileSystem\FileSystemGuard::class);
|
||||
$services->set(\RectorPrefix20220606\Symplify\PackageBuilder\Reflection\PrivatesAccessor::class);
|
||||
$services->set(\RectorPrefix20220606\Symplify\PackageBuilder\Reflection\PrivatesCaller::class);
|
||||
$services->set(\RectorPrefix20220606\Symplify\SmartFileSystem\Finder\FinderSanitizer::class);
|
||||
$services->set(\RectorPrefix20220606\Symplify\SmartFileSystem\FileSystemFilter::class);
|
||||
$services->set(\RectorPrefix20220606\Symplify\PackageBuilder\Parameter\ParameterProvider::class)->arg('$container', \RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service('service_container'));
|
||||
$services->set(\RectorPrefix20220606\Symplify\SmartFileSystem\SmartFileSystem::class);
|
||||
$services->set(\RectorPrefix20220606\Symplify\SmartFileSystem\Json\JsonFileSystem::class);
|
||||
$services->set(\RectorPrefix20220606\Doctrine\Inflector\Rules\English\InflectorFactory::class);
|
||||
$services->set(\RectorPrefix20220606\Doctrine\Inflector\Inflector::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\RectorPrefix20220606\Doctrine\Inflector\Rules\English\InflectorFactory::class), 'build']);
|
||||
$services->set(\RectorPrefix20220606\Composer\Semver\VersionParser::class);
|
||||
$services->set(\RectorPrefix20220606\Symplify\PackageBuilder\Php\TypeChecker::class);
|
||||
// phpdoc parser
|
||||
$services->set(\RectorPrefix20220606\PHPStan\PhpDocParser\Lexer\Lexer::class);
|
||||
$services->alias(PhpDocParser::class, BetterPhpDocParser::class);
|
||||
$services->set(\PHPStan\PhpDocParser\Lexer\Lexer::class);
|
||||
$services->alias(\PHPStan\PhpDocParser\Parser\PhpDocParser::class, \Rector\BetterPhpDocParser\PhpDocParser\BetterPhpDocParser::class);
|
||||
// cache
|
||||
$services->set(DependencyResolver::class)->factory([service(PHPStanServicesFactory::class), 'createDependencyResolver']);
|
||||
$services->set(FileHelper::class)->factory([service(PHPStanServicesFactory::class), 'createFileHelper']);
|
||||
$services->set(Cache::class)->factory([service(CacheFactory::class), 'create']);
|
||||
$services->set(\PHPStan\Dependency\DependencyResolver::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory::class), 'createDependencyResolver']);
|
||||
$services->set(\PHPStan\File\FileHelper::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory::class), 'createFileHelper']);
|
||||
$services->set(\Rector\Caching\Cache::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\Caching\CacheFactory::class), 'create']);
|
||||
// type resolving
|
||||
$services->set(IntermediateSourceLocator::class);
|
||||
$services->alias(TypeParser::class, BetterTypeParser::class);
|
||||
$services->set(\Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocator\IntermediateSourceLocator::class);
|
||||
$services->alias(\PHPStan\PhpDocParser\Parser\TypeParser::class, \Rector\BetterPhpDocParser\PhpDocParser\BetterTypeParser::class);
|
||||
// PHPStan services
|
||||
$services->set(ReflectionProvider::class)->factory([service(PHPStanServicesFactory::class), 'createReflectionProvider']);
|
||||
$services->set(NodeScopeResolver::class)->factory([service(PHPStanServicesFactory::class), 'createNodeScopeResolver']);
|
||||
$services->set(ScopeFactory::class)->factory([service(PHPStanServicesFactory::class), 'createScopeFactory']);
|
||||
$services->set(TypeNodeResolver::class)->factory([service(PHPStanServicesFactory::class), 'createTypeNodeResolver']);
|
||||
$services->set(DynamicSourceLocatorProvider::class)->factory([service(PHPStanServicesFactory::class), 'createDynamicSourceLocatorProvider']);
|
||||
$services->set(\PHPStan\Reflection\ReflectionProvider::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory::class), 'createReflectionProvider']);
|
||||
$services->set(\PHPStan\Analyser\NodeScopeResolver::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory::class), 'createNodeScopeResolver']);
|
||||
$services->set(\PHPStan\Analyser\ScopeFactory::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory::class), 'createScopeFactory']);
|
||||
$services->set(\PHPStan\PhpDoc\TypeNodeResolver::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory::class), 'createTypeNodeResolver']);
|
||||
$services->set(\Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider::class)->factory([\RectorPrefix20220606\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory::class), 'createDynamicSourceLocatorProvider']);
|
||||
};
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\DependencyInjection\Rector\Class_\ActionInjectionToConstructorInjectionRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(ActionInjectionToConstructorInjectionRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\DependencyInjection\Rector\Class_\ActionInjectionToConstructorInjectionRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\DependencyInjection\Rector\Class_\ActionInjectionToConstructorInjectionRector::class);
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,36 +3,36 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Assign\PHPStormVarAnnotationRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\ClassConst\SplitGroupedConstantsAndPropertiesRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\ClassMethod\RemoveDoubleUnderscoreInMethodNameRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\FuncCall\CallUserFuncArrayToVariadicRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\If_\NullableCompareToNullRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Plus\UseIncrementAssignRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Property\AddFalseDefaultToBoolPropertyRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\Rector\Use_\SeparateMultiUseImportsRector;
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
||||
use RectorPrefix20220606\Rector\Transform\Rector\FuncCall\FuncCallToConstFetchRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(FuncCallToConstFetchRector::class, ['php_sapi_name' => 'PHP_SAPI', 'pi' => 'M_PI']);
|
||||
$rectorConfig->rules([SeparateMultiUseImportsRector::class, RemoveDoubleUnderscoreInMethodNameRector::class, PostIncDecToPreIncDecRector::class, UnSpreadOperatorRector::class, NewlineAfterStatementRector::class, RemoveFinalFromConstRector::class, PHPStormVarAnnotationRector::class, NullableCompareToNullRector::class, BinarySwitchToIfElseRector::class, ConsistentImplodeRector::class, TernaryConditionVariableAssignmentRector::class, SymplifyQuoteEscapeRector::class, SplitGroupedConstantsAndPropertiesRector::class, StringClassNameToClassConstantRector::class, ConsistentPregDelimiterRector::class, CatchExceptionNameMatchingTypeRector::class, UseIncrementAssignRector::class, SplitDoubleAssignRector::class, VarConstantCommentRector::class, EncapsedStringsToSprintfRector::class, WrapEncapsedVariableInCurlyBracesRector::class, NewlineBeforeNewAssignSetRector::class, AddArrayDefaultToArrayPropertyRector::class, AddFalseDefaultToBoolPropertyRector::class, MakeInheritedMethodVisibilitySameAsParentRector::class, CallUserFuncArrayToVariadicRector::class, VersionCompareFuncCallToConstantRector::class]);
|
||||
use Rector\CodingStyle\Rector\Assign\PHPStormVarAnnotationRector;
|
||||
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
|
||||
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
|
||||
use Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector;
|
||||
use Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector;
|
||||
use Rector\CodingStyle\Rector\ClassConst\SplitGroupedConstantsAndPropertiesRector;
|
||||
use Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector;
|
||||
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
|
||||
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
|
||||
use Rector\CodingStyle\Rector\ClassMethod\RemoveDoubleUnderscoreInMethodNameRector;
|
||||
use Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector;
|
||||
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
|
||||
use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
|
||||
use Rector\CodingStyle\Rector\FuncCall\CallUserFuncArrayToVariadicRector;
|
||||
use Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector;
|
||||
use Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector;
|
||||
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
|
||||
use Rector\CodingStyle\Rector\If_\NullableCompareToNullRector;
|
||||
use Rector\CodingStyle\Rector\Plus\UseIncrementAssignRector;
|
||||
use Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector;
|
||||
use Rector\CodingStyle\Rector\Property\AddFalseDefaultToBoolPropertyRector;
|
||||
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
|
||||
use Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector;
|
||||
use Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector;
|
||||
use Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector;
|
||||
use Rector\CodingStyle\Rector\Use_\SeparateMultiUseImportsRector;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
||||
use Rector\Transform\Rector\FuncCall\FuncCallToConstFetchRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Transform\Rector\FuncCall\FuncCallToConstFetchRector::class, ['php_sapi_name' => 'PHP_SAPI', 'pi' => 'M_PI']);
|
||||
$rectorConfig->rules([\Rector\CodingStyle\Rector\Use_\SeparateMultiUseImportsRector::class, \Rector\CodingStyle\Rector\ClassMethod\RemoveDoubleUnderscoreInMethodNameRector::class, \Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector::class, \Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector::class, \Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector::class, \Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector::class, \Rector\CodingStyle\Rector\Assign\PHPStormVarAnnotationRector::class, \Rector\CodingStyle\Rector\If_\NullableCompareToNullRector::class, \Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector::class, \Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector::class, \Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector::class, \Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector::class, \Rector\CodingStyle\Rector\ClassConst\SplitGroupedConstantsAndPropertiesRector::class, \Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class, \Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector::class, \Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector::class, \Rector\CodingStyle\Rector\Plus\UseIncrementAssignRector::class, \Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector::class, \Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector::class, \Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector::class, \Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector::class, \Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector::class, \Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector::class, \Rector\CodingStyle\Rector\Property\AddFalseDefaultToBoolPropertyRector::class, \Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector::class, \Rector\CodingStyle\Rector\FuncCall\CallUserFuncArrayToVariadicRector::class, \Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector::class]);
|
||||
};
|
||||
|
|
|
@ -3,101 +3,101 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Assign\RemoveDoubleAssignRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\BinaryOp\RemoveDuplicatedInstanceOfRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\BooleanAnd\RemoveAndTrueRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassConst\RemoveUnusedPrivateClassConstantRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveDeadConstructorRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveDelegatingParentCallRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveLastReturnRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedParamInRequiredAutowireRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Expression\RemoveDeadStmtRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Expression\SimplifyMirrorAssignRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\For_\RemoveDeadContinueRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\For_\RemoveDeadIfForeachForRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\For_\RemoveDeadLoopRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\FunctionLike\RemoveDeadReturnRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\FunctionLike\RemoveDuplicatedIfReturnRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\FunctionLike\RemoveOverriddenValuesRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\If_\SimplifyIfElseWithSameContentRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\PropertyProperty\RemoveNullPropertyInitializationRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Return_\RemoveDeadConditionAboveReturnRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Stmt\RemoveUnreachableStatementRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\StmtsAwareInterface\RemoveJustPropertyFetchForAssignRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\TryCatch\RemoveDeadTryCatchRector;
|
||||
use RectorPrefix20220606\Rector\PHPUnit\Rector\ClassMethod\RemoveEmptyTestMethodRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector;
|
||||
use Rector\DeadCode\Rector\Assign\RemoveDoubleAssignRector;
|
||||
use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
|
||||
use Rector\DeadCode\Rector\BinaryOp\RemoveDuplicatedInstanceOfRector;
|
||||
use Rector\DeadCode\Rector\BooleanAnd\RemoveAndTrueRector;
|
||||
use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
|
||||
use Rector\DeadCode\Rector\ClassConst\RemoveUnusedPrivateClassConstantRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveDeadConstructorRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveDelegatingParentCallRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveLastReturnRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedParamInRequiredAutowireRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
|
||||
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
|
||||
use Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector;
|
||||
use Rector\DeadCode\Rector\Expression\RemoveDeadStmtRector;
|
||||
use Rector\DeadCode\Rector\Expression\SimplifyMirrorAssignRector;
|
||||
use Rector\DeadCode\Rector\For_\RemoveDeadContinueRector;
|
||||
use Rector\DeadCode\Rector\For_\RemoveDeadIfForeachForRector;
|
||||
use Rector\DeadCode\Rector\For_\RemoveDeadLoopRector;
|
||||
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
|
||||
use Rector\DeadCode\Rector\FunctionLike\RemoveDeadReturnRector;
|
||||
use Rector\DeadCode\Rector\FunctionLike\RemoveDuplicatedIfReturnRector;
|
||||
use Rector\DeadCode\Rector\FunctionLike\RemoveOverriddenValuesRector;
|
||||
use Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector;
|
||||
use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
|
||||
use Rector\DeadCode\Rector\If_\SimplifyIfElseWithSameContentRector;
|
||||
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
|
||||
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
|
||||
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
|
||||
use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector;
|
||||
use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector;
|
||||
use Rector\DeadCode\Rector\PropertyProperty\RemoveNullPropertyInitializationRector;
|
||||
use Rector\DeadCode\Rector\Return_\RemoveDeadConditionAboveReturnRector;
|
||||
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
|
||||
use Rector\DeadCode\Rector\Stmt\RemoveUnreachableStatementRector;
|
||||
use Rector\DeadCode\Rector\StmtsAwareInterface\RemoveJustPropertyFetchForAssignRector;
|
||||
use Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector;
|
||||
use Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector;
|
||||
use Rector\DeadCode\Rector\TryCatch\RemoveDeadTryCatchRector;
|
||||
use Rector\PHPUnit\Rector\ClassMethod\RemoveEmptyTestMethodRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rules([
|
||||
UnwrapFutureCompatibleIfFunctionExistsRector::class,
|
||||
UnwrapFutureCompatibleIfPhpVersionRector::class,
|
||||
RecastingRemovalRector::class,
|
||||
RemoveDeadStmtRector::class,
|
||||
RemoveDuplicatedArrayKeyRector::class,
|
||||
RemoveUnusedForeachKeyRector::class,
|
||||
RemoveParentCallWithoutParentRector::class,
|
||||
RemoveEmptyClassMethodRector::class,
|
||||
RemoveDoubleAssignRector::class,
|
||||
SimplifyMirrorAssignRector::class,
|
||||
RemoveOverriddenValuesRector::class,
|
||||
RemoveUnusedPrivatePropertyRector::class,
|
||||
RemoveUnusedPrivateClassConstantRector::class,
|
||||
RemoveUnusedPrivateMethodRector::class,
|
||||
RemoveDeadConstructorRector::class,
|
||||
RemoveDeadReturnRector::class,
|
||||
RemoveDeadContinueRector::class,
|
||||
RemoveDeadIfForeachForRector::class,
|
||||
RemoveAndTrueRector::class,
|
||||
RemoveConcatAutocastRector::class,
|
||||
SimplifyUselessVariableRector::class,
|
||||
RemoveDelegatingParentCallRector::class,
|
||||
RemoveDuplicatedInstanceOfRector::class,
|
||||
RemoveDuplicatedCaseInSwitchRector::class,
|
||||
RemoveNullPropertyInitializationRector::class,
|
||||
RemoveUnreachableStatementRector::class,
|
||||
SimplifyIfElseWithSameContentRector::class,
|
||||
TernaryToBooleanOrFalseToBooleanAndRector::class,
|
||||
RemoveEmptyTestMethodRector::class,
|
||||
RemoveDeadTryCatchRector::class,
|
||||
RemoveUnusedVariableAssignRector::class,
|
||||
RemoveDuplicatedIfReturnRector::class,
|
||||
RemoveUnusedNonEmptyArrayBeforeForeachRector::class,
|
||||
RemoveEmptyMethodCallRector::class,
|
||||
RemoveDeadConditionAboveReturnRector::class,
|
||||
RemoveUnusedConstructorParamRector::class,
|
||||
RemoveDeadInstanceOfRector::class,
|
||||
RemoveDeadLoopRector::class,
|
||||
RemoveUnusedPrivateMethodParameterRector::class,
|
||||
RemoveUnusedParamInRequiredAutowireRector::class,
|
||||
\Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector::class,
|
||||
\Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector::class,
|
||||
\Rector\DeadCode\Rector\Cast\RecastingRemovalRector::class,
|
||||
\Rector\DeadCode\Rector\Expression\RemoveDeadStmtRector::class,
|
||||
\Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector::class,
|
||||
\Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector::class,
|
||||
\Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector::class,
|
||||
\Rector\DeadCode\Rector\Assign\RemoveDoubleAssignRector::class,
|
||||
\Rector\DeadCode\Rector\Expression\SimplifyMirrorAssignRector::class,
|
||||
\Rector\DeadCode\Rector\FunctionLike\RemoveOverriddenValuesRector::class,
|
||||
\Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector::class,
|
||||
\Rector\DeadCode\Rector\ClassConst\RemoveUnusedPrivateClassConstantRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveDeadConstructorRector::class,
|
||||
\Rector\DeadCode\Rector\FunctionLike\RemoveDeadReturnRector::class,
|
||||
\Rector\DeadCode\Rector\For_\RemoveDeadContinueRector::class,
|
||||
\Rector\DeadCode\Rector\For_\RemoveDeadIfForeachForRector::class,
|
||||
\Rector\DeadCode\Rector\BooleanAnd\RemoveAndTrueRector::class,
|
||||
\Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector::class,
|
||||
\Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveDelegatingParentCallRector::class,
|
||||
\Rector\DeadCode\Rector\BinaryOp\RemoveDuplicatedInstanceOfRector::class,
|
||||
\Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector::class,
|
||||
\Rector\DeadCode\Rector\PropertyProperty\RemoveNullPropertyInitializationRector::class,
|
||||
\Rector\DeadCode\Rector\Stmt\RemoveUnreachableStatementRector::class,
|
||||
\Rector\DeadCode\Rector\If_\SimplifyIfElseWithSameContentRector::class,
|
||||
\Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector::class,
|
||||
\Rector\PHPUnit\Rector\ClassMethod\RemoveEmptyTestMethodRector::class,
|
||||
\Rector\DeadCode\Rector\TryCatch\RemoveDeadTryCatchRector::class,
|
||||
\Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector::class,
|
||||
\Rector\DeadCode\Rector\FunctionLike\RemoveDuplicatedIfReturnRector::class,
|
||||
\Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector::class,
|
||||
\Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector::class,
|
||||
\Rector\DeadCode\Rector\Return_\RemoveDeadConditionAboveReturnRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector::class,
|
||||
\Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector::class,
|
||||
\Rector\DeadCode\Rector\For_\RemoveDeadLoopRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedParamInRequiredAutowireRector::class,
|
||||
// docblock
|
||||
RemoveUselessParamTagRector::class,
|
||||
RemoveUselessReturnTagRector::class,
|
||||
RemoveNonExistingVarAnnotationRector::class,
|
||||
RemoveUnusedPromotedPropertyRector::class,
|
||||
RemoveLastReturnRector::class,
|
||||
RemoveJustPropertyFetchForAssignRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector::class,
|
||||
\Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector::class,
|
||||
\Rector\DeadCode\Rector\ClassMethod\RemoveLastReturnRector::class,
|
||||
\Rector\DeadCode\Rector\StmtsAwareInterface\RemoveJustPropertyFetchForAssignRector::class,
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use Rector\Config\RectorConfig;
|
||||
// @see https://ocramius.github.io/blog/fluent-interfaces-are-evil/
|
||||
// @see https://www.yegor256.com/2018/03/13/fluent-interfaces.html
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$deprecatedMessage = \sprintf('The DEFLUENT set is deprecated for high number of assumptions and reported bugs. Better use PHPStan rule "%s" to warn about these cases and refactor manually.', 'https://github.com/symplify/phpstan-rules/blob/main/docs/rules_overview.md#nochainmethodcallrule');
|
||||
\trigger_error($deprecatedMessage);
|
||||
\sleep(3);
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp53\Rector\Dir\DirConstToFileConstRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_52);
|
||||
$rectorConfig->rule(DirConstToFileConstRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp53\Rector\Dir\DirConstToFileConstRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_52);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp53\Rector\Dir\DirConstToFileConstRector::class);
|
||||
};
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp54\Rector\Array_\ShortArrayToLongArrayRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp54\Rector\Closure\DowngradeStaticClosureRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp54\Rector\FuncCall\DowngradeIndirectCallByArrayRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp54\Rector\FunctionLike\DowngradeCallableTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp54\Rector\LNumber\DowngradeBinaryNotationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_53);
|
||||
$rectorConfig->rule(ShortArrayToLongArrayRector::class);
|
||||
$rectorConfig->rule(DowngradeStaticClosureRector::class);
|
||||
$rectorConfig->rule(DowngradeIndirectCallByArrayRector::class);
|
||||
$rectorConfig->rule(DowngradeCallableTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeBinaryNotationRector::class);
|
||||
$rectorConfig->rule(DowngradeInstanceMethodCallRector::class);
|
||||
$rectorConfig->rule(DowngradeThisInClosureRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp54\Rector\Array_\ShortArrayToLongArrayRector;
|
||||
use Rector\DowngradePhp54\Rector\Closure\DowngradeStaticClosureRector;
|
||||
use Rector\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector;
|
||||
use Rector\DowngradePhp54\Rector\FuncCall\DowngradeIndirectCallByArrayRector;
|
||||
use Rector\DowngradePhp54\Rector\FunctionLike\DowngradeCallableTypeDeclarationRector;
|
||||
use Rector\DowngradePhp54\Rector\LNumber\DowngradeBinaryNotationRector;
|
||||
use Rector\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_53);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp54\Rector\Array_\ShortArrayToLongArrayRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp54\Rector\Closure\DowngradeStaticClosureRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp54\Rector\FuncCall\DowngradeIndirectCallByArrayRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp54\Rector\FunctionLike\DowngradeCallableTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp54\Rector\LNumber\DowngradeBinaryNotationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector::class);
|
||||
};
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_54);
|
||||
$rectorConfig->rule(DowngradeClassConstantToStringRector::class);
|
||||
$rectorConfig->rule(DowngradeForeachListRector::class);
|
||||
$rectorConfig->rule(DowngradeBoolvalRector::class);
|
||||
$rectorConfig->rule(DowngradeArbitraryExpressionArgsToEmptyAndIssetRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector;
|
||||
use Rector\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector;
|
||||
use Rector\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector;
|
||||
use Rector\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_54);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector::class);
|
||||
};
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp56\Rector\FuncCall\DowngradeArrayFilterUseConstantRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp56\Rector\Pow\DowngradeExponentialAssignmentOperatorRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp56\Rector\Pow\DowngradeExponentialOperatorRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp56\Rector\Use_\DowngradeUseFunctionRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_55);
|
||||
$rectorConfig->rule(DowngradeArgumentUnpackingRector::class);
|
||||
$rectorConfig->rule(DowngradeUseFunctionRector::class);
|
||||
$rectorConfig->rule(DowngradeExponentialAssignmentOperatorRector::class);
|
||||
$rectorConfig->rule(DowngradeExponentialOperatorRector::class);
|
||||
$rectorConfig->rule(DowngradeArrayFilterUseConstantRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector;
|
||||
use Rector\DowngradePhp56\Rector\FuncCall\DowngradeArrayFilterUseConstantRector;
|
||||
use Rector\DowngradePhp56\Rector\Pow\DowngradeExponentialAssignmentOperatorRector;
|
||||
use Rector\DowngradePhp56\Rector\Pow\DowngradeExponentialOperatorRector;
|
||||
use Rector\DowngradePhp56\Rector\Use_\DowngradeUseFunctionRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_55);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp56\Rector\Use_\DowngradeUseFunctionRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp56\Rector\Pow\DowngradeExponentialAssignmentOperatorRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp56\Rector\Pow\DowngradeExponentialOperatorRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp56\Rector\FuncCall\DowngradeArrayFilterUseConstantRector::class);
|
||||
};
|
||||
|
|
|
@ -3,44 +3,44 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\ClassMethod\DowngradeParentTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\Coalesce\DowngradeNullCoalesceRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\Declare_\DowngradeStrictTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\Expr\DowngradeUnnecessarilyParenthesizedExpressionRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\Expression\DowngradeDefineArrayConstantRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\FuncCall\DowngradeDirnameLevelsRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\FuncCall\DowngradeSessionStartArrayOptionsRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\FuncCall\DowngradeUncallableValueCallToCallUserFuncRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\FunctionLike\DowngradeScalarTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\FunctionLike\DowngradeThrowableTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\GroupUse\SplitGroupedUseImportsRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\Instanceof_\DowngradeInstanceofThrowableRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\MethodCall\DowngradeClosureCallRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\MethodCall\DowngradeMethodCallOnCloneRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\New_\DowngradeAnonymousClassRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\Spaceship\DowngradeSpaceshipRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp70\Rector\TryCatch\DowngradeCatchThrowableRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_56);
|
||||
$rectorConfig->rule(DowngradeCatchThrowableRector::class);
|
||||
$rectorConfig->rule(DowngradeInstanceofThrowableRector::class);
|
||||
$rectorConfig->rule(DowngradeScalarTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeThrowableTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeStrictTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeSelfTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeAnonymousClassRector::class);
|
||||
$rectorConfig->rule(DowngradeNullCoalesceRector::class);
|
||||
$rectorConfig->rule(DowngradeSpaceshipRector::class);
|
||||
$rectorConfig->rule(DowngradeDefineArrayConstantRector::class);
|
||||
$rectorConfig->rule(DowngradeDirnameLevelsRector::class);
|
||||
$rectorConfig->rule(DowngradeSessionStartArrayOptionsRector::class);
|
||||
$rectorConfig->rule(DowngradeUncallableValueCallToCallUserFuncRector::class);
|
||||
$rectorConfig->rule(SplitGroupedUseImportsRector::class);
|
||||
$rectorConfig->rule(DowngradeClosureCallRector::class);
|
||||
$rectorConfig->rule(DowngradeParentTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeMethodCallOnCloneRector::class);
|
||||
$rectorConfig->rule(DowngradeUnnecessarilyParenthesizedExpressionRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp70\Rector\ClassMethod\DowngradeParentTypeDeclarationRector;
|
||||
use Rector\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector;
|
||||
use Rector\DowngradePhp70\Rector\Coalesce\DowngradeNullCoalesceRector;
|
||||
use Rector\DowngradePhp70\Rector\Declare_\DowngradeStrictTypeDeclarationRector;
|
||||
use Rector\DowngradePhp70\Rector\Expr\DowngradeUnnecessarilyParenthesizedExpressionRector;
|
||||
use Rector\DowngradePhp70\Rector\Expression\DowngradeDefineArrayConstantRector;
|
||||
use Rector\DowngradePhp70\Rector\FuncCall\DowngradeDirnameLevelsRector;
|
||||
use Rector\DowngradePhp70\Rector\FuncCall\DowngradeSessionStartArrayOptionsRector;
|
||||
use Rector\DowngradePhp70\Rector\FuncCall\DowngradeUncallableValueCallToCallUserFuncRector;
|
||||
use Rector\DowngradePhp70\Rector\FunctionLike\DowngradeScalarTypeDeclarationRector;
|
||||
use Rector\DowngradePhp70\Rector\FunctionLike\DowngradeThrowableTypeDeclarationRector;
|
||||
use Rector\DowngradePhp70\Rector\GroupUse\SplitGroupedUseImportsRector;
|
||||
use Rector\DowngradePhp70\Rector\Instanceof_\DowngradeInstanceofThrowableRector;
|
||||
use Rector\DowngradePhp70\Rector\MethodCall\DowngradeClosureCallRector;
|
||||
use Rector\DowngradePhp70\Rector\MethodCall\DowngradeMethodCallOnCloneRector;
|
||||
use Rector\DowngradePhp70\Rector\New_\DowngradeAnonymousClassRector;
|
||||
use Rector\DowngradePhp70\Rector\Spaceship\DowngradeSpaceshipRector;
|
||||
use Rector\DowngradePhp70\Rector\TryCatch\DowngradeCatchThrowableRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_56);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\TryCatch\DowngradeCatchThrowableRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\Instanceof_\DowngradeInstanceofThrowableRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\FunctionLike\DowngradeScalarTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\FunctionLike\DowngradeThrowableTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\Declare_\DowngradeStrictTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\New_\DowngradeAnonymousClassRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\Coalesce\DowngradeNullCoalesceRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\Spaceship\DowngradeSpaceshipRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\Expression\DowngradeDefineArrayConstantRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\FuncCall\DowngradeDirnameLevelsRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\FuncCall\DowngradeSessionStartArrayOptionsRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\FuncCall\DowngradeUncallableValueCallToCallUserFuncRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\GroupUse\SplitGroupedUseImportsRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\MethodCall\DowngradeClosureCallRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\ClassMethod\DowngradeParentTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\MethodCall\DowngradeMethodCallOnCloneRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp70\Rector\Expr\DowngradeUnnecessarilyParenthesizedExpressionRector::class);
|
||||
};
|
||||
|
|
|
@ -3,30 +3,30 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\Array_\SymmetricArrayDestructuringToListRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\ClassConst\DowngradeClassConstantVisibilityRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\ConstFetch\DowngradePhp71JsonConstRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\FuncCall\DowngradeIsIterableRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\FunctionLike\DowngradeIterablePseudoTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\FunctionLike\DowngradeNullableTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\FunctionLike\DowngradeVoidTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\List_\DowngradeKeysInListRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\StaticCall\DowngradeClosureFromCallableRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\String_\DowngradeNegativeStringOffsetToStrlenRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp71\Rector\TryCatch\DowngradePipeToMultiCatchExceptionRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_70);
|
||||
$rectorConfig->rule(DowngradeNullableTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeVoidTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeClassConstantVisibilityRector::class);
|
||||
$rectorConfig->rule(DowngradePipeToMultiCatchExceptionRector::class);
|
||||
$rectorConfig->rule(SymmetricArrayDestructuringToListRector::class);
|
||||
$rectorConfig->rule(DowngradeNegativeStringOffsetToStrlenRector::class);
|
||||
$rectorConfig->rule(DowngradeKeysInListRector::class);
|
||||
$rectorConfig->rule(DowngradeIterablePseudoTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeIsIterableRector::class);
|
||||
$rectorConfig->rule(DowngradeClosureFromCallableRector::class);
|
||||
$rectorConfig->rule(DowngradePhp71JsonConstRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp71\Rector\Array_\SymmetricArrayDestructuringToListRector;
|
||||
use Rector\DowngradePhp71\Rector\ClassConst\DowngradeClassConstantVisibilityRector;
|
||||
use Rector\DowngradePhp71\Rector\ConstFetch\DowngradePhp71JsonConstRector;
|
||||
use Rector\DowngradePhp71\Rector\FuncCall\DowngradeIsIterableRector;
|
||||
use Rector\DowngradePhp71\Rector\FunctionLike\DowngradeIterablePseudoTypeDeclarationRector;
|
||||
use Rector\DowngradePhp71\Rector\FunctionLike\DowngradeNullableTypeDeclarationRector;
|
||||
use Rector\DowngradePhp71\Rector\FunctionLike\DowngradeVoidTypeDeclarationRector;
|
||||
use Rector\DowngradePhp71\Rector\List_\DowngradeKeysInListRector;
|
||||
use Rector\DowngradePhp71\Rector\StaticCall\DowngradeClosureFromCallableRector;
|
||||
use Rector\DowngradePhp71\Rector\String_\DowngradeNegativeStringOffsetToStrlenRector;
|
||||
use Rector\DowngradePhp71\Rector\TryCatch\DowngradePipeToMultiCatchExceptionRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_70);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\FunctionLike\DowngradeNullableTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\FunctionLike\DowngradeVoidTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\ClassConst\DowngradeClassConstantVisibilityRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\TryCatch\DowngradePipeToMultiCatchExceptionRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\Array_\SymmetricArrayDestructuringToListRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\String_\DowngradeNegativeStringOffsetToStrlenRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\List_\DowngradeKeysInListRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\FunctionLike\DowngradeIterablePseudoTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\FuncCall\DowngradeIsIterableRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\StaticCall\DowngradeClosureFromCallableRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp71\Rector\ConstFetch\DowngradePhp71JsonConstRector::class);
|
||||
};
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp72\Rector\ConstFetch\DowngradePhp72JsonConstRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp72\Rector\FuncCall\DowngradeJsonDecodeNullAssociativeArgRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp72\Rector\FuncCall\DowngradePregUnmatchedAsNullConstantRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp72\Rector\FuncCall\DowngradeStreamIsattyRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp72\Rector\FunctionLike\DowngradeObjectTypeDeclarationRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_71);
|
||||
$rectorConfig->rule(DowngradeObjectTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeParameterTypeWideningRector::class);
|
||||
$rectorConfig->rule(DowngradePregUnmatchedAsNullConstantRector::class);
|
||||
$rectorConfig->rule(DowngradeStreamIsattyRector::class);
|
||||
$rectorConfig->rule(DowngradeJsonDecodeNullAssociativeArgRector::class);
|
||||
$rectorConfig->rule(DowngradePhp72JsonConstRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector;
|
||||
use Rector\DowngradePhp72\Rector\ConstFetch\DowngradePhp72JsonConstRector;
|
||||
use Rector\DowngradePhp72\Rector\FuncCall\DowngradeJsonDecodeNullAssociativeArgRector;
|
||||
use Rector\DowngradePhp72\Rector\FuncCall\DowngradePregUnmatchedAsNullConstantRector;
|
||||
use Rector\DowngradePhp72\Rector\FuncCall\DowngradeStreamIsattyRector;
|
||||
use Rector\DowngradePhp72\Rector\FunctionLike\DowngradeObjectTypeDeclarationRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_71);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp72\Rector\FunctionLike\DowngradeObjectTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp72\Rector\FuncCall\DowngradePregUnmatchedAsNullConstantRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp72\Rector\FuncCall\DowngradeStreamIsattyRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp72\Rector\FuncCall\DowngradeJsonDecodeNullAssociativeArgRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp72\Rector\ConstFetch\DowngradePhp72JsonConstRector::class);
|
||||
};
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp73\Rector\ConstFetch\DowngradePhp73JsonConstRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp73\Rector\FuncCall\DowngradeArrayKeyFirstLastRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp73\Rector\FuncCall\DowngradeIsCountableRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp73\Rector\FuncCall\DowngradeTrailingCommasInFunctionCallsRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp73\Rector\FuncCall\SetCookieOptionsArrayToArgumentsRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp73\Rector\List_\DowngradeListReferenceAssignmentRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntaxRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_72);
|
||||
$rectorConfig->rule(DowngradeFlexibleHeredocSyntaxRector::class);
|
||||
$rectorConfig->rule(DowngradeListReferenceAssignmentRector::class);
|
||||
$rectorConfig->rule(DowngradeTrailingCommasInFunctionCallsRector::class);
|
||||
$rectorConfig->rule(DowngradeArrayKeyFirstLastRector::class);
|
||||
$rectorConfig->rule(SetCookieOptionsArrayToArgumentsRector::class);
|
||||
$rectorConfig->rule(DowngradeIsCountableRector::class);
|
||||
$rectorConfig->rule(DowngradePhp73JsonConstRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp73\Rector\ConstFetch\DowngradePhp73JsonConstRector;
|
||||
use Rector\DowngradePhp73\Rector\FuncCall\DowngradeArrayKeyFirstLastRector;
|
||||
use Rector\DowngradePhp73\Rector\FuncCall\DowngradeIsCountableRector;
|
||||
use Rector\DowngradePhp73\Rector\FuncCall\DowngradeTrailingCommasInFunctionCallsRector;
|
||||
use Rector\DowngradePhp73\Rector\FuncCall\SetCookieOptionsArrayToArgumentsRector;
|
||||
use Rector\DowngradePhp73\Rector\List_\DowngradeListReferenceAssignmentRector;
|
||||
use Rector\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntaxRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_72);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntaxRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp73\Rector\List_\DowngradeListReferenceAssignmentRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp73\Rector\FuncCall\DowngradeTrailingCommasInFunctionCallsRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp73\Rector\FuncCall\DowngradeArrayKeyFirstLastRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp73\Rector\FuncCall\SetCookieOptionsArrayToArgumentsRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp73\Rector\FuncCall\DowngradeIsCountableRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp73\Rector\ConstFetch\DowngradePhp73JsonConstRector::class);
|
||||
};
|
||||
|
|
|
@ -3,32 +3,32 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\ClassMethod\DowngradeContravariantArgumentTypeRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\ClassMethod\DowngradeCovariantReturnTypeRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\Coalesce\DowngradeNullCoalescingOperatorRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\FuncCall\DowngradeArrayMergeCallWithoutArgumentsRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\FuncCall\DowngradeStripTagsCallWithArrayRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\Identical\DowngradeFreadFwriteFalsyToNegationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\Interface_\DowngradePreviouslyImplementedInterfaceRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\LNumber\DowngradeNumericLiteralSeparatorRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\MethodCall\DowngradeReflectionGetTypeRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_73);
|
||||
$rectorConfig->rule(DowngradeTypedPropertyRector::class);
|
||||
$rectorConfig->rule(ArrowFunctionToAnonymousFunctionRector::class);
|
||||
$rectorConfig->rule(DowngradeCovariantReturnTypeRector::class);
|
||||
$rectorConfig->rule(DowngradeContravariantArgumentTypeRector::class);
|
||||
$rectorConfig->rule(DowngradeNullCoalescingOperatorRector::class);
|
||||
$rectorConfig->rule(DowngradeNumericLiteralSeparatorRector::class);
|
||||
$rectorConfig->rule(DowngradeStripTagsCallWithArrayRector::class);
|
||||
$rectorConfig->rule(DowngradeArraySpreadRector::class);
|
||||
$rectorConfig->rule(DowngradeArrayMergeCallWithoutArgumentsRector::class);
|
||||
$rectorConfig->rule(DowngradeFreadFwriteFalsyToNegationRector::class);
|
||||
$rectorConfig->rule(DowngradePreviouslyImplementedInterfaceRector::class);
|
||||
$rectorConfig->rule(DowngradeReflectionGetTypeRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector;
|
||||
use Rector\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector;
|
||||
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeContravariantArgumentTypeRector;
|
||||
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeCovariantReturnTypeRector;
|
||||
use Rector\DowngradePhp74\Rector\Coalesce\DowngradeNullCoalescingOperatorRector;
|
||||
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeArrayMergeCallWithoutArgumentsRector;
|
||||
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeStripTagsCallWithArrayRector;
|
||||
use Rector\DowngradePhp74\Rector\Identical\DowngradeFreadFwriteFalsyToNegationRector;
|
||||
use Rector\DowngradePhp74\Rector\Interface_\DowngradePreviouslyImplementedInterfaceRector;
|
||||
use Rector\DowngradePhp74\Rector\LNumber\DowngradeNumericLiteralSeparatorRector;
|
||||
use Rector\DowngradePhp74\Rector\MethodCall\DowngradeReflectionGetTypeRector;
|
||||
use Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_73);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\ClassMethod\DowngradeCovariantReturnTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\ClassMethod\DowngradeContravariantArgumentTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\Coalesce\DowngradeNullCoalescingOperatorRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\LNumber\DowngradeNumericLiteralSeparatorRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\FuncCall\DowngradeStripTagsCallWithArrayRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\FuncCall\DowngradeArrayMergeCallWithoutArgumentsRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\Identical\DowngradeFreadFwriteFalsyToNegationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\Interface_\DowngradePreviouslyImplementedInterfaceRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp74\Rector\MethodCall\DowngradeReflectionGetTypeRector::class);
|
||||
};
|
||||
|
|
|
@ -3,75 +3,75 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\ArrayDimFetch\DowngradeDereferenceableOperationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\Catch_\DowngradeNonCapturingCatchesRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\Class_\DowngradeAttributeToAnnotationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\Class_\DowngradePropertyPromotionRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\ClassConstFetch\DowngradeClassOnObjectToGetClassRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeAbstractPrivateMethodInTraitRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeRecursiveDirectoryIteratorHasChildrenRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStaticTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStringReturnTypeOnToStringRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeTrailingCommasInParamUseRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\Expression\DowngradeMatchToSwitchRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\FuncCall\DowngradeArrayFilterNullableCallbackRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\FuncCall\DowngradeNumberFormatNoFourthArgRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrContainsRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrEndsWithRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrStartsWithRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\Instanceof_\DowngradePhp80ResourceReturnToObjectRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\MethodCall\DowngradeNamedArgumentRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionClassGetConstantsFilterRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionGetAttributesRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionPropertyGetDefaultValueRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\New_\DowngradeArbitraryExpressionsSupportRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\NullsafeMethodCall\DowngradeNullsafeToTernaryOperatorRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\Property\DowngradeUnionTypeTypedPropertyRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\Rector\StaticCall\DowngradePhpTokenRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation;
|
||||
use RectorPrefix20220606\Rector\Removing\Rector\Class_\RemoveInterfacesRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_74);
|
||||
$rectorConfig->ruleWithConfiguration(RemoveInterfacesRector::class, [
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp80\Rector\ArrayDimFetch\DowngradeDereferenceableOperationRector;
|
||||
use Rector\DowngradePhp80\Rector\Catch_\DowngradeNonCapturingCatchesRector;
|
||||
use Rector\DowngradePhp80\Rector\Class_\DowngradeAttributeToAnnotationRector;
|
||||
use Rector\DowngradePhp80\Rector\Class_\DowngradePropertyPromotionRector;
|
||||
use Rector\DowngradePhp80\Rector\ClassConstFetch\DowngradeClassOnObjectToGetClassRector;
|
||||
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeAbstractPrivateMethodInTraitRector;
|
||||
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeRecursiveDirectoryIteratorHasChildrenRector;
|
||||
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStaticTypeDeclarationRector;
|
||||
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStringReturnTypeOnToStringRector;
|
||||
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeTrailingCommasInParamUseRector;
|
||||
use Rector\DowngradePhp80\Rector\Expression\DowngradeMatchToSwitchRector;
|
||||
use Rector\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector;
|
||||
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeArrayFilterNullableCallbackRector;
|
||||
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeNumberFormatNoFourthArgRector;
|
||||
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrContainsRector;
|
||||
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrEndsWithRector;
|
||||
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrStartsWithRector;
|
||||
use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRector;
|
||||
use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector;
|
||||
use Rector\DowngradePhp80\Rector\Instanceof_\DowngradePhp80ResourceReturnToObjectRector;
|
||||
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeNamedArgumentRector;
|
||||
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionClassGetConstantsFilterRector;
|
||||
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionGetAttributesRector;
|
||||
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionPropertyGetDefaultValueRector;
|
||||
use Rector\DowngradePhp80\Rector\New_\DowngradeArbitraryExpressionsSupportRector;
|
||||
use Rector\DowngradePhp80\Rector\NullsafeMethodCall\DowngradeNullsafeToTernaryOperatorRector;
|
||||
use Rector\DowngradePhp80\Rector\Property\DowngradeUnionTypeTypedPropertyRector;
|
||||
use Rector\DowngradePhp80\Rector\StaticCall\DowngradePhpTokenRector;
|
||||
use Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation;
|
||||
use Rector\Removing\Rector\Class_\RemoveInterfacesRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_74);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Removing\Rector\Class_\RemoveInterfacesRector::class, [
|
||||
// @see https://wiki.php.net/rfc/stringable
|
||||
'Stringable',
|
||||
]);
|
||||
$rectorConfig->rule(DowngradeNamedArgumentRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(DowngradeAttributeToAnnotationRector::class, [
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\MethodCall\DowngradeNamedArgumentRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\DowngradePhp80\Rector\Class_\DowngradeAttributeToAnnotationRector::class, [
|
||||
// Symfony
|
||||
new DowngradeAttributeToAnnotation('Symfony\\Contracts\\Service\\Attribute\\Required', 'required'),
|
||||
new \Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation('Symfony\\Contracts\\Service\\Attribute\\Required', 'required'),
|
||||
// Nette
|
||||
new DowngradeAttributeToAnnotation('Nette\\DI\\Attributes\\Inject', 'inject'),
|
||||
new \Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation('Nette\\DI\\Attributes\\Inject', 'inject'),
|
||||
]);
|
||||
$rectorConfig->rule(DowngradeDereferenceableOperationRector::class);
|
||||
$rectorConfig->rule(DowngradeUnionTypeTypedPropertyRector::class);
|
||||
$rectorConfig->rule(DowngradeUnionTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeMixedTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeStaticTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradeAbstractPrivateMethodInTraitRector::class);
|
||||
$rectorConfig->rule(DowngradePropertyPromotionRector::class);
|
||||
$rectorConfig->rule(DowngradeNonCapturingCatchesRector::class);
|
||||
$rectorConfig->rule(DowngradeStrContainsRector::class);
|
||||
$rectorConfig->rule(DowngradeMatchToSwitchRector::class);
|
||||
$rectorConfig->rule(DowngradeClassOnObjectToGetClassRector::class);
|
||||
$rectorConfig->rule(DowngradeArbitraryExpressionsSupportRector::class);
|
||||
$rectorConfig->rule(DowngradeNullsafeToTernaryOperatorRector::class);
|
||||
$rectorConfig->rule(DowngradeTrailingCommasInParamUseRector::class);
|
||||
$rectorConfig->rule(DowngradeStrStartsWithRector::class);
|
||||
$rectorConfig->rule(DowngradeStrEndsWithRector::class);
|
||||
$rectorConfig->rule(DowngradePhpTokenRector::class);
|
||||
$rectorConfig->rule(DowngradeThrowExprRector::class);
|
||||
$rectorConfig->rule(DowngradePhp80ResourceReturnToObjectRector::class);
|
||||
$rectorConfig->rule(DowngradeReflectionGetAttributesRector::class);
|
||||
$rectorConfig->rule(DowngradeRecursiveDirectoryIteratorHasChildrenRector::class);
|
||||
$rectorConfig->rule(DowngradeReflectionPropertyGetDefaultValueRector::class);
|
||||
$rectorConfig->rule(DowngradeReflectionClassGetConstantsFilterRector::class);
|
||||
$rectorConfig->rule(DowngradeArrayFilterNullableCallbackRector::class);
|
||||
$rectorConfig->rule(DowngradeNumberFormatNoFourthArgRector::class);
|
||||
$rectorConfig->rule(DowngradeStringReturnTypeOnToStringRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\ArrayDimFetch\DowngradeDereferenceableOperationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\Property\DowngradeUnionTypeTypedPropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStaticTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeAbstractPrivateMethodInTraitRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\Class_\DowngradePropertyPromotionRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\Catch_\DowngradeNonCapturingCatchesRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrContainsRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\Expression\DowngradeMatchToSwitchRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\ClassConstFetch\DowngradeClassOnObjectToGetClassRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\New_\DowngradeArbitraryExpressionsSupportRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\NullsafeMethodCall\DowngradeNullsafeToTernaryOperatorRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeTrailingCommasInParamUseRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrStartsWithRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrEndsWithRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\StaticCall\DowngradePhpTokenRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\Instanceof_\DowngradePhp80ResourceReturnToObjectRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionGetAttributesRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeRecursiveDirectoryIteratorHasChildrenRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionPropertyGetDefaultValueRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionClassGetConstantsFilterRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\FuncCall\DowngradeArrayFilterNullableCallbackRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\FuncCall\DowngradeNumberFormatNoFourthArgRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStringReturnTypeOnToStringRector::class);
|
||||
};
|
||||
|
|
|
@ -3,26 +3,26 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp81\Rector\ClassConst\DowngradeFinalizePublicClassConstantRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp81\Rector\FuncCall\DowngradeFirstClassCallableSyntaxRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp81\Rector\FunctionLike\DowngradeNeverTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp81\Rector\FunctionLike\DowngradeNewInInitializerRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp81\Rector\FunctionLike\DowngradePureIntersectionTypeRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp81\Rector\Instanceof_\DowngradePhp81ResourceReturnToObjectRector;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp81\Rector\Property\DowngradeReadonlyPropertyRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_80);
|
||||
$rectorConfig->rule(DowngradeFinalizePublicClassConstantRector::class);
|
||||
$rectorConfig->rule(DowngradeFirstClassCallableSyntaxRector::class);
|
||||
$rectorConfig->rule(DowngradeNeverTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(DowngradePureIntersectionTypeRector::class);
|
||||
$rectorConfig->rule(DowngradeNewInInitializerRector::class);
|
||||
$rectorConfig->rule(DowngradePhp81ResourceReturnToObjectRector::class);
|
||||
$rectorConfig->rule(DowngradeReadonlyPropertyRector::class);
|
||||
$rectorConfig->rule(DowngradeArraySpreadStringKeyRector::class);
|
||||
$rectorConfig->rule(DowngradeArrayIsListRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector;
|
||||
use Rector\DowngradePhp81\Rector\ClassConst\DowngradeFinalizePublicClassConstantRector;
|
||||
use Rector\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector;
|
||||
use Rector\DowngradePhp81\Rector\FuncCall\DowngradeFirstClassCallableSyntaxRector;
|
||||
use Rector\DowngradePhp81\Rector\FunctionLike\DowngradeNeverTypeDeclarationRector;
|
||||
use Rector\DowngradePhp81\Rector\FunctionLike\DowngradeNewInInitializerRector;
|
||||
use Rector\DowngradePhp81\Rector\FunctionLike\DowngradePureIntersectionTypeRector;
|
||||
use Rector\DowngradePhp81\Rector\Instanceof_\DowngradePhp81ResourceReturnToObjectRector;
|
||||
use Rector\DowngradePhp81\Rector\Property\DowngradeReadonlyPropertyRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_80);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp81\Rector\ClassConst\DowngradeFinalizePublicClassConstantRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp81\Rector\FuncCall\DowngradeFirstClassCallableSyntaxRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp81\Rector\FunctionLike\DowngradeNeverTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp81\Rector\FunctionLike\DowngradePureIntersectionTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp81\Rector\FunctionLike\DowngradeNewInInitializerRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp81\Rector\Instanceof_\DowngradePhp81ResourceReturnToObjectRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp81\Rector\Property\DowngradeReadonlyPropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector::class);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector::class);
|
||||
};
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\DowngradePhp82\Rector\Class_\DowngradeReadonlyClassRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_81);
|
||||
$rectorConfig->rule(DowngradeReadonlyClassRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp82\Rector\Class_\DowngradeReadonlyClassRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_81);
|
||||
$rectorConfig->rule(\Rector\DowngradePhp82\Rector\Class_\DowngradeReadonlyClassRector::class);
|
||||
};
|
||||
|
|
|
@ -3,28 +3,28 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\Foreach_\ReturnAfterToEarlyOnBreakRector;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\If_\ChangeOrIfReturnToEarlyReturnRector;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\Return_\ReturnBinaryAndToEarlyReturnRector;
|
||||
use RectorPrefix20220606\Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(ChangeNestedForeachIfsToEarlyContinueRector::class);
|
||||
$rectorConfig->rule(ChangeAndIfToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(ChangeIfElseValueAssignToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(ChangeNestedIfsToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(RemoveAlwaysElseRector::class);
|
||||
$rectorConfig->rule(ReturnBinaryAndToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(ChangeOrIfReturnToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(ChangeOrIfContinueToMultiContinueRector::class);
|
||||
$rectorConfig->rule(ReturnAfterToEarlyOnBreakRector::class);
|
||||
$rectorConfig->rule(PreparedValueToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(ReturnBinaryOrToEarlyReturnRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
|
||||
use Rector\EarlyReturn\Rector\Foreach_\ReturnAfterToEarlyOnBreakRector;
|
||||
use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
|
||||
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
|
||||
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
|
||||
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
|
||||
use Rector\EarlyReturn\Rector\If_\ChangeOrIfReturnToEarlyReturnRector;
|
||||
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
|
||||
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
|
||||
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryAndToEarlyReturnRector;
|
||||
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector::class);
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector::class);
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\Return_\ReturnBinaryAndToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\If_\ChangeOrIfReturnToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector::class);
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\Foreach_\ReturnAfterToEarlyOnBreakRector::class);
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector::class);
|
||||
$rectorConfig->rule(\Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector::class);
|
||||
};
|
||||
|
|
|
@ -3,25 +3,25 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use RectorPrefix20220606\Rector\Renaming\ValueObject\MethodCallRename;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\MethodCall\RenameMethodRector::class, [
|
||||
// Rename is now move, specific for files.
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'rename', 'move'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'rename', 'move'),
|
||||
// No arbitrary abbreviations
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'createDir', 'createDirectory'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'createDir', 'createDirectory'),
|
||||
// Writes are now deterministic
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'update', 'write'),
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'updateStream', 'writeStream'),
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'put', 'write'),
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'putStream', 'writeStream'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'update', 'write'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'updateStream', 'writeStream'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'put', 'write'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'putStream', 'writeStream'),
|
||||
// Metadata getters are renamed
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'getTimestamp', 'lastModified'),
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'has', 'fileExists'),
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'getMimetype', 'mimeType'),
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'getSize', 'fileSize'),
|
||||
new MethodCallRename('League\\Flysystem\\FilesystemInterface', 'getVisibility', 'visibility'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'getTimestamp', 'lastModified'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'has', 'fileExists'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'getMimetype', 'mimeType'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'getSize', 'fileSize'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('League\\Flysystem\\FilesystemInterface', 'getVisibility', 'visibility'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Symfony\Rector\ClassMethod\RemoveServiceFromSensioRouteRector;
|
||||
use RectorPrefix20220606\Rector\Symfony\Rector\ClassMethod\ReplaceSensioRouteAnnotationWithSymfonyRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(ReplaceSensioRouteAnnotationWithSymfonyRector::class);
|
||||
$rectorConfig->rule(RemoveServiceFromSensioRouteRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Symfony\Rector\ClassMethod\RemoveServiceFromSensioRouteRector;
|
||||
use Rector\Symfony\Rector\ClassMethod\ReplaceSensioRouteAnnotationWithSymfonyRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Symfony\Rector\ClassMethod\ReplaceSensioRouteAnnotationWithSymfonyRector::class);
|
||||
$rectorConfig->rule(\Rector\Symfony\Rector\ClassMethod\RemoveServiceFromSensioRouteRector::class);
|
||||
};
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(TemplateAnnotationToThisRenderRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector::class);
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,16 +3,16 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use RectorPrefix20220606\Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use RectorPrefix20220606\Rector\Transform\Rector\FuncCall\FuncCallToMethodCallRector;
|
||||
use RectorPrefix20220606\Rector\Transform\Rector\StaticCall\StaticCallToFuncCallRector;
|
||||
use RectorPrefix20220606\Rector\Transform\ValueObject\FuncCallToMethodCall;
|
||||
use RectorPrefix20220606\Rector\Transform\ValueObject\StaticCallToFuncCall;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$configuration = [new FuncCallToMethodCall('GuzzleHttp\\json_decode', 'GuzzleHttp\\Utils', 'jsonDecode'), new FuncCallToMethodCall('GuzzleHttp\\get_path', 'GuzzleHttp\\Utils', 'getPath')];
|
||||
$rectorConfig->ruleWithConfiguration(FuncCallToMethodCallRector::class, $configuration);
|
||||
$rectorConfig->ruleWithConfiguration(StaticCallToFuncCallRector::class, [new StaticCallToFuncCall('GuzzleHttp\\Utils', 'setPath', 'GuzzleHttp\\set_path'), new StaticCallToFuncCall('GuzzleHttp\\Pool', 'batch', 'GuzzleHttp\\Pool\\batch')]);
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('GuzzleHttp\\Message\\MessageInterface', 'getHeaderLines', 'getHeaderAsArray')]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Transform\Rector\FuncCall\FuncCallToMethodCallRector;
|
||||
use Rector\Transform\Rector\StaticCall\StaticCallToFuncCallRector;
|
||||
use Rector\Transform\ValueObject\FuncCallToMethodCall;
|
||||
use Rector\Transform\ValueObject\StaticCallToFuncCall;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$configuration = [new \Rector\Transform\ValueObject\FuncCallToMethodCall('GuzzleHttp\\json_decode', 'GuzzleHttp\\Utils', 'jsonDecode'), new \Rector\Transform\ValueObject\FuncCallToMethodCall('GuzzleHttp\\get_path', 'GuzzleHttp\\Utils', 'getPath')];
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Transform\Rector\FuncCall\FuncCallToMethodCallRector::class, $configuration);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Transform\Rector\StaticCall\StaticCallToFuncCallRector::class, [new \Rector\Transform\ValueObject\StaticCallToFuncCall('GuzzleHttp\\Utils', 'setPath', 'GuzzleHttp\\set_path'), new \Rector\Transform\ValueObject\StaticCallToFuncCall('GuzzleHttp\\Pool', 'batch', 'GuzzleHttp\\Pool\\batch')]);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\MethodCall\RenameMethodRector::class, [new \Rector\Renaming\ValueObject\MethodCallRename('GuzzleHttp\\Message\\MessageInterface', 'getHeaderLines', 'getHeaderAsArray')]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_53, DowngradeSetList::PHP_53]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_53, \Rector\Set\ValueObject\DowngradeSetList::PHP_53]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_54, DowngradeSetList::PHP_54]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_54, \Rector\Set\ValueObject\DowngradeSetList::PHP_54]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_55, DowngradeSetList::PHP_55]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_55, \Rector\Set\ValueObject\DowngradeSetList::PHP_55]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_56, DowngradeSetList::PHP_56]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_56, \Rector\Set\ValueObject\DowngradeSetList::PHP_56]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_70, DowngradeSetList::PHP_70]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_70, \Rector\Set\ValueObject\DowngradeSetList::PHP_70]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_71, DowngradeSetList::PHP_71]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_71, \Rector\Set\ValueObject\DowngradeSetList::PHP_71]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_72, DowngradeSetList::PHP_72]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_72, \Rector\Set\ValueObject\DowngradeSetList::PHP_72]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_73, DowngradeSetList::PHP_73]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_73, \Rector\Set\ValueObject\DowngradeSetList::PHP_73]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_74, DowngradeSetList::PHP_74]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_74, \Rector\Set\ValueObject\DowngradeSetList::PHP_74]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_80, DowngradeSetList::PHP_80]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_80, \Rector\Set\ValueObject\DowngradeSetList::PHP_80]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_81, DowngradeSetList::PHP_81]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeLevelSetList;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_81, \Rector\Set\ValueObject\DowngradeSetList::PHP_81]);
|
||||
};
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([DowngradeSetList::PHP_82]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\DowngradeSetList::PHP_82]);
|
||||
};
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_54, SetList::PHP_53]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_54, \Rector\Set\ValueObject\SetList::PHP_53]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_54);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_54);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\LevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_55, LevelSetList::UP_TO_PHP_54]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_55, \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_54]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_55);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_55);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\LevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_56, LevelSetList::UP_TO_PHP_55]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_56, \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_55]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_56);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_56);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\LevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_70, LevelSetList::UP_TO_PHP_56]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_70, \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_56]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_70);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_70);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\LevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_71, LevelSetList::UP_TO_PHP_70]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_71, \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_70]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_71);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_71);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\LevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_72, LevelSetList::UP_TO_PHP_71]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_72, \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_71]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_72);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_72);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\LevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_73, LevelSetList::UP_TO_PHP_72]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_73, \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_72]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_73);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_73);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\LevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_74, LevelSetList::UP_TO_PHP_73]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_74, \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_73]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_74);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_74);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\LevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_80, LevelSetList::UP_TO_PHP_74]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_80, \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_74]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_80);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_80);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\LevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_81, LevelSetList::UP_TO_PHP_80]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_81, \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_80]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_81);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_81);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Core\ValueObject\PhpVersion;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\LevelSetList;
|
||||
use RectorPrefix20220606\Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([SetList::PHP_82, LevelSetList::UP_TO_PHP_81]);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([\Rector\Set\ValueObject\SetList::PHP_82, \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_81]);
|
||||
// parameter must be defined after import, to override imported param version
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_82);
|
||||
$rectorConfig->phpVersion(\Rector\Core\ValueObject\PhpVersion::PHP_82);
|
||||
};
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use RectorPrefix20220606\Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
# https://github.com/Seldaek/monolog/commit/39f8a20e6dadc0194e846b254c5f23d1c732290b#diff-dce565f403e044caa5e6a0d988339430
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Monolog\\Logger', 'addDebug', 'debug'), new MethodCallRename('Monolog\\Logger', 'addInfo', 'info'), new MethodCallRename('Monolog\\Logger', 'addNotice', 'notice'), new MethodCallRename('Monolog\\Logger', 'addWarning', 'warning'), new MethodCallRename('Monolog\\Logger', 'addError', 'error'), new MethodCallRename('Monolog\\Logger', 'addCritical', 'critical'), new MethodCallRename('Monolog\\Logger', 'addAlert', 'alert'), new MethodCallRename('Monolog\\Logger', 'addEmergency', 'emergency'), new MethodCallRename('Monolog\\Logger', 'warn', 'warning'), new MethodCallRename('Monolog\\Logger', 'err', 'error'), new MethodCallRename('Monolog\\Logger', 'crit', 'critical'), new MethodCallRename('Monolog\\Logger', 'emerg', 'emergency')]);
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\MethodCall\RenameMethodRector::class, [new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'addDebug', 'debug'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'addInfo', 'info'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'addNotice', 'notice'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'addWarning', 'warning'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'addError', 'error'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'addCritical', 'critical'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'addAlert', 'alert'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'addEmergency', 'emergency'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'warn', 'warning'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'err', 'error'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'crit', 'critical'), new \Rector\Renaming\ValueObject\MethodCallRename('Monolog\\Logger', 'emerg', 'emergency')]);
|
||||
};
|
||||
|
|
|
@ -3,29 +3,29 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Arguments\Rector\FuncCall\SwapFuncCallArgumentsRector;
|
||||
use RectorPrefix20220606\Rector\Arguments\ValueObject\SwapFuncCallArguments;
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\MysqlToMysqli\Rector\Assign\MysqlAssignToMysqliRector;
|
||||
use RectorPrefix20220606\Rector\MysqlToMysqli\Rector\FuncCall\MysqlFuncCallToMysqliRector;
|
||||
use RectorPrefix20220606\Rector\MysqlToMysqli\Rector\FuncCall\MysqlPConnectToMysqliConnectRector;
|
||||
use RectorPrefix20220606\Rector\MysqlToMysqli\Rector\FuncCall\MysqlQueryMysqlErrorWithLinkRector;
|
||||
use RectorPrefix20220606\Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector;
|
||||
use RectorPrefix20220606\Rector\Removing\ValueObject\RemoveFuncCallArg;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\ConstFetch\RenameConstantRector;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
use Rector\Arguments\Rector\FuncCall\SwapFuncCallArgumentsRector;
|
||||
use Rector\Arguments\ValueObject\SwapFuncCallArguments;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\MysqlToMysqli\Rector\Assign\MysqlAssignToMysqliRector;
|
||||
use Rector\MysqlToMysqli\Rector\FuncCall\MysqlFuncCallToMysqliRector;
|
||||
use Rector\MysqlToMysqli\Rector\FuncCall\MysqlPConnectToMysqliConnectRector;
|
||||
use Rector\MysqlToMysqli\Rector\FuncCall\MysqlQueryMysqlErrorWithLinkRector;
|
||||
use Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector;
|
||||
use Rector\Removing\ValueObject\RemoveFuncCallArg;
|
||||
use Rector\Renaming\Rector\ConstFetch\RenameConstantRector;
|
||||
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
# https://stackoverflow.com/a/1390625/1348344
|
||||
# https://github.com/philip/MySQLConverterTool/blob/master/Converter.php
|
||||
# https://www.phpclasses.org/blog/package/9199/post/3-Smoothly-Migrate-your-PHP-Code-using-the-Old-MySQL-extension-to-MySQLi.html
|
||||
$rectorConfig->rule(MysqlAssignToMysqliRector::class);
|
||||
$rectorConfig->rule(MysqlFuncCallToMysqliRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(RemoveFuncCallArgRector::class, [new RemoveFuncCallArg('mysql_pconnect', 3), new RemoveFuncCallArg('mysql_connect', 3), new RemoveFuncCallArg('mysql_connect', 4)]);
|
||||
$rectorConfig->rule(MysqlPConnectToMysqliConnectRector::class);
|
||||
$rectorConfig->rule(\Rector\MysqlToMysqli\Rector\Assign\MysqlAssignToMysqliRector::class);
|
||||
$rectorConfig->rule(\Rector\MysqlToMysqli\Rector\FuncCall\MysqlFuncCallToMysqliRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector::class, [new \Rector\Removing\ValueObject\RemoveFuncCallArg('mysql_pconnect', 3), new \Rector\Removing\ValueObject\RemoveFuncCallArg('mysql_connect', 3), new \Rector\Removing\ValueObject\RemoveFuncCallArg('mysql_connect', 4)]);
|
||||
$rectorConfig->rule(\Rector\MysqlToMysqli\Rector\FuncCall\MysqlPConnectToMysqliConnectRector::class);
|
||||
# first swap arguments, then rename
|
||||
$rectorConfig->ruleWithConfiguration(SwapFuncCallArgumentsRector::class, [new SwapFuncCallArguments('mysql_query', [1, 0]), new SwapFuncCallArguments('mysql_real_escape_string', [1, 0]), new SwapFuncCallArguments('mysql_select_db', [1, 0]), new SwapFuncCallArguments('mysql_set_charset', [1, 0])]);
|
||||
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, ['mysql_connect' => 'mysqli_connect', 'mysql_data_seek' => 'mysqli_data_seek', 'mysql_fetch_array' => 'mysqli_fetch_array', 'mysql_fetch_assoc' => 'mysqli_fetch_assoc', 'mysql_fetch_lengths' => 'mysqli_fetch_lengths', 'mysql_fetch_object' => 'mysqli_fetch_object', 'mysql_fetch_row' => 'mysqli_fetch_row', 'mysql_field_seek' => 'mysqli_field_seek', 'mysql_free_result' => 'mysqli_free_result', 'mysql_get_client_info' => 'mysqli_get_client_info', 'mysql_num_fields' => 'mysqli_num_fields', 'mysql_numfields' => 'mysqli_num_fields', 'mysql_num_rows' => 'mysqli_num_rows', 'mysql_numrows' => 'mysqli_num_rows']);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Arguments\Rector\FuncCall\SwapFuncCallArgumentsRector::class, [new \Rector\Arguments\ValueObject\SwapFuncCallArguments('mysql_query', [1, 0]), new \Rector\Arguments\ValueObject\SwapFuncCallArguments('mysql_real_escape_string', [1, 0]), new \Rector\Arguments\ValueObject\SwapFuncCallArguments('mysql_select_db', [1, 0]), new \Rector\Arguments\ValueObject\SwapFuncCallArguments('mysql_set_charset', [1, 0])]);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\FuncCall\RenameFunctionRector::class, ['mysql_connect' => 'mysqli_connect', 'mysql_data_seek' => 'mysqli_data_seek', 'mysql_fetch_array' => 'mysqli_fetch_array', 'mysql_fetch_assoc' => 'mysqli_fetch_assoc', 'mysql_fetch_lengths' => 'mysqli_fetch_lengths', 'mysql_fetch_object' => 'mysqli_fetch_object', 'mysql_fetch_row' => 'mysqli_fetch_row', 'mysql_field_seek' => 'mysqli_field_seek', 'mysql_free_result' => 'mysqli_free_result', 'mysql_get_client_info' => 'mysqli_get_client_info', 'mysql_num_fields' => 'mysqli_num_fields', 'mysql_numfields' => 'mysqli_num_fields', 'mysql_num_rows' => 'mysqli_num_rows', 'mysql_numrows' => 'mysqli_num_rows']);
|
||||
# http://php.net/manual/en/mysql.constants.php → http://php.net/manual/en/mysqli.constants.php
|
||||
$rectorConfig->ruleWithConfiguration(RenameConstantRector::class, ['MYSQL_ASSOC' => 'MYSQLI_ASSOC', 'MYSQL_BOTH' => 'MYSQLI_BOTH', 'MYSQL_CLIENT_COMPRESS' => 'MYSQLI_CLIENT_COMPRESS', 'MYSQL_CLIENT_IGNORE_SPACE' => 'MYSQLI_CLIENT_IGNORE_SPACE', 'MYSQL_CLIENT_INTERACTIVE' => 'MYSQLI_CLIENT_INTERACTIVE', 'MYSQL_CLIENT_SSL' => 'MYSQLI_CLIENT_SSL', 'MYSQL_NUM' => 'MYSQLI_NUM', 'MYSQL_PRIMARY_KEY_FLAG' => 'MYSQLI_PRI_KEY_FLAG']);
|
||||
$rectorConfig->rule(MysqlQueryMysqlErrorWithLinkRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\ConstFetch\RenameConstantRector::class, ['MYSQL_ASSOC' => 'MYSQLI_ASSOC', 'MYSQL_BOTH' => 'MYSQLI_BOTH', 'MYSQL_CLIENT_COMPRESS' => 'MYSQLI_CLIENT_COMPRESS', 'MYSQL_CLIENT_IGNORE_SPACE' => 'MYSQLI_CLIENT_IGNORE_SPACE', 'MYSQL_CLIENT_INTERACTIVE' => 'MYSQLI_CLIENT_INTERACTIVE', 'MYSQL_CLIENT_SSL' => 'MYSQLI_CLIENT_SSL', 'MYSQL_NUM' => 'MYSQLI_NUM', 'MYSQL_PRIMARY_KEY_FLAG' => 'MYSQLI_PRI_KEY_FLAG']);
|
||||
$rectorConfig->rule(\Rector\MysqlToMysqli\Rector\FuncCall\MysqlQueryMysqlErrorWithLinkRector::class);
|
||||
};
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Naming\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector;
|
||||
use RectorPrefix20220606\Rector\Naming\Rector\Class_\RenamePropertyToMatchTypeRector;
|
||||
use RectorPrefix20220606\Rector\Naming\Rector\ClassMethod\RenameParamToMatchTypeRector;
|
||||
use RectorPrefix20220606\Rector\Naming\Rector\ClassMethod\RenameVariableToMatchNewTypeRector;
|
||||
use RectorPrefix20220606\Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchExprVariableRector;
|
||||
use RectorPrefix20220606\Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchMethodCallReturnTypeRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(RenameParamToMatchTypeRector::class);
|
||||
$rectorConfig->rule(RenamePropertyToMatchTypeRector::class);
|
||||
$rectorConfig->rule(RenameVariableToMatchNewTypeRector::class);
|
||||
$rectorConfig->rule(RenameVariableToMatchMethodCallReturnTypeRector::class);
|
||||
$rectorConfig->rule(RenameForeachValueVariableToMatchMethodCallReturnTypeRector::class);
|
||||
$rectorConfig->rule(RenameForeachValueVariableToMatchExprVariableRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Naming\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector;
|
||||
use Rector\Naming\Rector\Class_\RenamePropertyToMatchTypeRector;
|
||||
use Rector\Naming\Rector\ClassMethod\RenameParamToMatchTypeRector;
|
||||
use Rector\Naming\Rector\ClassMethod\RenameVariableToMatchNewTypeRector;
|
||||
use Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchExprVariableRector;
|
||||
use Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchMethodCallReturnTypeRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Naming\Rector\ClassMethod\RenameParamToMatchTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\Naming\Rector\Class_\RenamePropertyToMatchTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\Naming\Rector\ClassMethod\RenameVariableToMatchNewTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\Naming\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchMethodCallReturnTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchExprVariableRector::class);
|
||||
};
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php52\Rector\Property\VarToPublicPropertyRector;
|
||||
use RectorPrefix20220606\Rector\Php52\Rector\Switch_\ContinueToBreakInSwitchRector;
|
||||
use RectorPrefix20220606\Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector;
|
||||
use RectorPrefix20220606\Rector\Removing\ValueObject\RemoveFuncCallArg;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(VarToPublicPropertyRector::class);
|
||||
$rectorConfig->rule(ContinueToBreakInSwitchRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(RemoveFuncCallArgRector::class, [
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php52\Rector\Property\VarToPublicPropertyRector;
|
||||
use Rector\Php52\Rector\Switch_\ContinueToBreakInSwitchRector;
|
||||
use Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector;
|
||||
use Rector\Removing\ValueObject\RemoveFuncCallArg;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php52\Rector\Property\VarToPublicPropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\Php52\Rector\Switch_\ContinueToBreakInSwitchRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector::class, [
|
||||
// see https://www.php.net/manual/en/function.ldap-first-attribute.php
|
||||
new RemoveFuncCallArg('ldap_first_attribute', 2),
|
||||
new \Rector\Removing\ValueObject\RemoveFuncCallArg('ldap_first_attribute', 2),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php53\Rector\FuncCall\DirNameFileConstantToDirConstantRector;
|
||||
use RectorPrefix20220606\Rector\Php53\Rector\Ternary\TernaryToElvisRector;
|
||||
use RectorPrefix20220606\Rector\Php53\Rector\Variable\ReplaceHttpServerVarsByServerRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(TernaryToElvisRector::class);
|
||||
$rectorConfig->rule(DirNameFileConstantToDirConstantRector::class);
|
||||
$rectorConfig->rule(ReplaceHttpServerVarsByServerRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php53\Rector\FuncCall\DirNameFileConstantToDirConstantRector;
|
||||
use Rector\Php53\Rector\Ternary\TernaryToElvisRector;
|
||||
use Rector\Php53\Rector\Variable\ReplaceHttpServerVarsByServerRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php53\Rector\Ternary\TernaryToElvisRector::class);
|
||||
$rectorConfig->rule(\Rector\Php53\Rector\FuncCall\DirNameFileConstantToDirConstantRector::class);
|
||||
$rectorConfig->rule(\Rector\Php53\Rector\Variable\ReplaceHttpServerVarsByServerRector::class);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php54\Rector\Break_\RemoveZeroBreakContinueRector;
|
||||
use RectorPrefix20220606\Rector\Php54\Rector\FuncCall\RemoveReferenceFromCallRector;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, ['mysqli_param_count' => 'mysqli_stmt_param_count']);
|
||||
$rectorConfig->rule(RemoveReferenceFromCallRector::class);
|
||||
$rectorConfig->rule(RemoveZeroBreakContinueRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php54\Rector\Break_\RemoveZeroBreakContinueRector;
|
||||
use Rector\Php54\Rector\FuncCall\RemoveReferenceFromCallRector;
|
||||
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\FuncCall\RenameFunctionRector::class, ['mysqli_param_count' => 'mysqli_stmt_param_count']);
|
||||
$rectorConfig->rule(\Rector\Php54\Rector\FuncCall\RemoveReferenceFromCallRector::class);
|
||||
$rectorConfig->rule(\Rector\Php54\Rector\Break_\RemoveZeroBreakContinueRector::class);
|
||||
};
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector;
|
||||
use RectorPrefix20220606\Rector\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector;
|
||||
use RectorPrefix20220606\Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector;
|
||||
use RectorPrefix20220606\Rector\Php55\Rector\FuncCall\PregReplaceEModifierRector;
|
||||
use RectorPrefix20220606\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(StringClassNameToClassConstantRector::class);
|
||||
$rectorConfig->rule(ClassConstantToSelfClassRector::class);
|
||||
$rectorConfig->rule(PregReplaceEModifierRector::class);
|
||||
$rectorConfig->rule(GetCalledClassToSelfClassRector::class);
|
||||
$rectorConfig->rule(GetCalledClassToStaticClassRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector;
|
||||
use Rector\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector;
|
||||
use Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector;
|
||||
use Rector\Php55\Rector\FuncCall\PregReplaceEModifierRector;
|
||||
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class);
|
||||
$rectorConfig->rule(\Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector::class);
|
||||
$rectorConfig->rule(\Rector\Php55\Rector\FuncCall\PregReplaceEModifierRector::class);
|
||||
$rectorConfig->rule(\Rector\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector::class);
|
||||
$rectorConfig->rule(\Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector::class);
|
||||
};
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php56\Rector\FuncCall\PowToExpRector;
|
||||
use RectorPrefix20220606\Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(PowToExpRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, ['mcrypt_generic_end' => 'mcrypt_generic_deinit', 'set_socket_blocking' => 'stream_set_blocking', 'ocibindbyname' => 'oci_bind_by_name', 'ocicancel' => 'oci_cancel', 'ocicolumnisnull' => 'oci_field_is_null', 'ocicolumnname' => 'oci_field_name', 'ocicolumnprecision' => 'oci_field_precision', 'ocicolumnscale' => 'oci_field_scale', 'ocicolumnsize' => 'oci_field_size', 'ocicolumntype' => 'oci_field_type', 'ocicolumntyperaw' => 'oci_field_type_raw', 'ocicommit' => 'oci_commit', 'ocidefinebyname' => 'oci_define_by_name', 'ocierror' => 'oci_error', 'ociexecute' => 'oci_execute', 'ocifetch' => 'oci_fetch', 'ocifetchstatement' => 'oci_fetch_all', 'ocifreecursor' => 'oci_free_statement', 'ocifreestatement' => 'oci_free_statement', 'ociinternaldebug' => 'oci_internal_debug', 'ocilogoff' => 'oci_close', 'ocilogon' => 'oci_connect', 'ocinewcollection' => 'oci_new_collection', 'ocinewcursor' => 'oci_new_cursor', 'ocinewdescriptor' => 'oci_new_descriptor', 'ocinlogon' => 'oci_new_connect', 'ocinumcols' => 'oci_num_fields', 'ociparse' => 'oci_parse', 'ociplogon' => 'oci_pconnect', 'ociresult' => 'oci_result', 'ocirollback' => 'oci_rollback', 'ocirowcount' => 'oci_num_rows', 'ociserverversion' => 'oci_server_version', 'ocisetprefetch' => 'oci_set_prefetch', 'ocistatementtype' => 'oci_statement_type']);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php56\Rector\FuncCall\PowToExpRector;
|
||||
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
|
||||
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php56\Rector\FuncCall\PowToExpRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\FuncCall\RenameFunctionRector::class, ['mcrypt_generic_end' => 'mcrypt_generic_deinit', 'set_socket_blocking' => 'stream_set_blocking', 'ocibindbyname' => 'oci_bind_by_name', 'ocicancel' => 'oci_cancel', 'ocicolumnisnull' => 'oci_field_is_null', 'ocicolumnname' => 'oci_field_name', 'ocicolumnprecision' => 'oci_field_precision', 'ocicolumnscale' => 'oci_field_scale', 'ocicolumnsize' => 'oci_field_size', 'ocicolumntype' => 'oci_field_type', 'ocicolumntyperaw' => 'oci_field_type_raw', 'ocicommit' => 'oci_commit', 'ocidefinebyname' => 'oci_define_by_name', 'ocierror' => 'oci_error', 'ociexecute' => 'oci_execute', 'ocifetch' => 'oci_fetch', 'ocifetchstatement' => 'oci_fetch_all', 'ocifreecursor' => 'oci_free_statement', 'ocifreestatement' => 'oci_free_statement', 'ociinternaldebug' => 'oci_internal_debug', 'ocilogoff' => 'oci_close', 'ocilogon' => 'oci_connect', 'ocinewcollection' => 'oci_new_collection', 'ocinewcursor' => 'oci_new_cursor', 'ocinewdescriptor' => 'oci_new_descriptor', 'ocinlogon' => 'oci_new_connect', 'ocinumcols' => 'oci_num_fields', 'ociparse' => 'oci_parse', 'ociplogon' => 'oci_pconnect', 'ociresult' => 'oci_result', 'ocirollback' => 'oci_rollback', 'ocirowcount' => 'oci_num_rows', 'ociserverversion' => 'oci_server_version', 'ocisetprefetch' => 'oci_set_prefetch', 'ocistatementtype' => 'oci_statement_type']);
|
||||
# inspired by level in psalm - https://github.com/vimeo/psalm/blob/82e0bcafac723fdf5007a31a7ae74af1736c9f6f/tests/FileManipulationTest.php#L1063
|
||||
$rectorConfig->rule(AddDefaultValueForUndefinedVariableRector::class);
|
||||
$rectorConfig->rule(\Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector::class);
|
||||
};
|
||||
|
|
|
@ -3,45 +3,45 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\Assign\ListSplitStringRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\Assign\ListSwapArrayOrderRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\Break_\BreakNotInLoopOrSwitchToReturnRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\ClassMethod\Php4ConstructorRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\FuncCall\CallUserMethodRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\FuncCall\EregToPregMatchRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\FuncCall\MultiDirnameRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\FuncCall\NonVariableToVariableOnFunctionCallRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\FuncCall\RandomFunctionRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\FuncCall\RenameMktimeWithoutArgsToTimeRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\If_\IfToSpaceshipRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\List_\EmptyListRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\Switch_\ReduceMultipleDefaultSwitchRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\Ternary\TernaryToSpaceshipRector;
|
||||
use RectorPrefix20220606\Rector\Php70\Rector\Variable\WrapVariableVariableNameInCurlyBracesRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(Php4ConstructorRector::class);
|
||||
$rectorConfig->rule(TernaryToNullCoalescingRector::class);
|
||||
$rectorConfig->rule(RandomFunctionRector::class);
|
||||
$rectorConfig->rule(ExceptionHandlerTypehintRector::class);
|
||||
$rectorConfig->rule(MultiDirnameRector::class);
|
||||
$rectorConfig->rule(ListSplitStringRector::class);
|
||||
$rectorConfig->rule(EmptyListRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php70\Rector\Assign\ListSplitStringRector;
|
||||
use Rector\Php70\Rector\Assign\ListSwapArrayOrderRector;
|
||||
use Rector\Php70\Rector\Break_\BreakNotInLoopOrSwitchToReturnRector;
|
||||
use Rector\Php70\Rector\ClassMethod\Php4ConstructorRector;
|
||||
use Rector\Php70\Rector\FuncCall\CallUserMethodRector;
|
||||
use Rector\Php70\Rector\FuncCall\EregToPregMatchRector;
|
||||
use Rector\Php70\Rector\FuncCall\MultiDirnameRector;
|
||||
use Rector\Php70\Rector\FuncCall\NonVariableToVariableOnFunctionCallRector;
|
||||
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
|
||||
use Rector\Php70\Rector\FuncCall\RenameMktimeWithoutArgsToTimeRector;
|
||||
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
|
||||
use Rector\Php70\Rector\If_\IfToSpaceshipRector;
|
||||
use Rector\Php70\Rector\List_\EmptyListRector;
|
||||
use Rector\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector;
|
||||
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
|
||||
use Rector\Php70\Rector\Switch_\ReduceMultipleDefaultSwitchRector;
|
||||
use Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector;
|
||||
use Rector\Php70\Rector\Ternary\TernaryToSpaceshipRector;
|
||||
use Rector\Php70\Rector\Variable\WrapVariableVariableNameInCurlyBracesRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\ClassMethod\Php4ConstructorRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\FuncCall\RandomFunctionRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\FuncCall\MultiDirnameRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\Assign\ListSplitStringRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\List_\EmptyListRector::class);
|
||||
# be careful, run this just once, since it can keep swapping order back and forth
|
||||
$rectorConfig->rule(ListSwapArrayOrderRector::class);
|
||||
$rectorConfig->rule(CallUserMethodRector::class);
|
||||
$rectorConfig->rule(EregToPregMatchRector::class);
|
||||
$rectorConfig->rule(ReduceMultipleDefaultSwitchRector::class);
|
||||
$rectorConfig->rule(TernaryToSpaceshipRector::class);
|
||||
$rectorConfig->rule(WrapVariableVariableNameInCurlyBracesRector::class);
|
||||
$rectorConfig->rule(IfToSpaceshipRector::class);
|
||||
$rectorConfig->rule(StaticCallOnNonStaticToInstanceCallRector::class);
|
||||
$rectorConfig->rule(ThisCallOnStaticMethodToStaticCallRector::class);
|
||||
$rectorConfig->rule(BreakNotInLoopOrSwitchToReturnRector::class);
|
||||
$rectorConfig->rule(RenameMktimeWithoutArgsToTimeRector::class);
|
||||
$rectorConfig->rule(NonVariableToVariableOnFunctionCallRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\Assign\ListSwapArrayOrderRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\FuncCall\CallUserMethodRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\FuncCall\EregToPregMatchRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\Switch_\ReduceMultipleDefaultSwitchRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\Ternary\TernaryToSpaceshipRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\Variable\WrapVariableVariableNameInCurlyBracesRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\If_\IfToSpaceshipRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\Break_\BreakNotInLoopOrSwitchToReturnRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\FuncCall\RenameMktimeWithoutArgsToTimeRector::class);
|
||||
$rectorConfig->rule(\Rector\Php70\Rector\FuncCall\NonVariableToVariableOnFunctionCallRector::class);
|
||||
};
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php71\Rector\Assign\AssignArrayToStringRector;
|
||||
use RectorPrefix20220606\Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector;
|
||||
use RectorPrefix20220606\Rector\Php71\Rector\BooleanOr\IsIterableRector;
|
||||
use RectorPrefix20220606\Rector\Php71\Rector\ClassConst\PublicConstantVisibilityRector;
|
||||
use RectorPrefix20220606\Rector\Php71\Rector\FuncCall\CountOnNullRector;
|
||||
use RectorPrefix20220606\Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
|
||||
use RectorPrefix20220606\Rector\Php71\Rector\List_\ListToArrayDestructRector;
|
||||
use RectorPrefix20220606\Rector\Php71\Rector\TryCatch\MultiExceptionCatchRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(IsIterableRector::class);
|
||||
$rectorConfig->rule(MultiExceptionCatchRector::class);
|
||||
$rectorConfig->rule(AssignArrayToStringRector::class);
|
||||
$rectorConfig->rule(CountOnNullRector::class);
|
||||
$rectorConfig->rule(RemoveExtraParametersRector::class);
|
||||
$rectorConfig->rule(BinaryOpBetweenNumberAndStringRector::class);
|
||||
$rectorConfig->rule(ListToArrayDestructRector::class);
|
||||
$rectorConfig->rule(PublicConstantVisibilityRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php71\Rector\Assign\AssignArrayToStringRector;
|
||||
use Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector;
|
||||
use Rector\Php71\Rector\BooleanOr\IsIterableRector;
|
||||
use Rector\Php71\Rector\ClassConst\PublicConstantVisibilityRector;
|
||||
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
|
||||
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
|
||||
use Rector\Php71\Rector\List_\ListToArrayDestructRector;
|
||||
use Rector\Php71\Rector\TryCatch\MultiExceptionCatchRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php71\Rector\BooleanOr\IsIterableRector::class);
|
||||
$rectorConfig->rule(\Rector\Php71\Rector\TryCatch\MultiExceptionCatchRector::class);
|
||||
$rectorConfig->rule(\Rector\Php71\Rector\Assign\AssignArrayToStringRector::class);
|
||||
$rectorConfig->rule(\Rector\Php71\Rector\FuncCall\CountOnNullRector::class);
|
||||
$rectorConfig->rule(\Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector::class);
|
||||
$rectorConfig->rule(\Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector::class);
|
||||
$rectorConfig->rule(\Rector\Php71\Rector\List_\ListToArrayDestructRector::class);
|
||||
$rectorConfig->rule(\Rector\Php71\Rector\ClassConst\PublicConstantVisibilityRector::class);
|
||||
};
|
||||
|
|
|
@ -3,24 +3,24 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php72\Rector\Assign\ListEachRector;
|
||||
use RectorPrefix20220606\Rector\Php72\Rector\Assign\ReplaceEachAssignmentWithKeyCurrentRector;
|
||||
use RectorPrefix20220606\Rector\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector;
|
||||
use RectorPrefix20220606\Rector\Php72\Rector\FuncCall\GetClassOnNullRector;
|
||||
use RectorPrefix20220606\Rector\Php72\Rector\FuncCall\IsObjectOnIncompleteClassRector;
|
||||
use RectorPrefix20220606\Rector\Php72\Rector\FuncCall\ParseStrWithResultArgumentRector;
|
||||
use RectorPrefix20220606\Rector\Php72\Rector\FuncCall\StringifyDefineRector;
|
||||
use RectorPrefix20220606\Rector\Php72\Rector\FuncCall\StringsAssertNakedRector;
|
||||
use RectorPrefix20220606\Rector\Php72\Rector\Unset_\UnsetCastRector;
|
||||
use RectorPrefix20220606\Rector\Php72\Rector\While_\WhileEachToForeachRector;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(WhileEachToForeachRector::class);
|
||||
$rectorConfig->rule(ListEachRector::class);
|
||||
$rectorConfig->rule(ReplaceEachAssignmentWithKeyCurrentRector::class);
|
||||
$rectorConfig->rule(UnsetCastRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php72\Rector\Assign\ListEachRector;
|
||||
use Rector\Php72\Rector\Assign\ReplaceEachAssignmentWithKeyCurrentRector;
|
||||
use Rector\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector;
|
||||
use Rector\Php72\Rector\FuncCall\GetClassOnNullRector;
|
||||
use Rector\Php72\Rector\FuncCall\IsObjectOnIncompleteClassRector;
|
||||
use Rector\Php72\Rector\FuncCall\ParseStrWithResultArgumentRector;
|
||||
use Rector\Php72\Rector\FuncCall\StringifyDefineRector;
|
||||
use Rector\Php72\Rector\FuncCall\StringsAssertNakedRector;
|
||||
use Rector\Php72\Rector\Unset_\UnsetCastRector;
|
||||
use Rector\Php72\Rector\While_\WhileEachToForeachRector;
|
||||
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php72\Rector\While_\WhileEachToForeachRector::class);
|
||||
$rectorConfig->rule(\Rector\Php72\Rector\Assign\ListEachRector::class);
|
||||
$rectorConfig->rule(\Rector\Php72\Rector\Assign\ReplaceEachAssignmentWithKeyCurrentRector::class);
|
||||
$rectorConfig->rule(\Rector\Php72\Rector\Unset_\UnsetCastRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\FuncCall\RenameFunctionRector::class, [
|
||||
# and imagewbmp
|
||||
'jpeg2wbmp' => 'imagecreatefromjpeg',
|
||||
# or imagewbmp
|
||||
|
@ -31,10 +31,10 @@ return static function (RectorConfig $rectorConfig) : void {
|
|||
'gmp_random' => 'gmp_random_bits',
|
||||
'read_exif_data' => 'exif_read_data',
|
||||
]);
|
||||
$rectorConfig->rule(GetClassOnNullRector::class);
|
||||
$rectorConfig->rule(IsObjectOnIncompleteClassRector::class);
|
||||
$rectorConfig->rule(ParseStrWithResultArgumentRector::class);
|
||||
$rectorConfig->rule(StringsAssertNakedRector::class);
|
||||
$rectorConfig->rule(CreateFunctionToAnonymousFunctionRector::class);
|
||||
$rectorConfig->rule(StringifyDefineRector::class);
|
||||
$rectorConfig->rule(\Rector\Php72\Rector\FuncCall\GetClassOnNullRector::class);
|
||||
$rectorConfig->rule(\Rector\Php72\Rector\FuncCall\IsObjectOnIncompleteClassRector::class);
|
||||
$rectorConfig->rule(\Rector\Php72\Rector\FuncCall\ParseStrWithResultArgumentRector::class);
|
||||
$rectorConfig->rule(\Rector\Php72\Rector\FuncCall\StringsAssertNakedRector::class);
|
||||
$rectorConfig->rule(\Rector\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector::class);
|
||||
$rectorConfig->rule(\Rector\Php72\Rector\FuncCall\StringifyDefineRector::class);
|
||||
};
|
||||
|
|
|
@ -3,25 +3,25 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php52\Rector\Switch_\ContinueToBreakInSwitchRector;
|
||||
use RectorPrefix20220606\Rector\Php73\Rector\BooleanOr\IsCountableRector;
|
||||
use RectorPrefix20220606\Rector\Php73\Rector\ConstFetch\SensitiveConstantNameRector;
|
||||
use RectorPrefix20220606\Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector;
|
||||
use RectorPrefix20220606\Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
|
||||
use RectorPrefix20220606\Rector\Php73\Rector\FuncCall\RegexDashEscapeRector;
|
||||
use RectorPrefix20220606\Rector\Php73\Rector\FuncCall\SensitiveDefineRector;
|
||||
use RectorPrefix20220606\Rector\Php73\Rector\FuncCall\SetCookieRector;
|
||||
use RectorPrefix20220606\Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
|
||||
use RectorPrefix20220606\Rector\Php73\Rector\String_\SensitiveHereNowDocRector;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(IsCountableRector::class);
|
||||
$rectorConfig->rule(ArrayKeyFirstLastRector::class);
|
||||
$rectorConfig->rule(SensitiveDefineRector::class);
|
||||
$rectorConfig->rule(SensitiveConstantNameRector::class);
|
||||
$rectorConfig->rule(SensitiveHereNowDocRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php52\Rector\Switch_\ContinueToBreakInSwitchRector;
|
||||
use Rector\Php73\Rector\BooleanOr\IsCountableRector;
|
||||
use Rector\Php73\Rector\ConstFetch\SensitiveConstantNameRector;
|
||||
use Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector;
|
||||
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
|
||||
use Rector\Php73\Rector\FuncCall\RegexDashEscapeRector;
|
||||
use Rector\Php73\Rector\FuncCall\SensitiveDefineRector;
|
||||
use Rector\Php73\Rector\FuncCall\SetCookieRector;
|
||||
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
|
||||
use Rector\Php73\Rector\String_\SensitiveHereNowDocRector;
|
||||
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php73\Rector\BooleanOr\IsCountableRector::class);
|
||||
$rectorConfig->rule(\Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector::class);
|
||||
$rectorConfig->rule(\Rector\Php73\Rector\FuncCall\SensitiveDefineRector::class);
|
||||
$rectorConfig->rule(\Rector\Php73\Rector\ConstFetch\SensitiveConstantNameRector::class);
|
||||
$rectorConfig->rule(\Rector\Php73\Rector\String_\SensitiveHereNowDocRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\FuncCall\RenameFunctionRector::class, [
|
||||
# https://wiki.php.net/rfc/deprecations_php_7_3
|
||||
'image2wbmp' => 'imagewbmp',
|
||||
'mbregex_encoding' => 'mb_regex_encoding',
|
||||
|
@ -38,9 +38,9 @@ return static function (RectorConfig $rectorConfig) : void {
|
|||
'mbereg_search_getregs' => 'mb_ereg_search_getregs',
|
||||
'mbereg_search_getpos' => 'mb_ereg_search_getpos',
|
||||
]);
|
||||
$rectorConfig->rule(StringifyStrNeedlesRector::class);
|
||||
$rectorConfig->rule(JsonThrowOnErrorRector::class);
|
||||
$rectorConfig->rule(RegexDashEscapeRector::class);
|
||||
$rectorConfig->rule(ContinueToBreakInSwitchRector::class);
|
||||
$rectorConfig->rule(SetCookieRector::class);
|
||||
$rectorConfig->rule(\Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector::class);
|
||||
$rectorConfig->rule(\Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector::class);
|
||||
$rectorConfig->rule(\Rector\Php73\Rector\FuncCall\RegexDashEscapeRector::class);
|
||||
$rectorConfig->rule(\Rector\Php52\Rector\Switch_\ContinueToBreakInSwitchRector::class);
|
||||
$rectorConfig->rule(\Rector\Php73\Rector\FuncCall\SetCookieRector::class);
|
||||
};
|
||||
|
|
|
@ -3,25 +3,25 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\ArrayDimFetch\CurlyToSquareBracketArrayStringRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\Assign\NullCoalescingOperatorRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\Double\RealToFloatTypeCastRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\FuncCall\FilterVarToAddSlashesRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\FuncCall\MbStrrposEncodingArgumentPositionRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\Function_\ReservedFnFunctionRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\MethodCall\ChangeReflectionTypeToStringToGetNameRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\Property\TypedPropertyRector;
|
||||
use RectorPrefix20220606\Rector\Php74\Rector\StaticCall\ExportToReflectionFunctionRector;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(TypedPropertyRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php74\Rector\ArrayDimFetch\CurlyToSquareBracketArrayStringRector;
|
||||
use Rector\Php74\Rector\Assign\NullCoalescingOperatorRector;
|
||||
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
|
||||
use Rector\Php74\Rector\Double\RealToFloatTypeCastRector;
|
||||
use Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector;
|
||||
use Rector\Php74\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector;
|
||||
use Rector\Php74\Rector\FuncCall\FilterVarToAddSlashesRector;
|
||||
use Rector\Php74\Rector\FuncCall\MbStrrposEncodingArgumentPositionRector;
|
||||
use Rector\Php74\Rector\Function_\ReservedFnFunctionRector;
|
||||
use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector;
|
||||
use Rector\Php74\Rector\MethodCall\ChangeReflectionTypeToStringToGetNameRector;
|
||||
use Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector;
|
||||
use Rector\Php74\Rector\Property\TypedPropertyRector;
|
||||
use Rector\Php74\Rector\StaticCall\ExportToReflectionFunctionRector;
|
||||
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\Property\TypedPropertyRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\FuncCall\RenameFunctionRector::class, [
|
||||
#the_real_type
|
||||
# https://wiki.php.net/rfc/deprecations_php_7_4
|
||||
'is_real' => 'is_float',
|
||||
|
@ -29,17 +29,17 @@ return static function (RectorConfig $rectorConfig) : void {
|
|||
# https://wiki.php.net/rfc/deprecations_php_7_4
|
||||
'apache_request_headers' => 'getallheaders',
|
||||
]);
|
||||
$rectorConfig->rule(ArrayKeyExistsOnPropertyRector::class);
|
||||
$rectorConfig->rule(FilterVarToAddSlashesRector::class);
|
||||
$rectorConfig->rule(ExportToReflectionFunctionRector::class);
|
||||
$rectorConfig->rule(MbStrrposEncodingArgumentPositionRector::class);
|
||||
$rectorConfig->rule(RealToFloatTypeCastRector::class);
|
||||
$rectorConfig->rule(NullCoalescingOperatorRector::class);
|
||||
$rectorConfig->rule(ClosureToArrowFunctionRector::class);
|
||||
$rectorConfig->rule(ArraySpreadInsteadOfArrayMergeRector::class);
|
||||
$rectorConfig->rule(AddLiteralSeparatorToNumberRector::class);
|
||||
$rectorConfig->rule(ChangeReflectionTypeToStringToGetNameRector::class);
|
||||
$rectorConfig->rule(RestoreDefaultNullToNullableTypePropertyRector::class);
|
||||
$rectorConfig->rule(CurlyToSquareBracketArrayStringRector::class);
|
||||
$rectorConfig->rule(ReservedFnFunctionRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\FuncCall\FilterVarToAddSlashesRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\StaticCall\ExportToReflectionFunctionRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\FuncCall\MbStrrposEncodingArgumentPositionRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\Double\RealToFloatTypeCastRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\Assign\NullCoalescingOperatorRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\MethodCall\ChangeReflectionTypeToStringToGetNameRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\ArrayDimFetch\CurlyToSquareBracketArrayStringRector::class);
|
||||
$rectorConfig->rule(\Rector\Php74\Rector\Function_\ReservedFnFunctionRector::class);
|
||||
};
|
||||
|
|
|
@ -3,53 +3,53 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
|
||||
use RectorPrefix20220606\Rector\Arguments\Rector\FuncCall\FunctionArgumentDefaultValueReplacerRector;
|
||||
use RectorPrefix20220606\Rector\Arguments\ValueObject\ArgumentAdder;
|
||||
use RectorPrefix20220606\Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue;
|
||||
use RectorPrefix20220606\Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector;
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\Class_\StringableForToStringRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\ClassMethod\SetStateToStaticRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\FunctionLike\UnionTypesRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\Identical\StrEndsWithRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\Identical\StrStartsWithRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\NotIdentical\StrContainsRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
|
||||
use RectorPrefix20220606\Rector\Php80\Rector\Ternary\GetDebugTypeRector;
|
||||
use RectorPrefix20220606\Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
use RectorPrefix20220606\Rector\Transform\Rector\StaticCall\StaticCallToFuncCallRector;
|
||||
use RectorPrefix20220606\Rector\Transform\ValueObject\StaticCallToFuncCall;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(UnionTypesRector::class);
|
||||
$rectorConfig->rule(StrContainsRector::class);
|
||||
$rectorConfig->rule(StrStartsWithRector::class);
|
||||
$rectorConfig->rule(StrEndsWithRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(StaticCallToFuncCallRector::class, [new StaticCallToFuncCall('Nette\\Utils\\Strings', 'startsWith', 'str_starts_with'), new StaticCallToFuncCall('Nette\\Utils\\Strings', 'endsWith', 'str_ends_with'), new StaticCallToFuncCall('Nette\\Utils\\Strings', 'contains', 'str_contains')]);
|
||||
$rectorConfig->rule(StringableForToStringRector::class);
|
||||
$rectorConfig->rule(ClassOnObjectRector::class);
|
||||
$rectorConfig->rule(GetDebugTypeRector::class);
|
||||
$rectorConfig->rule(TokenGetAllToObjectRector::class);
|
||||
$rectorConfig->rule(RemoveUnusedVariableInCatchRector::class);
|
||||
$rectorConfig->rule(ClassPropertyAssignToConstructorPromotionRector::class);
|
||||
$rectorConfig->rule(ChangeSwitchToMatchRector::class);
|
||||
use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
|
||||
use Rector\Arguments\Rector\FuncCall\FunctionArgumentDefaultValueReplacerRector;
|
||||
use Rector\Arguments\ValueObject\ArgumentAdder;
|
||||
use Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue;
|
||||
use Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
|
||||
use Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector;
|
||||
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
|
||||
use Rector\Php80\Rector\Class_\StringableForToStringRector;
|
||||
use Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector;
|
||||
use Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector;
|
||||
use Rector\Php80\Rector\ClassMethod\SetStateToStaticRector;
|
||||
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
|
||||
use Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector;
|
||||
use Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector;
|
||||
use Rector\Php80\Rector\FunctionLike\UnionTypesRector;
|
||||
use Rector\Php80\Rector\Identical\StrEndsWithRector;
|
||||
use Rector\Php80\Rector\Identical\StrStartsWithRector;
|
||||
use Rector\Php80\Rector\NotIdentical\StrContainsRector;
|
||||
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
|
||||
use Rector\Php80\Rector\Ternary\GetDebugTypeRector;
|
||||
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
use Rector\Transform\Rector\StaticCall\StaticCallToFuncCallRector;
|
||||
use Rector\Transform\ValueObject\StaticCallToFuncCall;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\FunctionLike\UnionTypesRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\NotIdentical\StrContainsRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\Identical\StrStartsWithRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\Identical\StrEndsWithRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Transform\Rector\StaticCall\StaticCallToFuncCallRector::class, [new \Rector\Transform\ValueObject\StaticCallToFuncCall('Nette\\Utils\\Strings', 'startsWith', 'str_starts_with'), new \Rector\Transform\ValueObject\StaticCallToFuncCall('Nette\\Utils\\Strings', 'endsWith', 'str_ends_with'), new \Rector\Transform\ValueObject\StaticCallToFuncCall('Nette\\Utils\\Strings', 'contains', 'str_contains')]);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\Class_\StringableForToStringRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\Ternary\GetDebugTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector::class);
|
||||
// nette\utils and Strings::replace()
|
||||
$rectorConfig->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdder('Nette\\Utils\\Strings', 'replace', 2, 'replacement', '')]);
|
||||
$rectorConfig->rule(RemoveParentCallWithoutParentRector::class);
|
||||
$rectorConfig->rule(SetStateToStaticRector::class);
|
||||
$rectorConfig->rule(FinalPrivateToPrivateVisibilityRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector::class, [new \Rector\Arguments\ValueObject\ArgumentAdder('Nette\\Utils\\Strings', 'replace', 2, 'replacement', '')]);
|
||||
$rectorConfig->rule(\Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\ClassMethod\SetStateToStaticRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector::class);
|
||||
// @see https://php.watch/versions/8.0/pgsql-aliases-deprecated
|
||||
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, ['pg_clientencoding' => 'pg_client_encoding', 'pg_cmdtuples' => 'pg_affected_rows', 'pg_errormessage' => 'pg_last_error', 'pg_fieldisnull' => 'pg_field_is_null', 'pg_fieldname' => 'pg_field_name', 'pg_fieldnum' => 'pg_field_num', 'pg_fieldprtlen' => 'pg_field_prtlen', 'pg_fieldsize' => 'pg_field_size', 'pg_fieldtype' => 'pg_field_type', 'pg_freeresult' => 'pg_free_result', 'pg_getlastoid' => 'pg_last_oid', 'pg_loclose' => 'pg_lo_close', 'pg_locreate' => 'pg_lo_create', 'pg_loexport' => 'pg_lo_export', 'pg_loimport' => 'pg_lo_import', 'pg_loopen' => 'pg_lo_open', 'pg_loread' => 'pg_lo_read', 'pg_loreadall' => 'pg_lo_read_all', 'pg_lounlink' => 'pg_lo_unlink', 'pg_lowrite' => 'pg_lo_write', 'pg_numfields' => 'pg_num_fields', 'pg_numrows' => 'pg_num_rows', 'pg_result' => 'pg_fetch_result', 'pg_setclientencoding' => 'pg_set_client_encoding']);
|
||||
$rectorConfig->rule(OptionalParametersAfterRequiredRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(FunctionArgumentDefaultValueReplacerRector::class, [new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'gte', 'ge'), new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'), new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, '', '!='), new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, '!', '!='), new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'g', 'gt'), new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'l', 'lt'), new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'gte', 'ge'), new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'), new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'n', 'ne')]);
|
||||
$rectorConfig->rule(Php8ResourceReturnToObjectRector::class);
|
||||
$rectorConfig->rule(AddParamBasedOnParentClassMethodRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Renaming\Rector\FuncCall\RenameFunctionRector::class, ['pg_clientencoding' => 'pg_client_encoding', 'pg_cmdtuples' => 'pg_affected_rows', 'pg_errormessage' => 'pg_last_error', 'pg_fieldisnull' => 'pg_field_is_null', 'pg_fieldname' => 'pg_field_name', 'pg_fieldnum' => 'pg_field_num', 'pg_fieldprtlen' => 'pg_field_prtlen', 'pg_fieldsize' => 'pg_field_size', 'pg_fieldtype' => 'pg_field_type', 'pg_freeresult' => 'pg_free_result', 'pg_getlastoid' => 'pg_last_oid', 'pg_loclose' => 'pg_lo_close', 'pg_locreate' => 'pg_lo_create', 'pg_loexport' => 'pg_lo_export', 'pg_loimport' => 'pg_lo_import', 'pg_loopen' => 'pg_lo_open', 'pg_loread' => 'pg_lo_read', 'pg_loreadall' => 'pg_lo_read_all', 'pg_lounlink' => 'pg_lo_unlink', 'pg_lowrite' => 'pg_lo_write', 'pg_numfields' => 'pg_num_fields', 'pg_numrows' => 'pg_num_rows', 'pg_result' => 'pg_fetch_result', 'pg_setclientencoding' => 'pg_set_client_encoding']);
|
||||
$rectorConfig->rule(\Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Arguments\Rector\FuncCall\FunctionArgumentDefaultValueReplacerRector::class, [new \Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'gte', 'ge'), new \Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'), new \Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue('version_compare', 2, '', '!='), new \Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue('version_compare', 2, '!', '!='), new \Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'g', 'gt'), new \Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'l', 'lt'), new \Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'gte', 'ge'), new \Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'), new \Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'n', 'ne')]);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector::class);
|
||||
$rectorConfig->rule(\Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector::class);
|
||||
};
|
||||
|
|
|
@ -3,26 +3,26 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php81\Rector\Class_\MyCLabsClassToEnumRector;
|
||||
use RectorPrefix20220606\Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector;
|
||||
use RectorPrefix20220606\Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
|
||||
use RectorPrefix20220606\Rector\Php81\Rector\ClassMethod\NewInInitializerRector;
|
||||
use RectorPrefix20220606\Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
|
||||
use RectorPrefix20220606\Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector;
|
||||
use RectorPrefix20220606\Rector\Php81\Rector\FunctionLike\IntersectionTypesRector;
|
||||
use RectorPrefix20220606\Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector;
|
||||
use RectorPrefix20220606\Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(ReturnNeverTypeRector::class);
|
||||
$rectorConfig->rule(MyCLabsClassToEnumRector::class);
|
||||
$rectorConfig->rule(MyCLabsMethodCallToEnumConstRector::class);
|
||||
$rectorConfig->rule(FinalizePublicClassConstantRector::class);
|
||||
$rectorConfig->rule(ReadOnlyPropertyRector::class);
|
||||
$rectorConfig->rule(SpatieEnumClassToEnumRector::class);
|
||||
$rectorConfig->rule(Php81ResourceReturnToObjectRector::class);
|
||||
$rectorConfig->rule(NewInInitializerRector::class);
|
||||
$rectorConfig->rule(IntersectionTypesRector::class);
|
||||
$rectorConfig->rule(NullToStrictStringFuncCallArgRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php81\Rector\Class_\MyCLabsClassToEnumRector;
|
||||
use Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector;
|
||||
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
|
||||
use Rector\Php81\Rector\ClassMethod\NewInInitializerRector;
|
||||
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
|
||||
use Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector;
|
||||
use Rector\Php81\Rector\FunctionLike\IntersectionTypesRector;
|
||||
use Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector;
|
||||
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\Php81\Rector\Class_\MyCLabsClassToEnumRector::class);
|
||||
$rectorConfig->rule(\Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector::class);
|
||||
$rectorConfig->rule(\Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector::class);
|
||||
$rectorConfig->rule(\Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector::class);
|
||||
$rectorConfig->rule(\Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector::class);
|
||||
$rectorConfig->rule(\Rector\Php81\Rector\ClassMethod\NewInInitializerRector::class);
|
||||
$rectorConfig->rule(\Rector\Php81\Rector\FunctionLike\IntersectionTypesRector::class);
|
||||
$rectorConfig->rule(\Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector::class);
|
||||
};
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Php82\Rector\Class_\ReadOnlyClassRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(ReadOnlyClassRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Php82\Rector\Class_\ReadOnlyClassRector::class);
|
||||
};
|
||||
|
|
|
@ -3,25 +3,25 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\Privatization\Rector\Class_\ChangeGlobalVariablesToPropertiesRector;
|
||||
use RectorPrefix20220606\Rector\Privatization\Rector\Class_\ChangeLocalPropertyToVariableRector;
|
||||
use RectorPrefix20220606\Rector\Privatization\Rector\Class_\ChangeReadOnlyVariableWithDefaultValueToConstantRector;
|
||||
use RectorPrefix20220606\Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector;
|
||||
use RectorPrefix20220606\Rector\Privatization\Rector\Class_\RepeatedLiteralToClassConstantRector;
|
||||
use RectorPrefix20220606\Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
|
||||
use RectorPrefix20220606\Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector;
|
||||
use RectorPrefix20220606\Rector\Privatization\Rector\Property\ChangeReadOnlyPropertyWithDefaultValueToConstantRector;
|
||||
use RectorPrefix20220606\Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(FinalizeClassesWithoutChildrenRector::class);
|
||||
$rectorConfig->rule(ChangeGlobalVariablesToPropertiesRector::class);
|
||||
$rectorConfig->rule(ChangeReadOnlyPropertyWithDefaultValueToConstantRector::class);
|
||||
$rectorConfig->rule(ChangeReadOnlyVariableWithDefaultValueToConstantRector::class);
|
||||
$rectorConfig->rule(RepeatedLiteralToClassConstantRector::class);
|
||||
$rectorConfig->rule(PrivatizeLocalGetterToPropertyRector::class);
|
||||
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
|
||||
$rectorConfig->rule(PrivatizeFinalClassMethodRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Privatization\Rector\Class_\ChangeGlobalVariablesToPropertiesRector;
|
||||
use Rector\Privatization\Rector\Class_\ChangeLocalPropertyToVariableRector;
|
||||
use Rector\Privatization\Rector\Class_\ChangeReadOnlyVariableWithDefaultValueToConstantRector;
|
||||
use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector;
|
||||
use Rector\Privatization\Rector\Class_\RepeatedLiteralToClassConstantRector;
|
||||
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
|
||||
use Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector;
|
||||
use Rector\Privatization\Rector\Property\ChangeReadOnlyPropertyWithDefaultValueToConstantRector;
|
||||
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector::class);
|
||||
$rectorConfig->rule(\Rector\Privatization\Rector\Class_\ChangeGlobalVariablesToPropertiesRector::class);
|
||||
$rectorConfig->rule(\Rector\Privatization\Rector\Property\ChangeReadOnlyPropertyWithDefaultValueToConstantRector::class);
|
||||
$rectorConfig->rule(\Rector\Privatization\Rector\Class_\ChangeReadOnlyVariableWithDefaultValueToConstantRector::class);
|
||||
$rectorConfig->rule(\Rector\Privatization\Rector\Class_\RepeatedLiteralToClassConstantRector::class);
|
||||
$rectorConfig->rule(\Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector::class);
|
||||
// buggy, requires more work
|
||||
// $services->set(ChangeLocalPropertyToVariableRector::class);
|
||||
};
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector;
|
||||
use RectorPrefix20220606\Rector\PSR4\Rector\Namespace_\MultipleClassFileToPsr4ClassesRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(NormalizeNamespaceByPSR4ComposerAutoloadRector::class);
|
||||
$rectorConfig->rule(MultipleClassFileToPsr4ClassesRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector;
|
||||
use Rector\PSR4\Rector\Namespace_\MultipleClassFileToPsr4ClassesRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector::class);
|
||||
$rectorConfig->rule(\Rector\PSR4\Rector\Namespace_\MultipleClassFileToPsr4ClassesRector::class);
|
||||
};
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\DogFood\Rector\Closure\UpgradeRectorConfigRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(UpgradeRectorConfigRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\DogFood\Rector\Closure\UpgradeRectorConfigRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\DogFood\Rector\Closure\UpgradeRectorConfigRector::class);
|
||||
};
|
||||
|
|
|
@ -3,26 +3,26 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(AddClosureReturnTypeRector::class);
|
||||
$rectorConfig->rule(ReturnTypeFromStrictTypedPropertyRector::class);
|
||||
$rectorConfig->rule(TypedPropertyFromStrictConstructorRector::class);
|
||||
$rectorConfig->rule(ParamTypeFromStrictTypedPropertyRector::class);
|
||||
$rectorConfig->rule(ReturnTypeFromStrictTypedCallRector::class);
|
||||
$rectorConfig->rule(AddVoidReturnTypeWhereNoReturnRector::class);
|
||||
$rectorConfig->rule(ReturnTypeFromReturnNewRector::class);
|
||||
$rectorConfig->rule(TypedPropertyFromStrictGetterMethodReturnTypeRector::class);
|
||||
$rectorConfig->rule(AddMethodCallBasedStrictParamTypeRector::class);
|
||||
$rectorConfig->rule(ArrayShapeFromConstantArrayReturnRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
|
||||
use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector;
|
||||
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
|
||||
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector::class);
|
||||
};
|
||||
|
|
|
@ -3,30 +3,30 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\ParamAnnotationIncorrectNullableRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\ClassMethod\ReturnAnnotationIncorrectNullableRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\Rector\Property\VarAnnotationIncorrectNullableRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(ParamTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(ReturnTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(PropertyTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(AddClosureReturnTypeRector::class);
|
||||
$rectorConfig->rule(AddArrayParamDocTypeRector::class);
|
||||
$rectorConfig->rule(AddArrayReturnDocTypeRector::class);
|
||||
$rectorConfig->rule(ParamTypeByParentCallTypeRector::class);
|
||||
$rectorConfig->rule(ParamTypeByMethodCallTypeRector::class);
|
||||
$rectorConfig->rule(TypedPropertyFromAssignsRector::class);
|
||||
$rectorConfig->rule(ReturnAnnotationIncorrectNullableRector::class);
|
||||
$rectorConfig->rule(VarAnnotationIncorrectNullableRector::class);
|
||||
$rectorConfig->rule(ParamAnnotationIncorrectNullableRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ParamAnnotationIncorrectNullableRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnAnnotationIncorrectNullableRector;
|
||||
use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
|
||||
use Rector\TypeDeclaration\Rector\Property\VarAnnotationIncorrectNullableRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\ReturnAnnotationIncorrectNullableRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\Property\VarAnnotationIncorrectNullableRector::class);
|
||||
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\ParamAnnotationIncorrectNullableRector::class);
|
||||
};
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606;
|
||||
|
||||
use RectorPrefix20220606\Rector\Config\RectorConfig;
|
||||
use RectorPrefix20220606\Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(UnwrapFutureCompatibleIfFunctionExistsRector::class);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
|
||||
return static function (\Rector\Config\RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rule(\Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector::class);
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\Annotation;
|
||||
namespace Rector\BetterPhpDocParser\Annotation;
|
||||
|
||||
final class AnnotationNaming
|
||||
{
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\Attributes;
|
||||
namespace Rector\BetterPhpDocParser\Attributes;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
final class AttributeMirrorer
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const ATTRIBUTES_TO_MIRROR = [PhpDocAttributeKey::PARENT, PhpDocAttributeKey::START_AND_END, PhpDocAttributeKey::ORIG_NODE];
|
||||
public function mirror(Node $oldNode, Node $newNode) : void
|
||||
private const ATTRIBUTES_TO_MIRROR = [\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::PARENT, \Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END, \Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::ORIG_NODE];
|
||||
public function mirror(\PHPStan\PhpDocParser\Ast\Node $oldNode, \PHPStan\PhpDocParser\Ast\Node $newNode) : void
|
||||
{
|
||||
foreach (self::ATTRIBUTES_TO_MIRROR as $attributeToMirror) {
|
||||
if (!$oldNode->hasAttribute($attributeToMirror)) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\Comment;
|
||||
namespace Rector\BetterPhpDocParser\Comment;
|
||||
|
||||
use RectorPrefix20220606\PhpParser\Comment;
|
||||
use RectorPrefix20220606\PhpParser\Node;
|
||||
use RectorPrefix20220606\Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use PhpParser\Comment;
|
||||
use PhpParser\Node;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use RectorPrefix20220606\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser;
|
||||
final class CommentsMerger
|
||||
{
|
||||
|
@ -14,14 +14,14 @@ final class CommentsMerger
|
|||
* @var \Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser
|
||||
*/
|
||||
private $simpleCallableNodeTraverser;
|
||||
public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser)
|
||||
public function __construct(\RectorPrefix20220606\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser $simpleCallableNodeTraverser)
|
||||
{
|
||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||
}
|
||||
/**
|
||||
* @param Node[] $mergedNodes
|
||||
*/
|
||||
public function keepComments(Node $newNode, array $mergedNodes) : void
|
||||
public function keepComments(\PhpParser\Node $newNode, array $mergedNodes) : void
|
||||
{
|
||||
$comments = $newNode->getComments();
|
||||
foreach ($mergedNodes as $mergedNode) {
|
||||
|
@ -30,25 +30,25 @@ final class CommentsMerger
|
|||
if ($comments === []) {
|
||||
return;
|
||||
}
|
||||
$newNode->setAttribute(AttributeKey::COMMENTS, $comments);
|
||||
$newNode->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::COMMENTS, $comments);
|
||||
// remove so comments "win"
|
||||
$newNode->setAttribute(AttributeKey::PHP_DOC_INFO, null);
|
||||
$newNode->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO, null);
|
||||
}
|
||||
public function keepParent(Node $newNode, Node $oldNode) : void
|
||||
public function keepParent(\PhpParser\Node $newNode, \PhpParser\Node $oldNode) : void
|
||||
{
|
||||
$parent = $oldNode->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$parent instanceof Node) {
|
||||
$parent = $oldNode->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
if (!$parent instanceof \PhpParser\Node) {
|
||||
return;
|
||||
}
|
||||
$phpDocInfo = $parent->getAttribute(AttributeKey::PHP_DOC_INFO);
|
||||
$phpDocInfo = $parent->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO);
|
||||
$comments = $parent->getComments();
|
||||
if ($phpDocInfo === null && $comments === []) {
|
||||
return;
|
||||
}
|
||||
$newNode->setAttribute(AttributeKey::PHP_DOC_INFO, $phpDocInfo);
|
||||
$newNode->setAttribute(AttributeKey::COMMENTS, $comments);
|
||||
$newNode->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO, $phpDocInfo);
|
||||
$newNode->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::COMMENTS, $comments);
|
||||
}
|
||||
public function keepChildren(Node $newNode, Node $oldNode) : void
|
||||
public function keepChildren(\PhpParser\Node $newNode, \PhpParser\Node $oldNode) : void
|
||||
{
|
||||
$childrenComments = $this->collectChildrenComments($oldNode);
|
||||
if ($childrenComments === []) {
|
||||
|
@ -58,15 +58,15 @@ final class CommentsMerger
|
|||
foreach ($childrenComments as $childComment) {
|
||||
$commentContent .= $childComment->getText() . \PHP_EOL;
|
||||
}
|
||||
$newNode->setAttribute(AttributeKey::COMMENTS, [new Comment($commentContent)]);
|
||||
$newNode->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::COMMENTS, [new \PhpParser\Comment($commentContent)]);
|
||||
}
|
||||
/**
|
||||
* @return Comment[]
|
||||
*/
|
||||
private function collectChildrenComments(Node $node) : array
|
||||
private function collectChildrenComments(\PhpParser\Node $node) : array
|
||||
{
|
||||
$childrenComments = [];
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($node, function (Node $node) use(&$childrenComments) {
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($node, function (\PhpParser\Node $node) use(&$childrenComments) {
|
||||
$comments = $node->getComments();
|
||||
if ($comments !== []) {
|
||||
$childrenComments = \array_merge($childrenComments, $comments);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\Contract;
|
||||
namespace Rector\BetterPhpDocParser\Contract;
|
||||
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\Contract\PhpDocNodeVisitorInterface;
|
||||
interface BasePhpDocNodeVisitorInterface extends PhpDocNodeVisitorInterface
|
||||
interface BasePhpDocNodeVisitorInterface extends \RectorPrefix20220606\Symplify\Astral\PhpDocParser\Contract\PhpDocNodeVisitorInterface
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\Contract\PhpDocParser;
|
||||
namespace Rector\BetterPhpDocParser\Contract\PhpDocParser;
|
||||
|
||||
use RectorPrefix20220606\PhpParser\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use PhpParser\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
interface PhpDocNodeDecoratorInterface
|
||||
{
|
||||
public function decorate(PhpDocNode $phpDocNode, Node $phpNode) : void;
|
||||
public function decorate(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode, \PhpParser\Node $phpNode) : void;
|
||||
}
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\DataProvider;
|
||||
namespace Rector\BetterPhpDocParser\DataProvider;
|
||||
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use RectorPrefix20220606\Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
final class CurrentTokenIteratorProvider
|
||||
{
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator|null
|
||||
*/
|
||||
private $betterTokenIterator;
|
||||
public function setBetterTokenIterator(BetterTokenIterator $betterTokenIterator) : void
|
||||
public function setBetterTokenIterator(\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $betterTokenIterator) : void
|
||||
{
|
||||
$this->betterTokenIterator = $betterTokenIterator;
|
||||
}
|
||||
public function provide() : BetterTokenIterator
|
||||
public function provide() : \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator
|
||||
{
|
||||
if ($this->betterTokenIterator === null) {
|
||||
throw new ShouldNotHappenException();
|
||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||
}
|
||||
return $this->betterTokenIterator;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDoc;
|
||||
namespace Rector\BetterPhpDocParser\PhpDoc;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\AbstractValuesAwareNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\AbstractValuesAwareNode;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use Stringable;
|
||||
final class DoctrineAnnotationTagValueNode extends AbstractValuesAwareNode
|
||||
final class DoctrineAnnotationTagValueNode extends \Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\AbstractValuesAwareNode
|
||||
{
|
||||
/**
|
||||
* @var \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode
|
||||
|
@ -16,7 +16,7 @@ final class DoctrineAnnotationTagValueNode extends AbstractValuesAwareNode
|
|||
/**
|
||||
* @param array<mixed, mixed> $values
|
||||
*/
|
||||
public function __construct(IdentifierTypeNode $identifierTypeNode, ?string $originalContent = null, array $values = [], ?string $silentKey = null)
|
||||
public function __construct(\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $identifierTypeNode, ?string $originalContent = null, array $values = [], ?string $silentKey = null)
|
||||
{
|
||||
$this->identifierTypeNode = $identifierTypeNode;
|
||||
$this->hasChanged = \true;
|
||||
|
@ -59,7 +59,7 @@ final class DoctrineAnnotationTagValueNode extends AbstractValuesAwareNode
|
|||
return \true;
|
||||
}
|
||||
// the name is not fully qualified in the original name, look for resolved class attribute
|
||||
$resolvedClass = $this->identifierTypeNode->getAttribute(PhpDocAttributeKey::RESOLVED_CLASS);
|
||||
$resolvedClass = $this->identifierTypeNode->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::RESOLVED_CLASS);
|
||||
return $resolvedClass === $className;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDoc;
|
||||
namespace Rector\BetterPhpDocParser\PhpDoc;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use Stringable;
|
||||
/**
|
||||
* Useful for annotation class based annotation, e.g. @ORM\Entity to prevent space
|
||||
* between the @ORM\Entity and (someContent)
|
||||
*/
|
||||
final class SpacelessPhpDocTagNode extends PhpDocTagNode
|
||||
final class SpacelessPhpDocTagNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode
|
||||
{
|
||||
public function __toString() : string
|
||||
{
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocInfo;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use RectorPrefix20220606\PHPStan\Type\MixedType;
|
||||
use RectorPrefix20220606\PHPStan\Type\Type;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Annotation\AnnotationNaming;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeVisitor\ChangedPhpDocNodeVisitor;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Type\ShortenedIdentifierTypeNode;
|
||||
use RectorPrefix20220606\Rector\ChangesReporting\Collector\RectorChangeCollector;
|
||||
use RectorPrefix20220606\Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use RectorPrefix20220606\Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\BetterPhpDocParser\Annotation\AnnotationNaming;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder;
|
||||
use Rector\BetterPhpDocParser\PhpDocNodeVisitor\ChangedPhpDocNodeVisitor;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\ShortenedIdentifierTypeNode;
|
||||
use Rector\ChangesReporting\Collector\RectorChangeCollector;
|
||||
use Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser;
|
||||
/**
|
||||
* @template TNode as \PHPStan\PhpDocParser\Ast\Node
|
||||
|
@ -39,7 +39,7 @@ final class PhpDocInfo
|
|||
/**
|
||||
* @var array<class-string<PhpDocTagValueNode>, string>
|
||||
*/
|
||||
private const TAGS_TYPES_TO_NAMES = [ReturnTagValueNode::class => '@return', ParamTagValueNode::class => '@param', VarTagValueNode::class => '@var', MethodTagValueNode::class => '@method', PropertyTagValueNode::class => '@property'];
|
||||
private const TAGS_TYPES_TO_NAMES = [\PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode::class => '@return', \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode::class => '@param', \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode::class => '@var', \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode::class => '@method', \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode::class => '@property'];
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -93,7 +93,7 @@ final class PhpDocInfo
|
|||
* @var \Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder
|
||||
*/
|
||||
private $phpDocNodeByTypeFinder;
|
||||
public function __construct(PhpDocNode $phpDocNode, BetterTokenIterator $betterTokenIterator, StaticTypeMapper $staticTypeMapper, \RectorPrefix20220606\PhpParser\Node $node, AnnotationNaming $annotationNaming, CurrentNodeProvider $currentNodeProvider, RectorChangeCollector $rectorChangeCollector, PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder)
|
||||
public function __construct(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode, \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $betterTokenIterator, \Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper, \PhpParser\Node $node, \Rector\BetterPhpDocParser\Annotation\AnnotationNaming $annotationNaming, \Rector\Core\Configuration\CurrentNodeProvider $currentNodeProvider, \Rector\ChangesReporting\Collector\RectorChangeCollector $rectorChangeCollector, \Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder)
|
||||
{
|
||||
$this->phpDocNode = $phpDocNode;
|
||||
$this->betterTokenIterator = $betterTokenIterator;
|
||||
|
@ -104,22 +104,22 @@ final class PhpDocInfo
|
|||
$this->rectorChangeCollector = $rectorChangeCollector;
|
||||
$this->phpDocNodeByTypeFinder = $phpDocNodeByTypeFinder;
|
||||
$this->originalPhpDocNode = clone $phpDocNode;
|
||||
if (!$betterTokenIterator->containsTokenType(Lexer::TOKEN_PHPDOC_EOL)) {
|
||||
if (!$betterTokenIterator->containsTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_PHPDOC_EOL)) {
|
||||
$this->isSingleLine = \true;
|
||||
}
|
||||
}
|
||||
public function addPhpDocTagNode(PhpDocChildNode $phpDocChildNode) : void
|
||||
public function addPhpDocTagNode(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode $phpDocChildNode) : void
|
||||
{
|
||||
$this->phpDocNode->children[] = $phpDocChildNode;
|
||||
// to give node more space
|
||||
$this->makeMultiLined();
|
||||
$this->markAsChanged();
|
||||
}
|
||||
public function getPhpDocNode() : PhpDocNode
|
||||
public function getPhpDocNode() : \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode
|
||||
{
|
||||
return $this->phpDocNode;
|
||||
}
|
||||
public function getOriginalPhpDocNode() : PhpDocNode
|
||||
public function getOriginalPhpDocNode() : \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode
|
||||
{
|
||||
return $this->originalPhpDocNode;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ final class PhpDocInfo
|
|||
{
|
||||
return $this->betterTokenIterator->count();
|
||||
}
|
||||
public function getVarTagValueNode(string $tagName = '@var') : ?VarTagValueNode
|
||||
public function getVarTagValueNode(string $tagName = '@var') : ?\PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode
|
||||
{
|
||||
return $this->phpDocNode->getVarTagValues($tagName)[0] ?? null;
|
||||
}
|
||||
|
@ -149,13 +149,13 @@ final class PhpDocInfo
|
|||
}
|
||||
$tags = $this->phpDocNode->getTags();
|
||||
$name = $this->annotationNaming->normalizeName($name);
|
||||
$tags = \array_filter($tags, function (PhpDocTagNode $tag) use($name) : bool {
|
||||
$tags = \array_filter($tags, function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode $tag) use($name) : bool {
|
||||
return $tag->name === $name;
|
||||
});
|
||||
$tags = \array_values($tags);
|
||||
return \array_values($tags);
|
||||
}
|
||||
public function getParamType(string $name) : Type
|
||||
public function getParamType(string $name) : \PHPStan\Type\Type
|
||||
{
|
||||
$paramTagValueNodes = $this->getParamTagValueByName($name);
|
||||
return $this->getTypeOrMixed($paramTagValueNodes);
|
||||
|
@ -167,7 +167,7 @@ final class PhpDocInfo
|
|||
{
|
||||
return $this->phpDocNode->getParamTagValues();
|
||||
}
|
||||
public function getParamTagValueNodeByName(string $parameterName) : ?ParamTagValueNode
|
||||
public function getParamTagValueNodeByName(string $parameterName) : ?\PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode
|
||||
{
|
||||
foreach ($this->phpDocNode->getParamTagValues() as $paramTagValueNode) {
|
||||
if ($paramTagValueNode->parameterName !== '$' . $parameterName) {
|
||||
|
@ -177,11 +177,11 @@ final class PhpDocInfo
|
|||
}
|
||||
return null;
|
||||
}
|
||||
public function getVarType(string $tagName = '@var') : Type
|
||||
public function getVarType(string $tagName = '@var') : \PHPStan\Type\Type
|
||||
{
|
||||
return $this->getTypeOrMixed($this->getVarTagValueNode($tagName));
|
||||
}
|
||||
public function getReturnType() : Type
|
||||
public function getReturnType() : \PHPStan\Type\Type
|
||||
{
|
||||
return $this->getTypeOrMixed($this->getReturnTagValue());
|
||||
}
|
||||
|
@ -228,14 +228,14 @@ final class PhpDocInfo
|
|||
{
|
||||
return (bool) $this->getTagsByName($name);
|
||||
}
|
||||
public function getByName(string $name) : ?Node
|
||||
public function getByName(string $name) : ?\PHPStan\PhpDocParser\Ast\Node
|
||||
{
|
||||
return $this->getTagsByName($name)[0] ?? null;
|
||||
}
|
||||
/**
|
||||
* @param class-string[] $classes
|
||||
*/
|
||||
public function getByAnnotationClasses(array $classes) : ?DoctrineAnnotationTagValueNode
|
||||
public function getByAnnotationClasses(array $classes) : ?\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode
|
||||
{
|
||||
$doctrineAnnotationTagValueNodes = $this->phpDocNodeByTypeFinder->findDoctrineAnnotationsByClasses($this->phpDocNode, $classes);
|
||||
return $doctrineAnnotationTagValueNodes[0] ?? null;
|
||||
|
@ -243,7 +243,7 @@ final class PhpDocInfo
|
|||
/**
|
||||
* @param class-string $class
|
||||
*/
|
||||
public function getByAnnotationClass(string $class) : ?DoctrineAnnotationTagValueNode
|
||||
public function getByAnnotationClass(string $class) : ?\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode
|
||||
{
|
||||
$doctrineAnnotationTagValueNodes = $this->phpDocNodeByTypeFinder->findDoctrineAnnotationsByClass($this->phpDocNode, $class);
|
||||
return $doctrineAnnotationTagValueNodes[0] ?? null;
|
||||
|
@ -265,11 +265,11 @@ final class PhpDocInfo
|
|||
/**
|
||||
* @param string[] $desiredClasses
|
||||
*/
|
||||
public function findOneByAnnotationClasses(array $desiredClasses) : ?DoctrineAnnotationTagValueNode
|
||||
public function findOneByAnnotationClasses(array $desiredClasses) : ?\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode
|
||||
{
|
||||
foreach ($desiredClasses as $desiredClass) {
|
||||
$doctrineAnnotationTagValueNode = $this->findOneByAnnotationClass($desiredClass);
|
||||
if (!$doctrineAnnotationTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
if (!$doctrineAnnotationTagValueNode instanceof \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode) {
|
||||
continue;
|
||||
}
|
||||
return $doctrineAnnotationTagValueNode;
|
||||
|
@ -279,7 +279,7 @@ final class PhpDocInfo
|
|||
/**
|
||||
* @param class-string $desiredClass
|
||||
*/
|
||||
public function findOneByAnnotationClass(string $desiredClass) : ?DoctrineAnnotationTagValueNode
|
||||
public function findOneByAnnotationClass(string $desiredClass) : ?\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode
|
||||
{
|
||||
$foundTagValueNodes = $this->findByAnnotationClass($desiredClass);
|
||||
return $foundTagValueNodes[0] ?? null;
|
||||
|
@ -298,9 +298,9 @@ final class PhpDocInfo
|
|||
*/
|
||||
public function removeByType(string $typeToRemove) : void
|
||||
{
|
||||
$phpDocNodeTraverser = new PhpDocNodeTraverser();
|
||||
$phpDocNodeTraverser->traverseWithCallable($this->phpDocNode, '', function (Node $node) use($typeToRemove) : ?int {
|
||||
if ($node instanceof PhpDocTagNode && \is_a($node->value, $typeToRemove, \true)) {
|
||||
$phpDocNodeTraverser = new \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser();
|
||||
$phpDocNodeTraverser->traverseWithCallable($this->phpDocNode, '', function (\PHPStan\PhpDocParser\Ast\Node $node) use($typeToRemove) : ?int {
|
||||
if ($node instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode && \is_a($node->value, $typeToRemove, \true)) {
|
||||
// keep special annotation for tools
|
||||
if (\strncmp($node->name, '@psalm-', \strlen('@psalm-')) === 0) {
|
||||
return null;
|
||||
|
@ -309,13 +309,13 @@ final class PhpDocInfo
|
|||
return null;
|
||||
}
|
||||
$this->markAsChanged();
|
||||
return PhpDocNodeTraverser::NODE_REMOVE;
|
||||
return \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser::NODE_REMOVE;
|
||||
}
|
||||
if (!\is_a($node, $typeToRemove, \true)) {
|
||||
return null;
|
||||
}
|
||||
$this->markAsChanged();
|
||||
return PhpDocNodeTraverser::NODE_REMOVE;
|
||||
return \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser::NODE_REMOVE;
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
@ -330,15 +330,15 @@ final class PhpDocInfo
|
|||
}
|
||||
return $paramTypesByName;
|
||||
}
|
||||
public function addTagValueNode(PhpDocTagValueNode $phpDocTagValueNode) : void
|
||||
public function addTagValueNode(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $phpDocTagValueNode) : void
|
||||
{
|
||||
if ($phpDocTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
if ($phpDocTagValueNode->identifierTypeNode instanceof ShortenedIdentifierTypeNode) {
|
||||
if ($phpDocTagValueNode instanceof \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode) {
|
||||
if ($phpDocTagValueNode->identifierTypeNode instanceof \Rector\BetterPhpDocParser\ValueObject\Type\ShortenedIdentifierTypeNode) {
|
||||
$name = '@' . $phpDocTagValueNode->identifierTypeNode;
|
||||
} else {
|
||||
$name = '@\\' . $phpDocTagValueNode->identifierTypeNode;
|
||||
}
|
||||
$spacelessPhpDocTagNode = new SpacelessPhpDocTagNode($name, $phpDocTagValueNode);
|
||||
$spacelessPhpDocTagNode = new \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode($name, $phpDocTagValueNode);
|
||||
$this->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
return;
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ final class PhpDocInfo
|
|||
if (!\is_string($name)) {
|
||||
return;
|
||||
}
|
||||
$phpDocTagNode = new PhpDocTagNode($name, $phpDocTagValueNode);
|
||||
$phpDocTagNode = new \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode($name, $phpDocTagValueNode);
|
||||
$this->addPhpDocTagNode($phpDocTagNode);
|
||||
}
|
||||
public function isNewNode() : bool
|
||||
|
@ -368,25 +368,25 @@ final class PhpDocInfo
|
|||
{
|
||||
// fallback for invalid tag value node
|
||||
foreach ($this->phpDocNode->children as $phpDocChildNode) {
|
||||
if (!$phpDocChildNode instanceof PhpDocTagNode) {
|
||||
if (!$phpDocChildNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode) {
|
||||
continue;
|
||||
}
|
||||
if ($phpDocChildNode->name !== $name) {
|
||||
continue;
|
||||
}
|
||||
if (!$phpDocChildNode->value instanceof InvalidTagValueNode) {
|
||||
if (!$phpDocChildNode->value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode) {
|
||||
continue;
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
public function getReturnTagValue() : ?ReturnTagValueNode
|
||||
public function getReturnTagValue() : ?\PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode
|
||||
{
|
||||
$returnTagValueNodes = $this->phpDocNode->getReturnTagValues();
|
||||
return $returnTagValueNodes[0] ?? null;
|
||||
}
|
||||
public function getParamTagValueByName(string $name) : ?ParamTagValueNode
|
||||
public function getParamTagValueByName(string $name) : ?\PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode
|
||||
{
|
||||
$desiredParamNameWithDollar = '$' . \ltrim($name, '$');
|
||||
foreach ($this->getParamTagValueNodes() as $paramTagValueNode) {
|
||||
|
@ -410,7 +410,7 @@ final class PhpDocInfo
|
|||
return \true;
|
||||
}
|
||||
foreach ($this->phpDocNode->children as $children) {
|
||||
if (!$children instanceof PhpDocTextNode) {
|
||||
if (!$children instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode) {
|
||||
continue;
|
||||
}
|
||||
if (\in_array($children->text, ['{@inheritdoc}', '{@inheritDoc}'], \true)) {
|
||||
|
@ -441,8 +441,8 @@ final class PhpDocInfo
|
|||
return \true;
|
||||
}
|
||||
// has a single node with missing start_end
|
||||
$phpDocNodeTraverser = new PhpDocNodeTraverser();
|
||||
$changedPhpDocNodeVisitor = new ChangedPhpDocNodeVisitor();
|
||||
$phpDocNodeTraverser = new \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser();
|
||||
$changedPhpDocNodeVisitor = new \Rector\BetterPhpDocParser\PhpDocNodeVisitor\ChangedPhpDocNodeVisitor();
|
||||
$phpDocNodeTraverser->addPhpDocNodeVisitor($changedPhpDocNodeVisitor);
|
||||
$phpDocNodeTraverser->traverse($this->phpDocNode);
|
||||
return $changedPhpDocNodeVisitor->hasChanged();
|
||||
|
@ -462,11 +462,11 @@ final class PhpDocInfo
|
|||
{
|
||||
$this->isSingleLine = \false;
|
||||
}
|
||||
public function getNode() : \RectorPrefix20220606\PhpParser\Node
|
||||
public function getNode() : \PhpParser\Node
|
||||
{
|
||||
return $this->node;
|
||||
}
|
||||
public function resolveNameForPhpDocTagValueNode(PhpDocTagValueNode $phpDocTagValueNode) : ?string
|
||||
public function resolveNameForPhpDocTagValueNode(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $phpDocTagValueNode) : ?string
|
||||
{
|
||||
foreach (self::TAGS_TYPES_TO_NAMES as $tagValueNodeType => $name) {
|
||||
/** @var class-string<PhpDocTagNode> $tagValueNodeType */
|
||||
|
@ -479,10 +479,10 @@ final class PhpDocInfo
|
|||
/**
|
||||
* @return \PHPStan\Type\MixedType|\PHPStan\Type\Type
|
||||
*/
|
||||
private function getTypeOrMixed(?PhpDocTagValueNode $phpDocTagValueNode)
|
||||
private function getTypeOrMixed(?\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $phpDocTagValueNode)
|
||||
{
|
||||
if ($phpDocTagValueNode === null) {
|
||||
return new MixedType();
|
||||
return new \PHPStan\Type\MixedType();
|
||||
}
|
||||
return $this->staticTypeMapper->mapPHPStanPhpDocTypeToPHPStanType($phpDocTagValueNode, $this->node);
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocInfo;
|
||||
|
||||
use RectorPrefix20220606\PhpParser\Comment\Doc;
|
||||
use RectorPrefix20220606\PhpParser\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Annotation\AnnotationNaming;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeMapper;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocParser\BetterPhpDocParser;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use RectorPrefix20220606\Rector\ChangesReporting\Collector\RectorChangeCollector;
|
||||
use RectorPrefix20220606\Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use RectorPrefix20220606\Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use RectorPrefix20220606\Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use PhpParser\Comment\Doc;
|
||||
use PhpParser\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use Rector\BetterPhpDocParser\Annotation\AnnotationNaming;
|
||||
use Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder;
|
||||
use Rector\BetterPhpDocParser\PhpDocNodeMapper;
|
||||
use Rector\BetterPhpDocParser\PhpDocParser\BetterPhpDocParser;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use Rector\ChangesReporting\Collector\RectorChangeCollector;
|
||||
use Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
final class PhpDocInfoFactory
|
||||
{
|
||||
/**
|
||||
|
@ -64,7 +64,7 @@ final class PhpDocInfoFactory
|
|||
* @var \Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder
|
||||
*/
|
||||
private $phpDocNodeByTypeFinder;
|
||||
public function __construct(PhpDocNodeMapper $phpDocNodeMapper, CurrentNodeProvider $currentNodeProvider, Lexer $lexer, BetterPhpDocParser $betterPhpDocParser, StaticTypeMapper $staticTypeMapper, AnnotationNaming $annotationNaming, RectorChangeCollector $rectorChangeCollector, PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder)
|
||||
public function __construct(\Rector\BetterPhpDocParser\PhpDocNodeMapper $phpDocNodeMapper, \Rector\Core\Configuration\CurrentNodeProvider $currentNodeProvider, \PHPStan\PhpDocParser\Lexer\Lexer $lexer, \Rector\BetterPhpDocParser\PhpDocParser\BetterPhpDocParser $betterPhpDocParser, \Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper, \Rector\BetterPhpDocParser\Annotation\AnnotationNaming $annotationNaming, \Rector\ChangesReporting\Collector\RectorChangeCollector $rectorChangeCollector, \Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder)
|
||||
{
|
||||
$this->phpDocNodeMapper = $phpDocNodeMapper;
|
||||
$this->currentNodeProvider = $currentNodeProvider;
|
||||
|
@ -75,20 +75,20 @@ final class PhpDocInfoFactory
|
|||
$this->rectorChangeCollector = $rectorChangeCollector;
|
||||
$this->phpDocNodeByTypeFinder = $phpDocNodeByTypeFinder;
|
||||
}
|
||||
public function createFromNodeOrEmpty(Node $node) : PhpDocInfo
|
||||
public function createFromNodeOrEmpty(\PhpParser\Node $node) : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
|
||||
{
|
||||
// already added
|
||||
$phpDocInfo = $node->getAttribute(AttributeKey::PHP_DOC_INFO);
|
||||
if ($phpDocInfo instanceof PhpDocInfo) {
|
||||
$phpDocInfo = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO);
|
||||
if ($phpDocInfo instanceof \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo) {
|
||||
return $phpDocInfo;
|
||||
}
|
||||
$phpDocInfo = $this->createFromNode($node);
|
||||
if ($phpDocInfo instanceof PhpDocInfo) {
|
||||
if ($phpDocInfo instanceof \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo) {
|
||||
return $phpDocInfo;
|
||||
}
|
||||
return $this->createEmpty($node);
|
||||
}
|
||||
public function createFromNode(Node $node) : ?PhpDocInfo
|
||||
public function createFromNode(\PhpParser\Node $node) : ?\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
|
||||
{
|
||||
$objectHash = \spl_object_hash($node);
|
||||
if (isset($this->phpDocInfosByObjectHash[$objectHash])) {
|
||||
|
@ -97,17 +97,17 @@ final class PhpDocInfoFactory
|
|||
/** @see \Rector\BetterPhpDocParser\PhpDocParser\DoctrineAnnotationDecorator::decorate() */
|
||||
$this->currentNodeProvider->setNode($node);
|
||||
$docComment = $node->getDocComment();
|
||||
if (!$docComment instanceof Doc) {
|
||||
if (!$docComment instanceof \PhpParser\Comment\Doc) {
|
||||
if ($node->getComments() !== []) {
|
||||
return null;
|
||||
}
|
||||
// create empty node
|
||||
$tokenIterator = new BetterTokenIterator([]);
|
||||
$phpDocNode = new PhpDocNode([]);
|
||||
$tokenIterator = new \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator([]);
|
||||
$phpDocNode = new \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode([]);
|
||||
} else {
|
||||
$text = $docComment->getText();
|
||||
$tokens = $this->lexer->tokenize($text);
|
||||
$tokenIterator = new BetterTokenIterator($tokens);
|
||||
$tokenIterator = new \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator($tokens);
|
||||
$phpDocNode = $this->betterPhpDocParser->parse($tokenIterator);
|
||||
$this->setPositionOfLastToken($phpDocNode);
|
||||
}
|
||||
|
@ -115,12 +115,12 @@ final class PhpDocInfoFactory
|
|||
$this->phpDocInfosByObjectHash[$objectHash] = $phpDocInfo;
|
||||
return $phpDocInfo;
|
||||
}
|
||||
public function createEmpty(Node $node) : PhpDocInfo
|
||||
public function createEmpty(\PhpParser\Node $node) : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
|
||||
{
|
||||
/** @see \Rector\BetterPhpDocParser\PhpDocParser\DoctrineAnnotationDecorator::decorate() */
|
||||
$this->currentNodeProvider->setNode($node);
|
||||
$phpDocNode = new PhpDocNode([]);
|
||||
$phpDocInfo = $this->createFromPhpDocNode($phpDocNode, new BetterTokenIterator([]), $node);
|
||||
$phpDocNode = new \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode([]);
|
||||
$phpDocInfo = $this->createFromPhpDocNode($phpDocNode, new \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator([]), $node);
|
||||
// multiline by default
|
||||
$phpDocInfo->makeMultiLined();
|
||||
return $phpDocInfo;
|
||||
|
@ -128,23 +128,23 @@ final class PhpDocInfoFactory
|
|||
/**
|
||||
* Needed for printing
|
||||
*/
|
||||
private function setPositionOfLastToken(PhpDocNode $phpDocNode) : void
|
||||
private function setPositionOfLastToken(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode) : void
|
||||
{
|
||||
if ($phpDocNode->children === []) {
|
||||
return;
|
||||
}
|
||||
$phpDocChildNodes = $phpDocNode->children;
|
||||
$phpDocChildNode = \array_pop($phpDocChildNodes);
|
||||
$startAndEnd = $phpDocChildNode->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
if ($startAndEnd instanceof StartAndEnd) {
|
||||
$phpDocNode->setAttribute(PhpDocAttributeKey::LAST_PHP_DOC_TOKEN_POSITION, $startAndEnd->getEnd());
|
||||
$startAndEnd = $phpDocChildNode->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END);
|
||||
if ($startAndEnd instanceof \Rector\BetterPhpDocParser\ValueObject\StartAndEnd) {
|
||||
$phpDocNode->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::LAST_PHP_DOC_TOKEN_POSITION, $startAndEnd->getEnd());
|
||||
}
|
||||
}
|
||||
private function createFromPhpDocNode(PhpDocNode $phpDocNode, BetterTokenIterator $betterTokenIterator, Node $node) : PhpDocInfo
|
||||
private function createFromPhpDocNode(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode, \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $betterTokenIterator, \PhpParser\Node $node) : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
|
||||
{
|
||||
$this->phpDocNodeMapper->transform($phpDocNode, $betterTokenIterator);
|
||||
$phpDocInfo = new PhpDocInfo($phpDocNode, $betterTokenIterator, $this->staticTypeMapper, $node, $this->annotationNaming, $this->currentNodeProvider, $this->rectorChangeCollector, $this->phpDocNodeByTypeFinder);
|
||||
$node->setAttribute(AttributeKey::PHP_DOC_INFO, $phpDocInfo);
|
||||
$phpDocInfo = new \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo($phpDocNode, $betterTokenIterator, $this->staticTypeMapper, $node, $this->annotationNaming, $this->currentNodeProvider, $this->rectorChangeCollector, $this->phpDocNodeByTypeFinder);
|
||||
$node->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO, $phpDocInfo);
|
||||
return $phpDocInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocInfo;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Parser\TokenIterator;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use PHPStan\PhpDocParser\Parser\TokenIterator;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use RectorPrefix20220606\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
|
||||
final class TokenIteratorFactory
|
||||
{
|
||||
|
@ -23,23 +23,23 @@ final class TokenIteratorFactory
|
|||
* @var \Symplify\PackageBuilder\Reflection\PrivatesAccessor
|
||||
*/
|
||||
private $privatesAccessor;
|
||||
public function __construct(Lexer $lexer, PrivatesAccessor $privatesAccessor)
|
||||
public function __construct(\PHPStan\PhpDocParser\Lexer\Lexer $lexer, \RectorPrefix20220606\Symplify\PackageBuilder\Reflection\PrivatesAccessor $privatesAccessor)
|
||||
{
|
||||
$this->lexer = $lexer;
|
||||
$this->privatesAccessor = $privatesAccessor;
|
||||
}
|
||||
public function create(string $content) : BetterTokenIterator
|
||||
public function create(string $content) : \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator
|
||||
{
|
||||
$tokens = $this->lexer->tokenize($content);
|
||||
return new BetterTokenIterator($tokens);
|
||||
return new \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator($tokens);
|
||||
}
|
||||
public function createFromTokenIterator(TokenIterator $tokenIterator) : BetterTokenIterator
|
||||
public function createFromTokenIterator(\PHPStan\PhpDocParser\Parser\TokenIterator $tokenIterator) : \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator
|
||||
{
|
||||
if ($tokenIterator instanceof BetterTokenIterator) {
|
||||
if ($tokenIterator instanceof \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator) {
|
||||
return $tokenIterator;
|
||||
}
|
||||
$tokens = $this->privatesAccessor->getPrivateProperty($tokenIterator, 'tokens');
|
||||
$betterTokenIterator = new BetterTokenIterator($tokens);
|
||||
$betterTokenIterator = new \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator($tokens);
|
||||
// keep original position
|
||||
$currentIndex = $this->privatesAccessor->getPrivateProperty($tokenIterator, self::INDEX);
|
||||
$this->privatesAccessor->setPrivateProperty($betterTokenIterator, self::INDEX, $currentIndex);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
|
||||
use RectorPrefix20220606\Nette\Utils\Strings;
|
||||
use RectorPrefix20220606\PhpParser\Node;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
|
||||
use PhpParser\Node;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
|
||||
final class PhpDocClassRenamer
|
||||
{
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@ final class PhpDocClassRenamer
|
|||
* @var \Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher
|
||||
*/
|
||||
private $classAnnotationMatcher;
|
||||
public function __construct(ClassAnnotationMatcher $classAnnotationMatcher)
|
||||
public function __construct(\Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher $classAnnotationMatcher)
|
||||
{
|
||||
$this->classAnnotationMatcher = $classAnnotationMatcher;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ final class PhpDocClassRenamer
|
|||
*
|
||||
* @param string[] $oldToNewClasses
|
||||
*/
|
||||
public function changeTypeInAnnotationTypes(Node $node, PhpDocInfo $phpDocInfo, array $oldToNewClasses) : void
|
||||
public function changeTypeInAnnotationTypes(\PhpParser\Node $node, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, array $oldToNewClasses) : void
|
||||
{
|
||||
$this->processAssertChoiceTagValueNode($oldToNewClasses, $phpDocInfo);
|
||||
$this->processDoctrineRelationTagValueNode($node, $oldToNewClasses, $phpDocInfo);
|
||||
|
@ -35,14 +35,14 @@ final class PhpDocClassRenamer
|
|||
/**
|
||||
* @param array<string, string> $oldToNewClasses
|
||||
*/
|
||||
private function processAssertChoiceTagValueNode(array $oldToNewClasses, PhpDocInfo $phpDocInfo) : void
|
||||
private function processAssertChoiceTagValueNode(array $oldToNewClasses, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo) : void
|
||||
{
|
||||
$assertChoiceTagValueNode = $phpDocInfo->findOneByAnnotationClass('Symfony\\Component\\Validator\\Constraints\\Choice');
|
||||
if (!$assertChoiceTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
if (!$assertChoiceTagValueNode instanceof \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode) {
|
||||
return;
|
||||
}
|
||||
$callback = $assertChoiceTagValueNode->getValueWithoutQuotes('callback');
|
||||
if (!$callback instanceof CurlyListNode) {
|
||||
if (!$callback instanceof \Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode) {
|
||||
return;
|
||||
}
|
||||
$callbackClass = $callback->getValueWithoutQuotes(0);
|
||||
|
@ -58,10 +58,10 @@ final class PhpDocClassRenamer
|
|||
/**
|
||||
* @param array<string, string> $oldToNewClasses
|
||||
*/
|
||||
private function processDoctrineRelationTagValueNode(Node $node, array $oldToNewClasses, PhpDocInfo $phpDocInfo) : void
|
||||
private function processDoctrineRelationTagValueNode(\PhpParser\Node $node, array $oldToNewClasses, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo) : void
|
||||
{
|
||||
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClasses(['Doctrine\\ORM\\Mapping\\OneToMany', 'Doctrine\\ORM\\Mapping\\ManyToMany', 'Doctrine\\ORM\\Mapping\\Embedded']);
|
||||
if (!$doctrineAnnotationTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
if (!$doctrineAnnotationTagValueNode instanceof \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode) {
|
||||
return;
|
||||
}
|
||||
$this->processDoctrineToMany($doctrineAnnotationTagValueNode, $node, $oldToNewClasses);
|
||||
|
@ -69,10 +69,10 @@ final class PhpDocClassRenamer
|
|||
/**
|
||||
* @param array<string, string> $oldToNewClasses
|
||||
*/
|
||||
private function processSerializerTypeTagValueNode(array $oldToNewClasses, PhpDocInfo $phpDocInfo) : void
|
||||
private function processSerializerTypeTagValueNode(array $oldToNewClasses, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo) : void
|
||||
{
|
||||
$doctrineAnnotationTagValueNode = $phpDocInfo->findOneByAnnotationClass('JMS\\Serializer\\Annotation\\Type');
|
||||
if (!$doctrineAnnotationTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
if (!$doctrineAnnotationTagValueNode instanceof \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode) {
|
||||
return;
|
||||
}
|
||||
foreach ($oldToNewClasses as $oldClass => $newClass) {
|
||||
|
@ -82,7 +82,7 @@ final class PhpDocClassRenamer
|
|||
$doctrineAnnotationTagValueNode->changeSilentValue($newClass);
|
||||
continue;
|
||||
}
|
||||
$newContent = Strings::replace($className, '#\\b' . \preg_quote($oldClass, '#') . '\\b#', $newClass);
|
||||
$newContent = \RectorPrefix20220606\Nette\Utils\Strings::replace($className, '#\\b' . \preg_quote($oldClass, '#') . '\\b#', $newClass);
|
||||
if ($newContent === $className) {
|
||||
continue;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ final class PhpDocClassRenamer
|
|||
/**
|
||||
* @param array<string, string> $oldToNewClasses
|
||||
*/
|
||||
private function processDoctrineToMany(DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode, Node $node, array $oldToNewClasses) : void
|
||||
private function processDoctrineToMany(\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode, \PhpParser\Node $node, array $oldToNewClasses) : void
|
||||
{
|
||||
$classKey = $doctrineAnnotationTagValueNode->hasClassName('Doctrine\\ORM\\Mapping\\Embedded') ? 'class' : 'targetEntity';
|
||||
$targetEntity = $doctrineAnnotationTagValueNode->getValueWithoutQuotes($classKey);
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser;
|
||||
final class PhpDocTagRemover
|
||||
{
|
||||
public function removeByName(PhpDocInfo $phpDocInfo, string $name) : void
|
||||
public function removeByName(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, string $name) : void
|
||||
{
|
||||
$phpDocNode = $phpDocInfo->getPhpDocNode();
|
||||
foreach ($phpDocNode->children as $key => $phpDocChildNode) {
|
||||
if (!$phpDocChildNode instanceof PhpDocTagNode) {
|
||||
if (!$phpDocChildNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode) {
|
||||
continue;
|
||||
}
|
||||
if ($this->areAnnotationNamesEqual($name, $phpDocChildNode->name)) {
|
||||
unset($phpDocNode->children[$key]);
|
||||
$phpDocInfo->markAsChanged();
|
||||
}
|
||||
if ($phpDocChildNode->value instanceof DoctrineAnnotationTagValueNode && $phpDocChildNode->value->hasClassName($name)) {
|
||||
if ($phpDocChildNode->value instanceof \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode && $phpDocChildNode->value->hasClassName($name)) {
|
||||
unset($phpDocNode->children[$key]);
|
||||
$phpDocInfo->markAsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public function removeTagValueFromNode(PhpDocInfo $phpDocInfo, Node $desiredNode) : void
|
||||
public function removeTagValueFromNode(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PHPStan\PhpDocParser\Ast\Node $desiredNode) : void
|
||||
{
|
||||
$phpDocNode = $phpDocInfo->getPhpDocNode();
|
||||
$phpDocNodeTraverser = new PhpDocNodeTraverser();
|
||||
$phpDocNodeTraverser = new \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser();
|
||||
$phpDocNodeTraverser->traverseWithCallable($phpDocNode, '', function ($node) use($desiredNode, $phpDocInfo) : ?int {
|
||||
if ($node instanceof PhpDocTagNode && $node->value === $desiredNode) {
|
||||
if ($node instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode && $node->value === $desiredNode) {
|
||||
$phpDocInfo->markAsChanged();
|
||||
return PhpDocNodeTraverser::NODE_REMOVE;
|
||||
return \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser::NODE_REMOVE;
|
||||
}
|
||||
if ($node !== $desiredNode) {
|
||||
return null;
|
||||
}
|
||||
$phpDocInfo->markAsChanged();
|
||||
return PhpDocNodeTraverser::NODE_REMOVE;
|
||||
return \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser::NODE_REMOVE;
|
||||
});
|
||||
}
|
||||
private function areAnnotationNamesEqual(string $firstAnnotationName, string $secondAnnotationName) : bool
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
|
||||
use RectorPrefix20220606\PhpParser\Node\Param;
|
||||
use RectorPrefix20220606\PhpParser\Node\Stmt\ClassMethod;
|
||||
use RectorPrefix20220606\PhpParser\Node\Stmt\Property;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use RectorPrefix20220606\PHPStan\Type\Constant\ConstantArrayType;
|
||||
use RectorPrefix20220606\PHPStan\Type\MixedType;
|
||||
use RectorPrefix20220606\PHPStan\Type\NeverType;
|
||||
use RectorPrefix20220606\PHPStan\Type\Type;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Comment\CommentsMerger;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareCallableTypeNode;
|
||||
use RectorPrefix20220606\Rector\NodeNameResolver\NodeNameResolver;
|
||||
use RectorPrefix20220606\Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use RectorPrefix20220606\Rector\NodeTypeResolver\TypeComparator\TypeComparator;
|
||||
use RectorPrefix20220606\Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||
use RectorPrefix20220606\Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use RectorPrefix20220606\Rector\TypeDeclaration\PhpDocParser\ParamPhpDocNodeFactory;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\Type\Constant\ConstantArrayType;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\NeverType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\BetterPhpDocParser\Comment\CommentsMerger;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareCallableTypeNode;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\NodeTypeResolver\TypeComparator\TypeComparator;
|
||||
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use Rector\TypeDeclaration\PhpDocParser\ParamPhpDocNodeFactory;
|
||||
final class PhpDocTypeChanger
|
||||
{
|
||||
/**
|
||||
* @var array<class-string<Node>>
|
||||
*/
|
||||
public const ALLOWED_TYPES = [GenericTypeNode::class, SpacingAwareArrayTypeNode::class, SpacingAwareCallableTypeNode::class, ArrayShapeNode::class];
|
||||
public const ALLOWED_TYPES = [\PHPStan\PhpDocParser\Ast\Type\GenericTypeNode::class, \Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode::class, \Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareCallableTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode::class];
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
|
@ -69,7 +69,7 @@ final class PhpDocTypeChanger
|
|||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
public function __construct(StaticTypeMapper $staticTypeMapper, TypeComparator $typeComparator, ParamPhpDocNodeFactory $paramPhpDocNodeFactory, NodeNameResolver $nodeNameResolver, CommentsMerger $commentsMerger, PhpDocInfoFactory $phpDocInfoFactory)
|
||||
public function __construct(\Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper, \Rector\NodeTypeResolver\TypeComparator\TypeComparator $typeComparator, \Rector\TypeDeclaration\PhpDocParser\ParamPhpDocNodeFactory $paramPhpDocNodeFactory, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\BetterPhpDocParser\Comment\CommentsMerger $commentsMerger, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory)
|
||||
{
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
$this->typeComparator = $typeComparator;
|
||||
|
@ -78,7 +78,7 @@ final class PhpDocTypeChanger
|
|||
$this->commentsMerger = $commentsMerger;
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
}
|
||||
public function changeVarType(PhpDocInfo $phpDocInfo, Type $newType) : void
|
||||
public function changeVarType(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PHPStan\Type\Type $newType) : void
|
||||
{
|
||||
// better skip, could crash hard
|
||||
if ($phpDocInfo->hasInvalidTag('@var')) {
|
||||
|
@ -89,22 +89,22 @@ final class PhpDocTypeChanger
|
|||
return;
|
||||
}
|
||||
// prevent existing type override by mixed
|
||||
if (!$phpDocInfo->getVarType() instanceof MixedType && $newType instanceof ConstantArrayType && $newType->getItemType() instanceof NeverType) {
|
||||
if (!$phpDocInfo->getVarType() instanceof \PHPStan\Type\MixedType && $newType instanceof \PHPStan\Type\Constant\ConstantArrayType && $newType->getItemType() instanceof \PHPStan\Type\NeverType) {
|
||||
return;
|
||||
}
|
||||
// override existing type
|
||||
$newPHPStanPhpDocType = $this->staticTypeMapper->mapPHPStanTypeToPHPStanPhpDocTypeNode($newType, TypeKind::PROPERTY);
|
||||
$newPHPStanPhpDocType = $this->staticTypeMapper->mapPHPStanTypeToPHPStanPhpDocTypeNode($newType, \Rector\PHPStanStaticTypeMapper\Enum\TypeKind::PROPERTY);
|
||||
$currentVarTagValueNode = $phpDocInfo->getVarTagValueNode();
|
||||
if ($currentVarTagValueNode !== null) {
|
||||
// only change type
|
||||
$currentVarTagValueNode->type = $newPHPStanPhpDocType;
|
||||
} else {
|
||||
// add completely new one
|
||||
$varTagValueNode = new VarTagValueNode($newPHPStanPhpDocType, '', '');
|
||||
$varTagValueNode = new \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode($newPHPStanPhpDocType, '', '');
|
||||
$phpDocInfo->addTagValueNode($varTagValueNode);
|
||||
}
|
||||
}
|
||||
public function changeReturnType(PhpDocInfo $phpDocInfo, Type $newType) : bool
|
||||
public function changeReturnType(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PHPStan\Type\Type $newType) : bool
|
||||
{
|
||||
// better not touch this, can crash
|
||||
if ($phpDocInfo->hasInvalidTag('@return')) {
|
||||
|
@ -115,25 +115,25 @@ final class PhpDocTypeChanger
|
|||
return \false;
|
||||
}
|
||||
// override existing type
|
||||
$newPHPStanPhpDocType = $this->staticTypeMapper->mapPHPStanTypeToPHPStanPhpDocTypeNode($newType, TypeKind::RETURN);
|
||||
$newPHPStanPhpDocType = $this->staticTypeMapper->mapPHPStanTypeToPHPStanPhpDocTypeNode($newType, \Rector\PHPStanStaticTypeMapper\Enum\TypeKind::RETURN);
|
||||
$currentReturnTagValueNode = $phpDocInfo->getReturnTagValue();
|
||||
if ($currentReturnTagValueNode !== null) {
|
||||
// only change type
|
||||
$currentReturnTagValueNode->type = $newPHPStanPhpDocType;
|
||||
} else {
|
||||
// add completely new one
|
||||
$returnTagValueNode = new ReturnTagValueNode($newPHPStanPhpDocType, '');
|
||||
$returnTagValueNode = new \PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode($newPHPStanPhpDocType, '');
|
||||
$phpDocInfo->addTagValueNode($returnTagValueNode);
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
public function changeParamType(PhpDocInfo $phpDocInfo, Type $newType, Param $param, string $paramName) : void
|
||||
public function changeParamType(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PHPStan\Type\Type $newType, \PhpParser\Node\Param $param, string $paramName) : void
|
||||
{
|
||||
// better skip, could crash hard
|
||||
if ($phpDocInfo->hasInvalidTag('@param')) {
|
||||
return;
|
||||
}
|
||||
$phpDocType = $this->staticTypeMapper->mapPHPStanTypeToPHPStanPhpDocTypeNode($newType, TypeKind::PARAM);
|
||||
$phpDocType = $this->staticTypeMapper->mapPHPStanTypeToPHPStanPhpDocTypeNode($newType, \Rector\PHPStanStaticTypeMapper\Enum\TypeKind::PARAM);
|
||||
$paramTagValueNode = $phpDocInfo->getParamTagValueByName($paramName);
|
||||
// override existing type
|
||||
if ($paramTagValueNode !== null) {
|
||||
|
@ -152,9 +152,9 @@ final class PhpDocTypeChanger
|
|||
$phpDocInfo->addTagValueNode($paramTagValueNode);
|
||||
}
|
||||
}
|
||||
public function isAllowed(TypeNode $typeNode) : bool
|
||||
public function isAllowed(\PHPStan\PhpDocParser\Ast\Type\TypeNode $typeNode) : bool
|
||||
{
|
||||
if ($typeNode instanceof BracketsAwareUnionTypeNode) {
|
||||
if ($typeNode instanceof \Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode) {
|
||||
foreach ($typeNode->types as $type) {
|
||||
if ($this->isAllowed($type)) {
|
||||
return \true;
|
||||
|
@ -164,28 +164,28 @@ final class PhpDocTypeChanger
|
|||
if (\in_array(\get_class($typeNode), self::ALLOWED_TYPES, \true)) {
|
||||
return \true;
|
||||
}
|
||||
if (!$typeNode instanceof IdentifierTypeNode) {
|
||||
if (!$typeNode instanceof \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode) {
|
||||
return \false;
|
||||
}
|
||||
return \in_array((string) $typeNode, self::ALLOWED_IDENTIFIER_TYPENODE_TYPES, \true);
|
||||
}
|
||||
public function copyPropertyDocToParam(Property $property, Param $param) : void
|
||||
public function copyPropertyDocToParam(\PhpParser\Node\Stmt\Property $property, \PhpParser\Node\Param $param) : void
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($property);
|
||||
if (!$phpDocInfo instanceof PhpDocInfo) {
|
||||
if (!$phpDocInfo instanceof \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo) {
|
||||
return;
|
||||
}
|
||||
$varTag = $phpDocInfo->getVarTagValueNode();
|
||||
if (!$varTag instanceof VarTagValueNode) {
|
||||
if (!$varTag instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode) {
|
||||
$this->processKeepComments($property, $param);
|
||||
return;
|
||||
}
|
||||
if ($varTag->description !== '') {
|
||||
return;
|
||||
}
|
||||
$functionLike = $param->getAttribute(AttributeKey::PARENT_NODE);
|
||||
$functionLike = $param->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
$paramVarName = $this->nodeNameResolver->getName($param->var);
|
||||
if (!$functionLike instanceof ClassMethod) {
|
||||
if (!$functionLike instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
return;
|
||||
}
|
||||
if (!$this->isAllowed($varTag->type)) {
|
||||
|
@ -194,36 +194,36 @@ final class PhpDocTypeChanger
|
|||
if (!\is_string($paramVarName)) {
|
||||
return;
|
||||
}
|
||||
$phpDocInfo->removeByType(VarTagValueNode::class);
|
||||
$param->setAttribute(AttributeKey::PHP_DOC_INFO, $phpDocInfo);
|
||||
$phpDocInfo = $functionLike->getAttribute(AttributeKey::PHP_DOC_INFO);
|
||||
$phpDocInfo->removeByType(\PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode::class);
|
||||
$param->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO, $phpDocInfo);
|
||||
$phpDocInfo = $functionLike->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO);
|
||||
$paramType = $this->staticTypeMapper->mapPHPStanPhpDocTypeToPHPStanType($varTag, $property);
|
||||
$this->changeParamType($phpDocInfo, $paramType, $param, $paramVarName);
|
||||
$this->processKeepComments($property, $param);
|
||||
}
|
||||
public function changeVarTypeNode(PhpDocInfo $phpDocInfo, TypeNode $typeNode) : void
|
||||
public function changeVarTypeNode(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PHPStan\PhpDocParser\Ast\Type\TypeNode $typeNode) : void
|
||||
{
|
||||
// add completely new one
|
||||
$varTagValueNode = new VarTagValueNode($typeNode, '', '');
|
||||
$varTagValueNode = new \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode($typeNode, '', '');
|
||||
$phpDocInfo->addTagValueNode($varTagValueNode);
|
||||
}
|
||||
private function processKeepComments(Property $property, Param $param) : void
|
||||
private function processKeepComments(\PhpParser\Node\Stmt\Property $property, \PhpParser\Node\Param $param) : void
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($param);
|
||||
$varTag = $phpDocInfo->getVarTagValueNode();
|
||||
$toBeRemoved = !$varTag instanceof VarTagValueNode;
|
||||
$toBeRemoved = !$varTag instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
$this->commentsMerger->keepComments($param, [$property]);
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($param);
|
||||
$varTag = $phpDocInfo->getVarTagValueNode();
|
||||
if (!$toBeRemoved) {
|
||||
return;
|
||||
}
|
||||
if (!$varTag instanceof VarTagValueNode) {
|
||||
if (!$varTag instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode) {
|
||||
return;
|
||||
}
|
||||
if ($varTag->description !== '') {
|
||||
return;
|
||||
}
|
||||
$phpDocInfo->removeByType(VarTagValueNode::class);
|
||||
$phpDocInfo->removeByType(\PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode::class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use RectorPrefix20220606\Rector\Naming\Contract\RenameValueObjectInterface;
|
||||
use RectorPrefix20220606\Rector\Naming\ValueObject\ParamRename;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use Rector\Naming\Contract\RenameValueObjectInterface;
|
||||
use Rector\Naming\ValueObject\ParamRename;
|
||||
final class PropertyDocBlockManipulator
|
||||
{
|
||||
/**
|
||||
|
@ -15,22 +15,22 @@ final class PropertyDocBlockManipulator
|
|||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
public function __construct(PhpDocInfoFactory $phpDocInfoFactory)
|
||||
public function __construct(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory)
|
||||
{
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
}
|
||||
/**
|
||||
* @param ParamRename $renameValueObject
|
||||
*/
|
||||
public function renameParameterNameInDocBlock(RenameValueObjectInterface $renameValueObject) : void
|
||||
public function renameParameterNameInDocBlock(\Rector\Naming\Contract\RenameValueObjectInterface $renameValueObject) : void
|
||||
{
|
||||
$functionLike = $renameValueObject->getFunctionLike();
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($functionLike);
|
||||
$paramTagValueNode = $phpDocInfo->getParamTagValueNodeByName($renameValueObject->getCurrentName());
|
||||
if (!$paramTagValueNode instanceof ParamTagValueNode) {
|
||||
if (!$paramTagValueNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode) {
|
||||
return;
|
||||
}
|
||||
$paramTagValueNode->parameterName = '$' . $renameValueObject->getExpectedName();
|
||||
$paramTagValueNode->setAttribute(PhpDocAttributeKey::ORIG_NODE, null);
|
||||
$paramTagValueNode->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::ORIG_NODE, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
|
||||
use RectorPrefix20220606\PhpParser\Node;
|
||||
use RectorPrefix20220606\PhpParser\Node\Stmt\Expression;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\Type\MixedType;
|
||||
use RectorPrefix20220606\PHPStan\Type\Type;
|
||||
use RectorPrefix20220606\PHPStan\Type\TypeWithClassName;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Type\FullyQualifiedIdentifierTypeNode;
|
||||
use RectorPrefix20220606\Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\FullyQualifiedIdentifierTypeNode;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
final class VarAnnotationManipulator
|
||||
{
|
||||
/**
|
||||
|
@ -30,36 +30,36 @@ final class VarAnnotationManipulator
|
|||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
public function __construct(PhpDocInfoFactory $phpDocInfoFactory, PhpDocTypeChanger $phpDocTypeChanger, BetterNodeFinder $betterNodeFinder)
|
||||
public function __construct(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger $phpDocTypeChanger, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder)
|
||||
{
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
$this->phpDocTypeChanger = $phpDocTypeChanger;
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
}
|
||||
public function decorateNodeWithInlineVarType(Node $node, TypeWithClassName $typeWithClassName, string $variableName) : void
|
||||
public function decorateNodeWithInlineVarType(\PhpParser\Node $node, \PHPStan\Type\TypeWithClassName $typeWithClassName, string $variableName) : void
|
||||
{
|
||||
$phpDocInfo = $this->resolvePhpDocInfo($node);
|
||||
// already done
|
||||
if ($phpDocInfo->getVarTagValueNode() !== null) {
|
||||
return;
|
||||
}
|
||||
$fullyQualifiedIdentifierTypeNode = new FullyQualifiedIdentifierTypeNode($typeWithClassName->getClassName());
|
||||
$varTagValueNode = new VarTagValueNode($fullyQualifiedIdentifierTypeNode, '$' . $variableName, '');
|
||||
$fullyQualifiedIdentifierTypeNode = new \Rector\BetterPhpDocParser\ValueObject\Type\FullyQualifiedIdentifierTypeNode($typeWithClassName->getClassName());
|
||||
$varTagValueNode = new \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode($fullyQualifiedIdentifierTypeNode, '$' . $variableName, '');
|
||||
$phpDocInfo->addTagValueNode($varTagValueNode);
|
||||
$phpDocInfo->makeSingleLined();
|
||||
}
|
||||
public function decorateNodeWithType(Node $node, Type $staticType) : void
|
||||
public function decorateNodeWithType(\PhpParser\Node $node, \PHPStan\Type\Type $staticType) : void
|
||||
{
|
||||
if ($staticType instanceof MixedType) {
|
||||
if ($staticType instanceof \PHPStan\Type\MixedType) {
|
||||
return;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
$this->phpDocTypeChanger->changeVarType($phpDocInfo, $staticType);
|
||||
}
|
||||
private function resolvePhpDocInfo(Node $node) : PhpDocInfo
|
||||
private function resolvePhpDocInfo(\PhpParser\Node $node) : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
|
||||
{
|
||||
$currentStmt = $this->betterNodeFinder->resolveCurrentStatement($node);
|
||||
if ($currentStmt instanceof Expression) {
|
||||
if ($currentStmt instanceof \PhpParser\Node\Stmt\Expression) {
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($currentStmt);
|
||||
} else {
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeFinder;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocNodeFinder;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser;
|
||||
/**
|
||||
* @template TNode as \PHPStan\PhpDocParser\Ast\Node
|
||||
|
@ -16,9 +16,9 @@ final class PhpDocNodeByTypeFinder
|
|||
* @param class-string<TNode> $desiredType
|
||||
* @return array<TNode>
|
||||
*/
|
||||
public function findByType(PhpDocNode $phpDocNode, string $desiredType) : array
|
||||
public function findByType(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode, string $desiredType) : array
|
||||
{
|
||||
$phpDocNodeTraverser = new PhpDocNodeTraverser();
|
||||
$phpDocNodeTraverser = new \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser();
|
||||
$foundNodes = [];
|
||||
$phpDocNodeTraverser->traverseWithCallable($phpDocNode, '', function ($node) use(&$foundNodes, $desiredType) : Node {
|
||||
if (!\is_a($node, $desiredType, \true)) {
|
||||
|
@ -34,7 +34,7 @@ final class PhpDocNodeByTypeFinder
|
|||
* @param class-string[] $classes
|
||||
* @return DoctrineAnnotationTagValueNode[]
|
||||
*/
|
||||
public function findDoctrineAnnotationsByClasses(PhpDocNode $phpDocNode, array $classes) : array
|
||||
public function findDoctrineAnnotationsByClasses(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode, array $classes) : array
|
||||
{
|
||||
$doctrineAnnotationTagValueNodes = [];
|
||||
foreach ($classes as $class) {
|
||||
|
@ -47,11 +47,11 @@ final class PhpDocNodeByTypeFinder
|
|||
* @param class-string $desiredClass
|
||||
* @return DoctrineAnnotationTagValueNode[]
|
||||
*/
|
||||
public function findDoctrineAnnotationsByClass(PhpDocNode $phpDocNode, string $desiredClass) : array
|
||||
public function findDoctrineAnnotationsByClass(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode, string $desiredClass) : array
|
||||
{
|
||||
$desiredDoctrineTagValueNodes = [];
|
||||
/** @var DoctrineAnnotationTagValueNode[] $doctrineTagValueNodes */
|
||||
$doctrineTagValueNodes = $this->findByType($phpDocNode, DoctrineAnnotationTagValueNode::class);
|
||||
$doctrineTagValueNodes = $this->findByType($phpDocNode, \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode::class);
|
||||
foreach ($doctrineTagValueNodes as $doctrineTagValueNode) {
|
||||
if ($doctrineTagValueNode->hasClassName($desiredClass)) {
|
||||
$desiredDoctrineTagValueNodes[] = $doctrineTagValueNode;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser;
|
||||
namespace Rector\BetterPhpDocParser;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\CloningPhpDocNodeVisitor;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\ParentConnectingPhpDocNodeVisitor;
|
||||
|
@ -38,23 +38,23 @@ final class PhpDocNodeMapper
|
|||
/**
|
||||
* @param BasePhpDocNodeVisitorInterface[] $phpDocNodeVisitors
|
||||
*/
|
||||
public function __construct(CurrentTokenIteratorProvider $currentTokenIteratorProvider, ParentConnectingPhpDocNodeVisitor $parentConnectingPhpDocNodeVisitor, CloningPhpDocNodeVisitor $cloningPhpDocNodeVisitor, array $phpDocNodeVisitors)
|
||||
public function __construct(\Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider $currentTokenIteratorProvider, \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\ParentConnectingPhpDocNodeVisitor $parentConnectingPhpDocNodeVisitor, \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\CloningPhpDocNodeVisitor $cloningPhpDocNodeVisitor, array $phpDocNodeVisitors)
|
||||
{
|
||||
$this->currentTokenIteratorProvider = $currentTokenIteratorProvider;
|
||||
$this->parentConnectingPhpDocNodeVisitor = $parentConnectingPhpDocNodeVisitor;
|
||||
$this->cloningPhpDocNodeVisitor = $cloningPhpDocNodeVisitor;
|
||||
$this->phpDocNodeVisitors = $phpDocNodeVisitors;
|
||||
}
|
||||
public function transform(PhpDocNode $phpDocNode, BetterTokenIterator $betterTokenIterator) : void
|
||||
public function transform(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode, \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $betterTokenIterator) : void
|
||||
{
|
||||
$this->currentTokenIteratorProvider->setBetterTokenIterator($betterTokenIterator);
|
||||
$parentPhpDocNodeTraverser = new PhpDocNodeTraverser();
|
||||
$parentPhpDocNodeTraverser = new \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser();
|
||||
$parentPhpDocNodeTraverser->addPhpDocNodeVisitor($this->parentConnectingPhpDocNodeVisitor);
|
||||
$parentPhpDocNodeTraverser->traverse($phpDocNode);
|
||||
$cloningPhpDocNodeTraverser = new PhpDocNodeTraverser();
|
||||
$cloningPhpDocNodeTraverser = new \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser();
|
||||
$cloningPhpDocNodeTraverser->addPhpDocNodeVisitor($this->cloningPhpDocNodeVisitor);
|
||||
$cloningPhpDocNodeTraverser->traverse($phpDocNode);
|
||||
$phpDocNodeTraverser = new PhpDocNodeTraverser();
|
||||
$phpDocNodeTraverser = new \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser();
|
||||
foreach ($this->phpDocNodeVisitors as $phpDocNodeVisitor) {
|
||||
$phpDocNodeTraverser->addPhpDocNodeVisitor($phpDocNodeVisitor);
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
|
||||
use Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor;
|
||||
final class ArrayTypePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor implements BasePhpDocNodeVisitorInterface
|
||||
final class ArrayTypePhpDocNodeVisitor extends \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor implements \Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer
|
||||
*/
|
||||
private $attributeMirrorer;
|
||||
public function __construct(AttributeMirrorer $attributeMirrorer)
|
||||
public function __construct(\Rector\BetterPhpDocParser\Attributes\AttributeMirrorer $attributeMirrorer)
|
||||
{
|
||||
$this->attributeMirrorer = $attributeMirrorer;
|
||||
}
|
||||
public function enterNode(Node $node) : ?Node
|
||||
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
|
||||
{
|
||||
if (!$node instanceof ArrayTypeNode) {
|
||||
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode) {
|
||||
return null;
|
||||
}
|
||||
if ($node instanceof SpacingAwareArrayTypeNode) {
|
||||
if ($node instanceof \Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode) {
|
||||
return null;
|
||||
}
|
||||
$spacingAwareArrayTypeNode = new SpacingAwareArrayTypeNode($node->type);
|
||||
$spacingAwareArrayTypeNode = new \Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode($node->type);
|
||||
$this->attributeMirrorer->mirror($node, $spacingAwareArrayTypeNode);
|
||||
return $spacingAwareArrayTypeNode;
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\CallableTypeNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareCallableTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\CallableTypeNode;
|
||||
use Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareCallableTypeNode;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor;
|
||||
final class CallableTypePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor implements BasePhpDocNodeVisitorInterface
|
||||
final class CallableTypePhpDocNodeVisitor extends \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor implements \Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer
|
||||
*/
|
||||
private $attributeMirrorer;
|
||||
public function __construct(AttributeMirrorer $attributeMirrorer)
|
||||
public function __construct(\Rector\BetterPhpDocParser\Attributes\AttributeMirrorer $attributeMirrorer)
|
||||
{
|
||||
$this->attributeMirrorer = $attributeMirrorer;
|
||||
}
|
||||
public function enterNode(Node $node) : ?Node
|
||||
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
|
||||
{
|
||||
if (!$node instanceof CallableTypeNode) {
|
||||
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode) {
|
||||
return null;
|
||||
}
|
||||
if ($node instanceof SpacingAwareCallableTypeNode) {
|
||||
if ($node instanceof \Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareCallableTypeNode) {
|
||||
return null;
|
||||
}
|
||||
$spacingAwareCallableTypeNode = new SpacingAwareCallableTypeNode($node->identifier, $node->parameters, $node->returnType);
|
||||
$spacingAwareCallableTypeNode = new \Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareCallableTypeNode($node->identifier, $node->parameters, $node->returnType);
|
||||
$this->attributeMirrorer->mirror($node, $spacingAwareCallableTypeNode);
|
||||
return $spacingAwareCallableTypeNode;
|
||||
}
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor;
|
||||
final class ChangedPhpDocNodeVisitor extends AbstractPhpDocNodeVisitor
|
||||
final class ChangedPhpDocNodeVisitor extends \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $hasChanged = \false;
|
||||
public function beforeTraverse(Node $node) : void
|
||||
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
|
||||
{
|
||||
$this->hasChanged = \false;
|
||||
}
|
||||
public function enterNode(Node $node) : ?Node
|
||||
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
|
||||
{
|
||||
$origNode = $node->getAttribute(PhpDocAttributeKey::ORIG_NODE);
|
||||
$origNode = $node->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::ORIG_NODE);
|
||||
if ($origNode === null) {
|
||||
$this->hasChanged = \true;
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareIntersectionTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
|
||||
use Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareIntersectionTypeNode;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor;
|
||||
final class IntersectionTypeNodePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor implements BasePhpDocNodeVisitorInterface
|
||||
final class IntersectionTypeNodePhpDocNodeVisitor extends \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor implements \Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer
|
||||
*/
|
||||
private $attributeMirrorer;
|
||||
public function __construct(AttributeMirrorer $attributeMirrorer)
|
||||
public function __construct(\Rector\BetterPhpDocParser\Attributes\AttributeMirrorer $attributeMirrorer)
|
||||
{
|
||||
$this->attributeMirrorer = $attributeMirrorer;
|
||||
}
|
||||
public function enterNode(Node $node) : ?Node
|
||||
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
|
||||
{
|
||||
if (!$node instanceof IntersectionTypeNode) {
|
||||
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode) {
|
||||
return null;
|
||||
}
|
||||
if ($node instanceof BracketsAwareIntersectionTypeNode) {
|
||||
if ($node instanceof \Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareIntersectionTypeNode) {
|
||||
return null;
|
||||
}
|
||||
$bracketsAwareIntersectionTypeNode = new BracketsAwareIntersectionTypeNode($node->types);
|
||||
$bracketsAwareIntersectionTypeNode = new \Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareIntersectionTypeNode($node->types);
|
||||
$this->attributeMirrorer->mirror($node, $bracketsAwareIntersectionTypeNode);
|
||||
return $bracketsAwareIntersectionTypeNode;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDoc\SpacingAwareTemplateTagValueNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use RectorPrefix20220606\Rector\Core\Exception\ShouldNotHappenException;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\SpacingAwareTemplateTagValueNode;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor;
|
||||
final class TemplatePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor implements BasePhpDocNodeVisitorInterface
|
||||
final class TemplatePhpDocNodeVisitor extends \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor implements \Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
|
@ -27,34 +27,34 @@ final class TemplatePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor implemen
|
|||
* @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer
|
||||
*/
|
||||
private $attributeMirrorer;
|
||||
public function __construct(CurrentTokenIteratorProvider $currentTokenIteratorProvider, AttributeMirrorer $attributeMirrorer)
|
||||
public function __construct(\Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider $currentTokenIteratorProvider, \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer $attributeMirrorer)
|
||||
{
|
||||
$this->currentTokenIteratorProvider = $currentTokenIteratorProvider;
|
||||
$this->attributeMirrorer = $attributeMirrorer;
|
||||
}
|
||||
public function enterNode(Node $node) : ?Node
|
||||
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
|
||||
{
|
||||
if (!$node instanceof TemplateTagValueNode) {
|
||||
if (!$node instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode) {
|
||||
return null;
|
||||
}
|
||||
if ($node instanceof SpacingAwareTemplateTagValueNode) {
|
||||
if ($node instanceof \Rector\BetterPhpDocParser\ValueObject\PhpDoc\SpacingAwareTemplateTagValueNode) {
|
||||
return null;
|
||||
}
|
||||
$betterTokenIterator = $this->currentTokenIteratorProvider->provide();
|
||||
$startAndEnd = $node->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
if (!$startAndEnd instanceof StartAndEnd) {
|
||||
throw new ShouldNotHappenException();
|
||||
$startAndEnd = $node->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END);
|
||||
if (!$startAndEnd instanceof \Rector\BetterPhpDocParser\ValueObject\StartAndEnd) {
|
||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||
}
|
||||
$prepositions = $this->resolvePreposition($betterTokenIterator, $startAndEnd);
|
||||
$spacingAwareTemplateTagValueNode = new SpacingAwareTemplateTagValueNode($node->name, $node->bound, $node->description, $prepositions);
|
||||
$spacingAwareTemplateTagValueNode = new \Rector\BetterPhpDocParser\ValueObject\PhpDoc\SpacingAwareTemplateTagValueNode($node->name, $node->bound, $node->description, $prepositions);
|
||||
$this->attributeMirrorer->mirror($node, $spacingAwareTemplateTagValueNode);
|
||||
return $spacingAwareTemplateTagValueNode;
|
||||
}
|
||||
private function resolvePreposition(BetterTokenIterator $betterTokenIterator, StartAndEnd $startAndEnd) : string
|
||||
private function resolvePreposition(\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $betterTokenIterator, \Rector\BetterPhpDocParser\ValueObject\StartAndEnd $startAndEnd) : string
|
||||
{
|
||||
$partialTokens = $betterTokenIterator->partialTokens($startAndEnd->getStart(), $startAndEnd->getEnd());
|
||||
foreach ($partialTokens as $partialToken) {
|
||||
if ($partialToken[1] !== Lexer::TOKEN_IDENTIFIER) {
|
||||
if ($partialToken[1] !== \PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_IDENTIFIER) {
|
||||
continue;
|
||||
}
|
||||
if (!\in_array($partialToken[0], ['as', 'of'], \true)) {
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
||||
use Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor;
|
||||
final class UnionTypeNodePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor implements BasePhpDocNodeVisitorInterface
|
||||
final class UnionTypeNodePhpDocNodeVisitor extends \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor implements \Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
|
@ -26,49 +26,49 @@ final class UnionTypeNodePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor imp
|
|||
* @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer
|
||||
*/
|
||||
private $attributeMirrorer;
|
||||
public function __construct(CurrentTokenIteratorProvider $currentTokenIteratorProvider, AttributeMirrorer $attributeMirrorer)
|
||||
public function __construct(\Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider $currentTokenIteratorProvider, \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer $attributeMirrorer)
|
||||
{
|
||||
$this->currentTokenIteratorProvider = $currentTokenIteratorProvider;
|
||||
$this->attributeMirrorer = $attributeMirrorer;
|
||||
}
|
||||
public function enterNode(Node $node) : ?Node
|
||||
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
|
||||
{
|
||||
if (!$node instanceof UnionTypeNode) {
|
||||
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode) {
|
||||
return null;
|
||||
}
|
||||
if ($node instanceof BracketsAwareUnionTypeNode) {
|
||||
if ($node instanceof \Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode) {
|
||||
return null;
|
||||
}
|
||||
$startAndEnd = $this->resolveStardAndEnd($node);
|
||||
if (!$startAndEnd instanceof StartAndEnd) {
|
||||
if (!$startAndEnd instanceof \Rector\BetterPhpDocParser\ValueObject\StartAndEnd) {
|
||||
return null;
|
||||
}
|
||||
$betterTokenProvider = $this->currentTokenIteratorProvider->provide();
|
||||
$isWrappedInCurlyBrackets = $this->isWrappedInCurlyBrackets($betterTokenProvider, $startAndEnd);
|
||||
$bracketsAwareUnionTypeNode = new BracketsAwareUnionTypeNode($node->types, $isWrappedInCurlyBrackets);
|
||||
$bracketsAwareUnionTypeNode = new \Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode($node->types, $isWrappedInCurlyBrackets);
|
||||
$this->attributeMirrorer->mirror($node, $bracketsAwareUnionTypeNode);
|
||||
return $bracketsAwareUnionTypeNode;
|
||||
}
|
||||
private function isWrappedInCurlyBrackets(BetterTokenIterator $betterTokenProvider, StartAndEnd $startAndEnd) : bool
|
||||
private function isWrappedInCurlyBrackets(\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $betterTokenProvider, \Rector\BetterPhpDocParser\ValueObject\StartAndEnd $startAndEnd) : bool
|
||||
{
|
||||
$previousPosition = $startAndEnd->getStart() - 1;
|
||||
if ($betterTokenProvider->isTokenTypeOnPosition(Lexer::TOKEN_OPEN_PARENTHESES, $previousPosition)) {
|
||||
if ($betterTokenProvider->isTokenTypeOnPosition(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_OPEN_PARENTHESES, $previousPosition)) {
|
||||
return \true;
|
||||
}
|
||||
// there is no + 1, as end is right at the next token
|
||||
return $betterTokenProvider->isTokenTypeOnPosition(Lexer::TOKEN_CLOSE_PARENTHESES, $startAndEnd->getEnd());
|
||||
return $betterTokenProvider->isTokenTypeOnPosition(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_CLOSE_PARENTHESES, $startAndEnd->getEnd());
|
||||
}
|
||||
private function resolveStardAndEnd(UnionTypeNode $unionTypeNode) : ?StartAndEnd
|
||||
private function resolveStardAndEnd(\PHPStan\PhpDocParser\Ast\Type\UnionTypeNode $unionTypeNode) : ?\Rector\BetterPhpDocParser\ValueObject\StartAndEnd
|
||||
{
|
||||
$starAndEnd = $unionTypeNode->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
if ($starAndEnd instanceof StartAndEnd) {
|
||||
$starAndEnd = $unionTypeNode->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END);
|
||||
if ($starAndEnd instanceof \Rector\BetterPhpDocParser\ValueObject\StartAndEnd) {
|
||||
return $starAndEnd;
|
||||
}
|
||||
// unwrap with parent array type...
|
||||
$parent = $unionTypeNode->getAttribute(PhpDocAttributeKey::PARENT);
|
||||
if (!$parent instanceof Node) {
|
||||
$parent = $unionTypeNode->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::PARENT);
|
||||
if (!$parent instanceof \PHPStan\PhpDocParser\Ast\Node) {
|
||||
return null;
|
||||
}
|
||||
return $parent->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
return $parent->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocParser;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocParser;
|
||||
|
||||
use RectorPrefix20220606\PhpParser\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Parser\ConstExprParser;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Parser\PhpDocParser;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Parser\TokenIterator;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Parser\TypeParser;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use RectorPrefix20220606\Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use RectorPrefix20220606\Rector\Core\Exception\ShouldNotHappenException;
|
||||
use PhpParser\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use PHPStan\PhpDocParser\Parser\ConstExprParser;
|
||||
use PHPStan\PhpDocParser\Parser\PhpDocParser;
|
||||
use PHPStan\PhpDocParser\Parser\TokenIterator;
|
||||
use PHPStan\PhpDocParser\Parser\TypeParser;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use RectorPrefix20220606\Symplify\PackageBuilder\Reflection\PrivatesCaller;
|
||||
/**
|
||||
* @see \Rector\Tests\BetterPhpDocParser\PhpDocParser\TagValueNodeReprint\TagValueNodeReprintTest
|
||||
*/
|
||||
final class BetterPhpDocParser extends PhpDocParser
|
||||
final class BetterPhpDocParser extends \PHPStan\PhpDocParser\Parser\PhpDocParser
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
|
@ -50,76 +50,76 @@ final class BetterPhpDocParser extends PhpDocParser
|
|||
/**
|
||||
* @param PhpDocNodeDecoratorInterface[] $phpDocNodeDecorators
|
||||
*/
|
||||
public function __construct(TypeParser $typeParser, ConstExprParser $constExprParser, CurrentNodeProvider $currentNodeProvider, TokenIteratorFactory $tokenIteratorFactory, array $phpDocNodeDecorators, PrivatesCaller $privatesCaller = null)
|
||||
public function __construct(\PHPStan\PhpDocParser\Parser\TypeParser $typeParser, \PHPStan\PhpDocParser\Parser\ConstExprParser $constExprParser, \Rector\Core\Configuration\CurrentNodeProvider $currentNodeProvider, \Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory $tokenIteratorFactory, array $phpDocNodeDecorators, \RectorPrefix20220606\Symplify\PackageBuilder\Reflection\PrivatesCaller $privatesCaller = null)
|
||||
{
|
||||
$privatesCaller = $privatesCaller ?? new PrivatesCaller();
|
||||
$privatesCaller = $privatesCaller ?? new \RectorPrefix20220606\Symplify\PackageBuilder\Reflection\PrivatesCaller();
|
||||
$this->currentNodeProvider = $currentNodeProvider;
|
||||
$this->tokenIteratorFactory = $tokenIteratorFactory;
|
||||
$this->phpDocNodeDecorators = $phpDocNodeDecorators;
|
||||
$this->privatesCaller = $privatesCaller;
|
||||
parent::__construct($typeParser, $constExprParser);
|
||||
}
|
||||
public function parse(TokenIterator $tokenIterator) : PhpDocNode
|
||||
public function parse(\PHPStan\PhpDocParser\Parser\TokenIterator $tokenIterator) : \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode
|
||||
{
|
||||
$tokenIterator->consumeTokenType(Lexer::TOKEN_OPEN_PHPDOC);
|
||||
$tokenIterator->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||
$tokenIterator->consumeTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_OPEN_PHPDOC);
|
||||
$tokenIterator->tryConsumeTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_PHPDOC_EOL);
|
||||
$children = [];
|
||||
if (!$tokenIterator->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) {
|
||||
if (!$tokenIterator->isCurrentTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_CLOSE_PHPDOC)) {
|
||||
$children[] = $this->parseChildAndStoreItsPositions($tokenIterator);
|
||||
while ($tokenIterator->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL) && !$tokenIterator->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) {
|
||||
while ($tokenIterator->tryConsumeTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_PHPDOC_EOL) && !$tokenIterator->isCurrentTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_CLOSE_PHPDOC)) {
|
||||
$children[] = $this->parseChildAndStoreItsPositions($tokenIterator);
|
||||
}
|
||||
}
|
||||
// might be in the middle of annotations
|
||||
$tokenIterator->tryConsumeTokenType(Lexer::TOKEN_CLOSE_PHPDOC);
|
||||
$phpDocNode = new PhpDocNode($children);
|
||||
$tokenIterator->tryConsumeTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_CLOSE_PHPDOC);
|
||||
$phpDocNode = new \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode($children);
|
||||
// decorate FQN classes etc.
|
||||
$node = $this->currentNodeProvider->getNode();
|
||||
if (!$node instanceof Node) {
|
||||
throw new ShouldNotHappenException();
|
||||
if (!$node instanceof \PhpParser\Node) {
|
||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||
}
|
||||
foreach ($this->phpDocNodeDecorators as $phpDocNodeDecorator) {
|
||||
$phpDocNodeDecorator->decorate($phpDocNode, $node);
|
||||
}
|
||||
return $phpDocNode;
|
||||
}
|
||||
public function parseTag(TokenIterator $tokenIterator) : PhpDocTagNode
|
||||
public function parseTag(\PHPStan\PhpDocParser\Parser\TokenIterator $tokenIterator) : \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode
|
||||
{
|
||||
// replace generic nodes with DoctrineAnnotations
|
||||
if (!$tokenIterator instanceof BetterTokenIterator) {
|
||||
throw new ShouldNotHappenException();
|
||||
if (!$tokenIterator instanceof \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator) {
|
||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||
}
|
||||
$tag = $this->resolveTag($tokenIterator);
|
||||
$phpDocTagValueNode = $this->parseTagValue($tokenIterator, $tag);
|
||||
return new PhpDocTagNode($tag, $phpDocTagValueNode);
|
||||
return new \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode($tag, $phpDocTagValueNode);
|
||||
}
|
||||
/**
|
||||
* @param BetterTokenIterator $tokenIterator
|
||||
*/
|
||||
public function parseTagValue(TokenIterator $tokenIterator, string $tag) : PhpDocTagValueNode
|
||||
public function parseTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokenIterator, string $tag) : \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode
|
||||
{
|
||||
$startPosition = $tokenIterator->currentPosition();
|
||||
$tagValueNode = parent::parseTagValue($tokenIterator, $tag);
|
||||
$endPosition = $tokenIterator->currentPosition();
|
||||
$startAndEnd = new StartAndEnd($startPosition, $endPosition);
|
||||
$tagValueNode->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
$startAndEnd = new \Rector\BetterPhpDocParser\ValueObject\StartAndEnd($startPosition, $endPosition);
|
||||
$tagValueNode->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
return $tagValueNode;
|
||||
}
|
||||
/**
|
||||
* @return PhpDocTextNode|PhpDocTagNode
|
||||
*/
|
||||
private function parseChildAndStoreItsPositions(TokenIterator $tokenIterator) : PhpDocChildNode
|
||||
private function parseChildAndStoreItsPositions(\PHPStan\PhpDocParser\Parser\TokenIterator $tokenIterator) : \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode
|
||||
{
|
||||
$betterTokenIterator = $this->tokenIteratorFactory->createFromTokenIterator($tokenIterator);
|
||||
$startPosition = $betterTokenIterator->currentPosition();
|
||||
/** @var PhpDocChildNode $phpDocNode */
|
||||
$phpDocNode = $this->privatesCaller->callPrivateMethod($this, 'parseChild', [$betterTokenIterator]);
|
||||
$endPosition = $betterTokenIterator->currentPosition();
|
||||
$startAndEnd = new StartAndEnd($startPosition, $endPosition);
|
||||
$phpDocNode->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
$startAndEnd = new \Rector\BetterPhpDocParser\ValueObject\StartAndEnd($startPosition, $endPosition);
|
||||
$phpDocNode->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
return $phpDocNode;
|
||||
}
|
||||
private function resolveTag(BetterTokenIterator $tokenIterator) : string
|
||||
private function resolveTag(\Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator $tokenIterator) : string
|
||||
{
|
||||
$tag = $tokenIterator->currentTokenValue();
|
||||
$tokenIterator->next();
|
||||
|
@ -129,7 +129,7 @@ final class BetterPhpDocParser extends PhpDocParser
|
|||
}
|
||||
// is not e.g "@var "
|
||||
// join tags like "@ORM\Column" etc.
|
||||
if (!$tokenIterator->isCurrentTokenType(Lexer::TOKEN_IDENTIFIER)) {
|
||||
if (!$tokenIterator->isCurrentTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_IDENTIFIER)) {
|
||||
return $tag;
|
||||
}
|
||||
// @todo use joinUntil("(")?
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocParser;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocParser;
|
||||
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Parser\ConstExprParser;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Parser\TokenIterator;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Parser\TypeParser;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
final class BetterTypeParser extends TypeParser
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\PhpDocParser\Parser\ConstExprParser;
|
||||
use PHPStan\PhpDocParser\Parser\TokenIterator;
|
||||
use PHPStan\PhpDocParser\Parser\TypeParser;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
final class BetterTypeParser extends \PHPStan\PhpDocParser\Parser\TypeParser
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory
|
||||
*/
|
||||
private $tokenIteratorFactory;
|
||||
public function __construct(TokenIteratorFactory $tokenIteratorFactory, ?ConstExprParser $constExprParser = null)
|
||||
public function __construct(\Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory $tokenIteratorFactory, ?\PHPStan\PhpDocParser\Parser\ConstExprParser $constExprParser = null)
|
||||
{
|
||||
$this->tokenIteratorFactory = $tokenIteratorFactory;
|
||||
parent::__construct($constExprParser);
|
||||
}
|
||||
public function parse(TokenIterator $tokenIterator) : TypeNode
|
||||
public function parse(\PHPStan\PhpDocParser\Parser\TokenIterator $tokenIterator) : \PHPStan\PhpDocParser\Ast\Type\TypeNode
|
||||
{
|
||||
$betterTokenIterator = $this->tokenIteratorFactory->createFromTokenIterator($tokenIterator);
|
||||
$startPosition = $betterTokenIterator->currentPosition();
|
||||
$typeNode = parent::parse($betterTokenIterator);
|
||||
$endPosition = $betterTokenIterator->currentPosition();
|
||||
$startAndEnd = new StartAndEnd($startPosition, $endPosition);
|
||||
$typeNode->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
$startAndEnd = new \Rector\BetterPhpDocParser\ValueObject\StartAndEnd($startPosition, $endPosition);
|
||||
$typeNode->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
return $typeNode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocParser;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocParser;
|
||||
|
||||
use RectorPrefix20220606\PhpParser\Node;
|
||||
use RectorPrefix20220606\PhpParser\Node\Identifier;
|
||||
use RectorPrefix20220606\PhpParser\Node\Stmt\GroupUse;
|
||||
use RectorPrefix20220606\PhpParser\Node\Stmt\Use_;
|
||||
use RectorPrefix20220606\PHPStan\Analyser\Scope;
|
||||
use RectorPrefix20220606\PHPStan\Reflection\ReflectionProvider;
|
||||
use RectorPrefix20220606\Rector\CodingStyle\NodeAnalyzer\UseImportNameMatcher;
|
||||
use RectorPrefix20220606\Rector\Naming\Naming\UseImportsResolver;
|
||||
use RectorPrefix20220606\Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Stmt\GroupUse;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use Rector\CodingStyle\NodeAnalyzer\UseImportNameMatcher;
|
||||
use Rector\Naming\Naming\UseImportsResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
/**
|
||||
* Matches "@ORM\Entity" to FQN names based on use imports in the file
|
||||
*/
|
||||
|
@ -36,21 +36,21 @@ final class ClassAnnotationMatcher
|
|||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
public function __construct(UseImportNameMatcher $useImportNameMatcher, UseImportsResolver $useImportsResolver, ReflectionProvider $reflectionProvider)
|
||||
public function __construct(\Rector\CodingStyle\NodeAnalyzer\UseImportNameMatcher $useImportNameMatcher, \Rector\Naming\Naming\UseImportsResolver $useImportsResolver, \PHPStan\Reflection\ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->useImportNameMatcher = $useImportNameMatcher;
|
||||
$this->useImportsResolver = $useImportsResolver;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
}
|
||||
public function resolveTagToKnownFullyQualifiedName(string $tag, Node $node) : ?string
|
||||
public function resolveTagToKnownFullyQualifiedName(string $tag, \PhpParser\Node $node) : ?string
|
||||
{
|
||||
return $this->_resolveTagFullyQualifiedName($tag, $node, \true);
|
||||
}
|
||||
public function resolveTagFullyQualifiedName(string $tag, Node $node) : ?string
|
||||
public function resolveTagFullyQualifiedName(string $tag, \PhpParser\Node $node) : ?string
|
||||
{
|
||||
return $this->_resolveTagFullyQualifiedName($tag, $node, \false);
|
||||
}
|
||||
private function _resolveTagFullyQualifiedName(string $tag, Node $node, bool $returnNullOnUnknownClass) : ?string
|
||||
private function _resolveTagFullyQualifiedName(string $tag, \PhpParser\Node $node, bool $returnNullOnUnknownClass) : ?string
|
||||
{
|
||||
$uniqueHash = $tag . \spl_object_hash($node);
|
||||
if (isset($this->fullyQualifiedNameByHash[$uniqueHash])) {
|
||||
|
@ -71,10 +71,10 @@ final class ClassAnnotationMatcher
|
|||
/**
|
||||
* @param Use_[]|GroupUse[] $uses
|
||||
*/
|
||||
private function resolveFullyQualifiedClass(array $uses, Node $node, string $tag, bool $returnNullOnUnknownClass) : ?string
|
||||
private function resolveFullyQualifiedClass(array $uses, \PhpParser\Node $node, string $tag, bool $returnNullOnUnknownClass) : ?string
|
||||
{
|
||||
$scope = $node->getAttribute(AttributeKey::SCOPE);
|
||||
if ($scope instanceof Scope) {
|
||||
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
|
||||
if ($scope instanceof \PHPStan\Analyser\Scope) {
|
||||
$namespace = $scope->getNamespace();
|
||||
if ($namespace !== null) {
|
||||
$namespacedTag = $namespace . '\\' . $tag;
|
||||
|
@ -99,9 +99,9 @@ final class ClassAnnotationMatcher
|
|||
private function resolveAsAliased(array $uses, string $tag, bool $returnNullOnUnknownClass) : ?string
|
||||
{
|
||||
foreach ($uses as $use) {
|
||||
$prefix = $use instanceof GroupUse ? $use->prefix . '\\' : '';
|
||||
$prefix = $use instanceof \PhpParser\Node\Stmt\GroupUse ? $use->prefix . '\\' : '';
|
||||
foreach ($use->uses as $useUse) {
|
||||
if (!$useUse->alias instanceof Identifier) {
|
||||
if (!$useUse->alias instanceof \PhpParser\Node\Identifier) {
|
||||
continue;
|
||||
}
|
||||
if ($useUse->alias->toString() === $tag) {
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocParser;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocParser;
|
||||
|
||||
use RectorPrefix20220606\PhpParser\Node as PhpNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\ConstExpr\ConstFetchNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use RectorPrefix20220606\Rector\StaticTypeMapper\Naming\NameScopeFactory;
|
||||
use PhpParser\Node as PhpNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstFetchNode;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use Rector\StaticTypeMapper\Naming\NameScopeFactory;
|
||||
use RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser;
|
||||
/**
|
||||
* Decorate node with fully qualified class name for const epxr,
|
||||
* e.g. Direction::*
|
||||
*/
|
||||
final class ConstExprClassNameDecorator implements PhpDocNodeDecoratorInterface
|
||||
final class ConstExprClassNameDecorator implements \Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
|
@ -28,28 +28,28 @@ final class ConstExprClassNameDecorator implements PhpDocNodeDecoratorInterface
|
|||
* @var \Symplify\Astral\PhpDocParser\PhpDocNodeTraverser
|
||||
*/
|
||||
private $phpDocNodeTraverser;
|
||||
public function __construct(NameScopeFactory $nameScopeFactory, PhpDocNodeTraverser $phpDocNodeTraverser)
|
||||
public function __construct(\Rector\StaticTypeMapper\Naming\NameScopeFactory $nameScopeFactory, \RectorPrefix20220606\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser $phpDocNodeTraverser)
|
||||
{
|
||||
$this->nameScopeFactory = $nameScopeFactory;
|
||||
$this->phpDocNodeTraverser = $phpDocNodeTraverser;
|
||||
}
|
||||
public function decorate(PhpDocNode $phpDocNode, PhpNode $phpNode) : void
|
||||
public function decorate(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode, \PhpParser\Node $phpNode) : void
|
||||
{
|
||||
$this->phpDocNodeTraverser->traverseWithCallable($phpDocNode, '', function (Node $node) use($phpNode) {
|
||||
if (!$node instanceof ConstExprNode) {
|
||||
$this->phpDocNodeTraverser->traverseWithCallable($phpDocNode, '', function (\PHPStan\PhpDocParser\Ast\Node $node) use($phpNode) {
|
||||
if (!$node instanceof \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode) {
|
||||
return null;
|
||||
}
|
||||
$className = $this->resolveFullyQualifiedClass($node, $phpNode);
|
||||
if ($className === null) {
|
||||
return null;
|
||||
}
|
||||
$node->setAttribute(PhpDocAttributeKey::RESOLVED_CLASS, $className);
|
||||
$node->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::RESOLVED_CLASS, $className);
|
||||
return $node;
|
||||
});
|
||||
}
|
||||
private function resolveFullyQualifiedClass(ConstExprNode $constExprNode, PhpNode $phpNode) : ?string
|
||||
private function resolveFullyQualifiedClass(\PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode $constExprNode, \PhpParser\Node $phpNode) : ?string
|
||||
{
|
||||
if (!$constExprNode instanceof ConstFetchNode) {
|
||||
if (!$constExprNode instanceof \PHPStan\PhpDocParser\Ast\ConstExpr\ConstFetchNode) {
|
||||
return null;
|
||||
}
|
||||
$nameScope = $this->nameScopeFactory->createNameScopeFromNodeWithoutTemplateTypes($phpNode);
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocParser;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocParser;
|
||||
|
||||
use RectorPrefix20220606\Nette\Utils\Strings;
|
||||
use RectorPrefix20220606\PhpParser\Node;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use RectorPrefix20220606\PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\DoctrineAnnotation\SilentKeyMap;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use RectorPrefix20220606\Rector\Core\Util\StringUtils;
|
||||
final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
||||
use PhpParser\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory;
|
||||
use Rector\BetterPhpDocParser\ValueObject\DoctrineAnnotation\SilentKeyMap;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use Rector\Core\Util\StringUtils;
|
||||
final class DoctrineAnnotationDecorator implements \Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface
|
||||
{
|
||||
/**
|
||||
* Special short annotations, that are resolved as FQN by Doctrine annotation parser
|
||||
|
@ -58,14 +58,14 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
|||
* @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer
|
||||
*/
|
||||
private $attributeMirrorer;
|
||||
public function __construct(ClassAnnotationMatcher $classAnnotationMatcher, StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser, TokenIteratorFactory $tokenIteratorFactory, AttributeMirrorer $attributeMirrorer)
|
||||
public function __construct(\Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher $classAnnotationMatcher, \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser, \Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory $tokenIteratorFactory, \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer $attributeMirrorer)
|
||||
{
|
||||
$this->classAnnotationMatcher = $classAnnotationMatcher;
|
||||
$this->staticDoctrineAnnotationParser = $staticDoctrineAnnotationParser;
|
||||
$this->tokenIteratorFactory = $tokenIteratorFactory;
|
||||
$this->attributeMirrorer = $attributeMirrorer;
|
||||
}
|
||||
public function decorate(PhpDocNode $phpDocNode, Node $phpNode) : void
|
||||
public function decorate(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode, \PhpParser\Node $phpNode) : void
|
||||
{
|
||||
// merge split doctrine nested tags
|
||||
$this->mergeNestedDoctrineAnnotations($phpDocNode);
|
||||
|
@ -74,17 +74,17 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
|||
/**
|
||||
* Join token iterator with all the following nodes if nested
|
||||
*/
|
||||
private function mergeNestedDoctrineAnnotations(PhpDocNode $phpDocNode) : void
|
||||
private function mergeNestedDoctrineAnnotations(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode) : void
|
||||
{
|
||||
$removedKeys = [];
|
||||
foreach ($phpDocNode->children as $key => $phpDocChildNode) {
|
||||
if (\in_array($key, $removedKeys, \true)) {
|
||||
continue;
|
||||
}
|
||||
if (!$phpDocChildNode instanceof PhpDocTagNode) {
|
||||
if (!$phpDocChildNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode) {
|
||||
continue;
|
||||
}
|
||||
if (!$phpDocChildNode->value instanceof GenericTagValueNode) {
|
||||
if (!$phpDocChildNode->value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode) {
|
||||
continue;
|
||||
}
|
||||
$genericTagValueNode = $phpDocChildNode->value;
|
||||
|
@ -95,21 +95,21 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
|||
break;
|
||||
}
|
||||
$nextPhpDocChildNode = $phpDocNode->children[$key];
|
||||
if ($nextPhpDocChildNode instanceof PhpDocTextNode && StringUtils::isMatch($nextPhpDocChildNode->text, self::NESTED_ANNOTATION_END_REGEX)) {
|
||||
if ($nextPhpDocChildNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode && \Rector\Core\Util\StringUtils::isMatch($nextPhpDocChildNode->text, self::NESTED_ANNOTATION_END_REGEX)) {
|
||||
// @todo how to detect previously opened brackets?
|
||||
// probably local property with holding count of opened brackets
|
||||
$composedContent = $genericTagValueNode->value . \PHP_EOL . $nextPhpDocChildNode->text;
|
||||
$genericTagValueNode->value = $composedContent;
|
||||
$startAndEnd = $this->combineStartAndEnd($phpDocChildNode, $nextPhpDocChildNode);
|
||||
$phpDocChildNode->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
$phpDocChildNode->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
$removedKeys[] = $key;
|
||||
$removedKeys[] = $key + 1;
|
||||
continue;
|
||||
}
|
||||
if (!$nextPhpDocChildNode instanceof PhpDocTagNode) {
|
||||
if (!$nextPhpDocChildNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode) {
|
||||
continue;
|
||||
}
|
||||
if (!$nextPhpDocChildNode->value instanceof GenericTagValueNode) {
|
||||
if (!$nextPhpDocChildNode->value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode) {
|
||||
continue;
|
||||
}
|
||||
if ($this->isClosedContent($genericTagValueNode->value)) {
|
||||
|
@ -119,13 +119,13 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
|||
// cleanup the next from closing
|
||||
$genericTagValueNode->value = $composedContent;
|
||||
$startAndEnd = $this->combineStartAndEnd($phpDocChildNode, $nextPhpDocChildNode);
|
||||
$phpDocChildNode->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
$phpDocChildNode->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
$currentChildValueNode = $phpDocNode->children[$key];
|
||||
if (!$currentChildValueNode instanceof PhpDocTagNode) {
|
||||
if (!$currentChildValueNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode) {
|
||||
continue;
|
||||
}
|
||||
$currentGenericTagValueNode = $currentChildValueNode->value;
|
||||
if (!$currentGenericTagValueNode instanceof GenericTagValueNode) {
|
||||
if (!$currentGenericTagValueNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode) {
|
||||
continue;
|
||||
}
|
||||
$removedKeys[] = $key;
|
||||
|
@ -138,22 +138,22 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
|||
unset($phpDocNode->children[$key]);
|
||||
}
|
||||
}
|
||||
private function transformGenericTagValueNodesToDoctrineAnnotationTagValueNodes(PhpDocNode $phpDocNode, Node $currentPhpNode) : void
|
||||
private function transformGenericTagValueNodesToDoctrineAnnotationTagValueNodes(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $phpDocNode, \PhpParser\Node $currentPhpNode) : void
|
||||
{
|
||||
foreach ($phpDocNode->children as $key => $phpDocChildNode) {
|
||||
// the @\FQN use case
|
||||
if ($phpDocChildNode instanceof PhpDocTextNode) {
|
||||
if ($phpDocChildNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode) {
|
||||
$spacelessPhpDocTagNode = $this->resolveFqnAnnotationSpacelessPhpDocTagNode($phpDocChildNode);
|
||||
if (!$spacelessPhpDocTagNode instanceof SpacelessPhpDocTagNode) {
|
||||
if (!$spacelessPhpDocTagNode instanceof \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode) {
|
||||
continue;
|
||||
}
|
||||
$phpDocNode->children[$key] = $spacelessPhpDocTagNode;
|
||||
continue;
|
||||
}
|
||||
if (!$phpDocChildNode instanceof PhpDocTagNode) {
|
||||
if (!$phpDocChildNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode) {
|
||||
continue;
|
||||
}
|
||||
if (!$phpDocChildNode->value instanceof GenericTagValueNode) {
|
||||
if (!$phpDocChildNode->value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode) {
|
||||
continue;
|
||||
}
|
||||
// known doc tag to annotation class
|
||||
|
@ -181,51 +181,51 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
|||
return \true;
|
||||
}
|
||||
do {
|
||||
if ($composedTokenIterator->isCurrentTokenTypes([Lexer::TOKEN_OPEN_CURLY_BRACKET, Lexer::TOKEN_OPEN_PARENTHESES]) || \strpos($composedTokenIterator->currentTokenValue(), '(') !== \false) {
|
||||
if ($composedTokenIterator->isCurrentTokenTypes([\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_OPEN_CURLY_BRACKET, \PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_OPEN_PARENTHESES]) || \strpos($composedTokenIterator->currentTokenValue(), '(') !== \false) {
|
||||
++$openBracketCount;
|
||||
}
|
||||
if ($composedTokenIterator->isCurrentTokenTypes([Lexer::TOKEN_CLOSE_CURLY_BRACKET, Lexer::TOKEN_CLOSE_PARENTHESES]) || \strpos($composedTokenIterator->currentTokenValue(), ')') !== \false) {
|
||||
if ($composedTokenIterator->isCurrentTokenTypes([\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_CLOSE_CURLY_BRACKET, \PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_CLOSE_PARENTHESES]) || \strpos($composedTokenIterator->currentTokenValue(), ')') !== \false) {
|
||||
++$closeBracketCount;
|
||||
}
|
||||
$composedTokenIterator->next();
|
||||
} while ($composedTokenIterator->currentPosition() < $tokenCount - 1);
|
||||
return $openBracketCount === $closeBracketCount;
|
||||
}
|
||||
private function createSpacelessPhpDocTagNode(string $tagName, GenericTagValueNode $genericTagValueNode, string $fullyQualifiedAnnotationClass) : SpacelessPhpDocTagNode
|
||||
private function createSpacelessPhpDocTagNode(string $tagName, \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode $genericTagValueNode, string $fullyQualifiedAnnotationClass) : \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode
|
||||
{
|
||||
$formerStartEnd = $genericTagValueNode->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
$formerStartEnd = $genericTagValueNode->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END);
|
||||
return $this->createDoctrineSpacelessPhpDocTagNode($genericTagValueNode->value, $tagName, $fullyQualifiedAnnotationClass, $formerStartEnd);
|
||||
}
|
||||
private function createDoctrineSpacelessPhpDocTagNode(string $annotationContent, string $tagName, string $fullyQualifiedAnnotationClass, StartAndEnd $startAndEnd) : SpacelessPhpDocTagNode
|
||||
private function createDoctrineSpacelessPhpDocTagNode(string $annotationContent, string $tagName, string $fullyQualifiedAnnotationClass, \Rector\BetterPhpDocParser\ValueObject\StartAndEnd $startAndEnd) : \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode
|
||||
{
|
||||
$nestedTokenIterator = $this->tokenIteratorFactory->create($annotationContent);
|
||||
// mimics doctrine behavior just in phpdoc-parser syntax :)
|
||||
// https://github.com/doctrine/annotations/blob/c66f06b7c83e9a2a7523351a9d5a4b55f885e574/lib/Doctrine/Common/Annotations/DocParser.php#L742
|
||||
$values = $this->staticDoctrineAnnotationParser->resolveAnnotationMethodCall($nestedTokenIterator);
|
||||
$identifierTypeNode = new IdentifierTypeNode($tagName);
|
||||
$identifierTypeNode->setAttribute(PhpDocAttributeKey::RESOLVED_CLASS, $fullyQualifiedAnnotationClass);
|
||||
$doctrineAnnotationTagValueNode = new DoctrineAnnotationTagValueNode($identifierTypeNode, $annotationContent, $values, SilentKeyMap::CLASS_NAMES_TO_SILENT_KEYS[$fullyQualifiedAnnotationClass] ?? null);
|
||||
$doctrineAnnotationTagValueNode->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
return new SpacelessPhpDocTagNode($tagName, $doctrineAnnotationTagValueNode);
|
||||
$identifierTypeNode = new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode($tagName);
|
||||
$identifierTypeNode->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::RESOLVED_CLASS, $fullyQualifiedAnnotationClass);
|
||||
$doctrineAnnotationTagValueNode = new \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode($identifierTypeNode, $annotationContent, $values, \Rector\BetterPhpDocParser\ValueObject\DoctrineAnnotation\SilentKeyMap::CLASS_NAMES_TO_SILENT_KEYS[$fullyQualifiedAnnotationClass] ?? null);
|
||||
$doctrineAnnotationTagValueNode->setAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
return new \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode($tagName, $doctrineAnnotationTagValueNode);
|
||||
}
|
||||
private function combineStartAndEnd(\RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Node $startPhpDocChildNode, PhpDocChildNode $endPhpDocChildNode) : StartAndEnd
|
||||
private function combineStartAndEnd(\PHPStan\PhpDocParser\Ast\Node $startPhpDocChildNode, \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode $endPhpDocChildNode) : \Rector\BetterPhpDocParser\ValueObject\StartAndEnd
|
||||
{
|
||||
/** @var StartAndEnd $currentStartAndEnd */
|
||||
$currentStartAndEnd = $startPhpDocChildNode->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
$currentStartAndEnd = $startPhpDocChildNode->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END);
|
||||
/** @var StartAndEnd $nextStartAndEnd */
|
||||
$nextStartAndEnd = $endPhpDocChildNode->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
return new StartAndEnd($currentStartAndEnd->getStart(), $nextStartAndEnd->getEnd());
|
||||
$nextStartAndEnd = $endPhpDocChildNode->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END);
|
||||
return new \Rector\BetterPhpDocParser\ValueObject\StartAndEnd($currentStartAndEnd->getStart(), $nextStartAndEnd->getEnd());
|
||||
}
|
||||
private function resolveFqnAnnotationSpacelessPhpDocTagNode(PhpDocTextNode $phpDocTextNode) : ?SpacelessPhpDocTagNode
|
||||
private function resolveFqnAnnotationSpacelessPhpDocTagNode(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode $phpDocTextNode) : ?\Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode
|
||||
{
|
||||
$match = Strings::match($phpDocTextNode->text, self::LONG_ANNOTATION_REGEX);
|
||||
$match = \RectorPrefix20220606\Nette\Utils\Strings::match($phpDocTextNode->text, self::LONG_ANNOTATION_REGEX);
|
||||
$fullyQualifiedAnnotationClass = $match['class_name'] ?? null;
|
||||
if ($fullyQualifiedAnnotationClass === null) {
|
||||
return null;
|
||||
}
|
||||
$annotationContent = $match['annotation_content'] ?? null;
|
||||
$tagName = '@\\' . $fullyQualifiedAnnotationClass;
|
||||
$formerStartEnd = $phpDocTextNode->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
$formerStartEnd = $phpDocTextNode->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::START_AND_END);
|
||||
return $this->createDoctrineSpacelessPhpDocTagNode($annotationContent, $tagName, $fullyQualifiedAnnotationClass, $formerStartEnd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocParser;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocParser;
|
||||
|
||||
use RectorPrefix20220606\PhpParser\Node\ComplexType;
|
||||
use RectorPrefix20220606\PhpParser\Node\Expr\ArrowFunction;
|
||||
use RectorPrefix20220606\PhpParser\Node\Expr\Closure;
|
||||
use RectorPrefix20220606\PhpParser\Node\Identifier;
|
||||
use RectorPrefix20220606\PhpParser\Node\Name;
|
||||
use RectorPrefix20220606\PhpParser\Node\Param;
|
||||
use RectorPrefix20220606\PhpParser\Node\Stmt\Class_;
|
||||
use RectorPrefix20220606\PhpParser\Node\Stmt\ClassLike;
|
||||
use RectorPrefix20220606\PhpParser\Node\Stmt\ClassMethod;
|
||||
use RectorPrefix20220606\PhpParser\Node\Stmt\Function_;
|
||||
use RectorPrefix20220606\PhpParser\Node\Stmt\Interface_;
|
||||
use RectorPrefix20220606\PHPStan\Type\ObjectType;
|
||||
use RectorPrefix20220606\PHPStan\Type\Type;
|
||||
use RectorPrefix20220606\PHPStan\Type\UnionType;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use RectorPrefix20220606\Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
|
||||
use RectorPrefix20220606\Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use RectorPrefix20220606\Rector\NodeNameResolver\NodeNameResolver;
|
||||
use RectorPrefix20220606\Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
|
||||
use RectorPrefix20220606\Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory;
|
||||
use RectorPrefix20220606\Rector\PHPStanStaticTypeMapper\Utils\TypeUnwrapper;
|
||||
use RectorPrefix20220606\Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use ReturnTypeWillChange;
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Expr\ArrowFunction;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\Node\Stmt\Interface_;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
|
||||
use Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory;
|
||||
use Rector\PHPStanStaticTypeMapper\Utils\TypeUnwrapper;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use RectorPrefix20220606\ReturnTypeWillChange;
|
||||
/**
|
||||
* @see https://wiki.php.net/rfc/internal_method_return_types#proposal
|
||||
*/
|
||||
|
@ -79,7 +79,7 @@ final class PhpDocFromTypeDeclarationDecorator
|
|||
* @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer
|
||||
*/
|
||||
private $phpAttributeAnalyzer;
|
||||
public function __construct(StaticTypeMapper $staticTypeMapper, PhpDocInfoFactory $phpDocInfoFactory, NodeNameResolver $nodeNameResolver, PhpDocTypeChanger $phpDocTypeChanger, TypeUnwrapper $typeUnwrapper, BetterNodeFinder $betterNodeFinder, PhpAttributeGroupFactory $phpAttributeGroupFactory, PhpAttributeAnalyzer $phpAttributeAnalyzer)
|
||||
public function __construct(\Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger $phpDocTypeChanger, \Rector\PHPStanStaticTypeMapper\Utils\TypeUnwrapper $typeUnwrapper, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory $phpAttributeGroupFactory, \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer $phpAttributeAnalyzer)
|
||||
{
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
|
@ -102,11 +102,11 @@ final class PhpDocFromTypeDeclarationDecorator
|
|||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($functionLike);
|
||||
$this->phpDocTypeChanger->changeReturnType($phpDocInfo, $type);
|
||||
$functionLike->returnType = null;
|
||||
if (!$functionLike instanceof ClassMethod) {
|
||||
if (!$functionLike instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
return;
|
||||
}
|
||||
$classLike = $this->betterNodeFinder->findParentByTypes($functionLike, [Class_::class, Interface_::class]);
|
||||
if (!$classLike instanceof ClassLike) {
|
||||
$classLike = $this->betterNodeFinder->findParentByTypes($functionLike, [\PhpParser\Node\Stmt\Class_::class, \PhpParser\Node\Stmt\Interface_::class]);
|
||||
if (!$classLike instanceof \PhpParser\Node\Stmt\ClassLike) {
|
||||
return;
|
||||
}
|
||||
if (!$this->isRequireReturnTypeWillChange(\get_class($type), $classLike, $functionLike)) {
|
||||
|
@ -119,7 +119,7 @@ final class PhpDocFromTypeDeclarationDecorator
|
|||
* @param array<class-string<Type>> $requiredTypes
|
||||
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike
|
||||
*/
|
||||
public function decorateParam(Param $param, $functionLike, array $requiredTypes) : void
|
||||
public function decorateParam(\PhpParser\Node\Param $param, $functionLike, array $requiredTypes) : void
|
||||
{
|
||||
if ($param->type === null) {
|
||||
return;
|
||||
|
@ -133,7 +133,7 @@ final class PhpDocFromTypeDeclarationDecorator
|
|||
/**
|
||||
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike
|
||||
*/
|
||||
public function decorateParamWithSpecificType(Param $param, $functionLike, Type $requireType) : void
|
||||
public function decorateParamWithSpecificType(\PhpParser\Node\Param $param, $functionLike, \PHPStan\Type\Type $requireType) : void
|
||||
{
|
||||
if ($param->type === null) {
|
||||
return;
|
||||
|
@ -148,7 +148,7 @@ final class PhpDocFromTypeDeclarationDecorator
|
|||
* @return bool True if node was changed
|
||||
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike
|
||||
*/
|
||||
public function decorateReturnWithSpecificType($functionLike, Type $requireType) : bool
|
||||
public function decorateReturnWithSpecificType($functionLike, \PHPStan\Type\Type $requireType) : bool
|
||||
{
|
||||
if ($functionLike->returnType === null) {
|
||||
return \false;
|
||||
|
@ -159,16 +159,16 @@ final class PhpDocFromTypeDeclarationDecorator
|
|||
$this->decorate($functionLike);
|
||||
return \true;
|
||||
}
|
||||
private function isRequireReturnTypeWillChange(string $type, ClassLike $classLike, ClassMethod $classMethod) : bool
|
||||
private function isRequireReturnTypeWillChange(string $type, \PhpParser\Node\Stmt\ClassLike $classLike, \PhpParser\Node\Stmt\ClassMethod $classMethod) : bool
|
||||
{
|
||||
if (!\array_key_exists($type, self::ADD_RETURN_TYPE_WILL_CHANGE)) {
|
||||
return \false;
|
||||
}
|
||||
$className = (string) $this->nodeNameResolver->getName($classLike);
|
||||
$objectClass = new ObjectType($className);
|
||||
$objectClass = new \PHPStan\Type\ObjectType($className);
|
||||
$methodName = $this->nodeNameResolver->getName($classMethod);
|
||||
foreach (self::ADD_RETURN_TYPE_WILL_CHANGE[$type] as $class => $methods) {
|
||||
$objectClassConfig = new ObjectType($class);
|
||||
$objectClassConfig = new \PHPStan\Type\ObjectType($class);
|
||||
if (!$objectClassConfig->isSuperTypeOf($objectClass)->yes()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -185,14 +185,14 @@ final class PhpDocFromTypeDeclarationDecorator
|
|||
/**
|
||||
* @param \PhpParser\Node\ComplexType|\PhpParser\Node\Identifier|\PhpParser\Node\Name $typeNode
|
||||
*/
|
||||
private function isTypeMatch($typeNode, Type $requireType) : bool
|
||||
private function isTypeMatch($typeNode, \PHPStan\Type\Type $requireType) : bool
|
||||
{
|
||||
$returnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($typeNode);
|
||||
// cover nullable union types
|
||||
if ($returnType instanceof UnionType) {
|
||||
if ($returnType instanceof \PHPStan\Type\UnionType) {
|
||||
$returnType = $this->typeUnwrapper->unwrapNullableType($returnType);
|
||||
}
|
||||
if ($returnType instanceof ObjectType) {
|
||||
if ($returnType instanceof \PHPStan\Type\ObjectType) {
|
||||
return $returnType->equals($requireType);
|
||||
}
|
||||
return \get_class($returnType) === \get_class($requireType);
|
||||
|
@ -200,7 +200,7 @@ final class PhpDocFromTypeDeclarationDecorator
|
|||
/**
|
||||
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike
|
||||
*/
|
||||
private function moveParamTypeToParamDoc($functionLike, Param $param, Type $type) : void
|
||||
private function moveParamTypeToParamDoc($functionLike, \PhpParser\Node\Param $param, \PHPStan\Type\Type $type) : void
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($functionLike);
|
||||
$paramName = $this->nodeNameResolver->getName($param);
|
||||
|
@ -210,7 +210,7 @@ final class PhpDocFromTypeDeclarationDecorator
|
|||
/**
|
||||
* @param array<class-string<Type>> $requiredTypes
|
||||
*/
|
||||
private function isMatchingType(Type $type, array $requiredTypes) : bool
|
||||
private function isMatchingType(\PHPStan\Type\Type $type, array $requiredTypes) : bool
|
||||
{
|
||||
return \in_array(\get_class($type), $requiredTypes, \true);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue