[PHP 8] Add Nette\Utils\Strings to string functions (#6)

* [PHP 8] Add nette utils strings to functions

* remove AnnotationToAttributeRector without any config
This commit is contained in:
Tomas Votruba 2021-05-11 00:20:41 +02:00 committed by GitHub
parent a80cf5292d
commit 2deebfe7eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,6 @@ use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
use Rector\Arguments\ValueObject\ArgumentAdder;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
use Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector;
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\Class_\StringableForToStringRector;
use Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector;
@ -21,17 +20,29 @@ 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;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(UnionTypesRector::class);
$services->set(StrContainsRector::class);
$services->set(StrStartsWithRector::class);
$services->set(StrEndsWithRector::class);
$services->set(StaticCallToFuncCallRector::class)
->call('configure', [
StaticCallToFuncCallRector::STATIC_CALLS_TO_FUNCTIONS => ValueObjectInliner::inline([
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'),
]),
]);
$services->set(StringableForToStringRector::class);
$services->set(AnnotationToAttributeRector::class);
$services->set(ClassOnObjectRector::class);
$services->set(GetDebugTypeRector::class);
$services->set(TokenGetAllToObjectRector::class);