mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 11:50:51 +00:00
[Nette] Decouple to own package (#5903)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
This commit is contained in:
parent
9d5e99cf74
commit
21db1e9e38
7
.github/workflows/rector.yaml
vendored
7
.github/workflows/rector.yaml
vendored
|
@ -29,14 +29,9 @@ jobs:
|
|||
- packages-tests
|
||||
- src
|
||||
- tests
|
||||
- rules
|
||||
- rules-tests
|
||||
|
||||
- rules/Arguments rules/Autodiscovery rules/CakePHP rules/Carbon rules/CodeQuality rules/CodeQualityStrict rules/CodingStyle rules/Composer rules/DeadCode rules/DeadDocBlock rules/Defluent
|
||||
- rules/DependencyInjection rules/Doctrine rules/DoctrineCodeQuality rules/DoctrineGedmoToKnplabs rules/DowngradePhp70 rules/DowngradePhp71 rules/DowngradePhp72 rules/DowngradePhp73 rules/DowngradePhp74 rules/DowngradePhp80
|
||||
- rules/EarlyReturn rules/Generics rules/Laravel rules/MockeryToProphecy rules/MysqlToMysqli rules/Naming rules/Nette rules/NetteCodeQuality rules/NetteKdyby rules/NetteTesterToPHPUnit rules/NetteToSymfony rules/Order
|
||||
- rules/Php52 rules/Php53 rules/Php54 rules/Php55 rules/Php56 rules/Php70 rules/Php71 rules/Php72 rules/Php73 rules/Php74 rules/Php80 rules/PHPOffice rules/PhpSpecToPHPUnit rules/PHPUnit
|
||||
- rules/Privatization rules/PSR4 rules/Removing rules/RemovingStatic rules/Renaming rules/Restoration rules/Transform rules/TypeDeclaration rules/Visibility
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# workaround for missing secret in fork PRs - see https://github.com/actions/checkout/issues/298
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
"phpstan/phpstan": "^0.12.81",
|
||||
"phpstan/phpstan-phpunit": "^0.12.18",
|
||||
"rector/rector-symfony": "dev-main",
|
||||
"rector/rector-nette": "dev-main",
|
||||
"sebastian/diff": "^4.0.4",
|
||||
"symfony/console": "^4.4.8|^5.1",
|
||||
"symfony/dependency-injection": "^5.1",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
|
@ -12,9 +13,16 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
// rector root
|
||||
$containerConfigurator->import(__DIR__ . '/../vendor/rector/rector-symfony/config/config.php', null, 'not_found');
|
||||
$containerConfigurator->import(__DIR__ . '/../vendor/rector/rector-nette/config/config.php', null, 'not_found');
|
||||
// rector sub-package
|
||||
$containerConfigurator->import(__DIR__ . '/../../rector-symfony/config/config.php', null, 'not_found');
|
||||
$containerConfigurator->import(__DIR__ . '/../../rector-nette/config/config.php', null, 'not_found');
|
||||
|
||||
// require only in dev
|
||||
$containerConfigurator->import(__DIR__ . '/../utils/compiler/config/config.php', null, 'not_found');
|
||||
|
||||
|
||||
// to override extension-loaded config
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, getcwd() . '/phpstan-for-rector.neon');
|
||||
};
|
||||
|
|
|
@ -9,7 +9,6 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, getcwd() . '/phpstan-for-rector.neon');
|
||||
|
||||
// paths and extensions
|
||||
$parameters->set(Option::PATHS, []);
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Transform\Rector\Class_\ParentClassToTraitsRector;
|
||||
use Rector\Transform\ValueObject\ParentClassToTraits;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
// @see https://doc.nette.org/en/2.4/migration-2-4#toc-nette-smartobject
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ParentClassToTraitsRector::class)
|
||||
->call('configure', [[
|
||||
ParentClassToTraitsRector::PARENT_CLASS_TO_TRAITS => ValueObjectInliner::inline([
|
||||
new ParentClassToTraits('Nette\Object', ['Nette\SmartObject']),
|
||||
]),
|
||||
]]);
|
||||
};
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Composer\Rector\ChangePackageVersionComposerRector;
|
||||
use Rector\Composer\Rector\RemovePackageComposerRector;
|
||||
use Rector\Composer\Rector\ReplacePackageAndVersionComposerRector;
|
||||
use Rector\Composer\ValueObject\PackageAndVersion;
|
||||
use Rector\Composer\ValueObject\ReplacePackageAndVersion;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ChangePackageVersionComposerRector::class)
|
||||
->call('configure', [[
|
||||
ChangePackageVersionComposerRector::PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new PackageAndVersion('nette/nette', '^3.0'),
|
||||
// https://github.com/nette/nette/blob/v2.4.0/composer.json vs https://github.com/nette/nette/blob/v3.0.0/composer.json
|
||||
// older versions have security issues
|
||||
new PackageAndVersion('nette/application', '^3.0.6'),
|
||||
new PackageAndVersion('nette/bootstrap', '^3.0'),
|
||||
new PackageAndVersion('nette/caching', '^3.0'),
|
||||
new PackageAndVersion('nette/component-model', '^3.0'),
|
||||
new PackageAndVersion('nette/database', '^3.0'),
|
||||
new PackageAndVersion('nette/di', '^3.0'),
|
||||
new PackageAndVersion('nette/finder', '^2.5'),
|
||||
new PackageAndVersion('nette/forms', '^3.0'),
|
||||
new PackageAndVersion('nette/http', '^3.0'),
|
||||
new PackageAndVersion('nette/mail', '^3.0'),
|
||||
new PackageAndVersion('nette/neon', '^3.0'),
|
||||
new PackageAndVersion('nette/php-generator', '^3.0'),
|
||||
new PackageAndVersion('nette/robot-loader', '^3.0'),
|
||||
new PackageAndVersion('nette/safe-stream', '^2.4'),
|
||||
new PackageAndVersion('nette/security', '^3.0'),
|
||||
new PackageAndVersion('nette/tokenizer', '^3.0'),
|
||||
new PackageAndVersion('nette/utils', '^3.0'),
|
||||
new PackageAndVersion('latte/latte', '^2.5'),
|
||||
new PackageAndVersion('tracy/tracy', '^2.6'),
|
||||
|
||||
// contributte packages
|
||||
new PackageAndVersion('contributte/event-dispatcher-extra', '^0.8'),
|
||||
new PackageAndVersion('contributte/forms-multiplier', '3.1.x-dev'),
|
||||
// other packages
|
||||
new PackageAndVersion('radekdostal/nette-datetimepicker', '^3.0'),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(RemovePackageComposerRector::class)
|
||||
->call('configure', [[
|
||||
RemovePackageComposerRector::PACKAGE_NAMES => ['nette/deprecated', 'nette/reflection'],
|
||||
]]);
|
||||
|
||||
$services->set(ReplacePackageAndVersionComposerRector::class)
|
||||
->call('configure', [[
|
||||
ReplacePackageAndVersionComposerRector::REPLACE_PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
// webchemistry to contributte
|
||||
new ReplacePackageAndVersion(
|
||||
'webchemistry/forms-multiplier',
|
||||
'contributte/forms-multiplier',
|
||||
'3.1.x-dev'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
};
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Nette\Rector\MethodCall\BuilderExpandToHelperExpandRector;
|
||||
use Rector\Nette\Rector\MethodCall\SetClassWithArgumentToSetFactoryRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(SetClassWithArgumentToSetFactoryRector::class);
|
||||
$services->set(BuilderExpandToHelperExpandRector::class);
|
||||
};
|
|
@ -1,129 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use PHPStan\Type\BooleanType;
|
||||
use PHPStan\Type\CallableType;
|
||||
use PHPStan\Type\IntegerType;
|
||||
use PHPStan\Type\IterableType;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\NullType;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\StringType;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Nette\Rector\ClassMethod\TranslateClassMethodToVariadicsRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(TranslateClassMethodToVariadicsRector::class);
|
||||
|
||||
# scalar type hints, see https://github.com/nette/component-model/commit/f69df2ca224cad7b07f1c8835679393263ea6771
|
||||
# scalar param types https://github.com/nette/security/commit/84024f612fb3f55f5d6e3e3e28eef1ad0388fa56
|
||||
|
||||
$iterableType = new IterableType(new MixedType(), new MixedType());
|
||||
|
||||
$services->set(AddParamTypeDeclarationRector::class)
|
||||
->call('configure', [[
|
||||
AddParamTypeDeclarationRector::PARAMETER_TYPEHINTS => ValueObjectInliner::inline([
|
||||
new AddParamTypeDeclaration(
|
||||
'Nette\ComponentModel\Component',
|
||||
'lookup',
|
||||
0,
|
||||
new UnionType([new StringType(), new NullType()])
|
||||
),
|
||||
new AddParamTypeDeclaration('Nette\ComponentModel\Component', 'lookup', 1, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Nette\ComponentModel\Component', 'lookupPath', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\ComponentModel\Component', 'lookupPath', 1, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Nette\ComponentModel\Component', 'monitor', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\ComponentModel\Component', 'unmonitor', 0, new StringType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Nette\ComponentModel\Component',
|
||||
'attached',
|
||||
0,
|
||||
new ObjectType('Nette\ComponentModel\IComponent')
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Nette\ComponentModel\Component',
|
||||
'detached',
|
||||
0,
|
||||
new ObjectType('Nette\ComponentModel\IComponent')
|
||||
),
|
||||
new AddParamTypeDeclaration('Nette\ComponentModel\Component', 'link', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\ComponentModel\Container', 'getComponent', 1, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Nette\ComponentModel\Container', 'createComponent', 0, new StringType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Nette\ComponentModel\IComponent',
|
||||
'setParent',
|
||||
0,
|
||||
new UnionType([new ObjectType('Nette\ComponentModel\IContainer'), new NullType()])
|
||||
),
|
||||
new AddParamTypeDeclaration('Nette\ComponentModel\IComponent', 'setParent', 1, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\ComponentModel\IContainer', 'getComponents', 0, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Nette\Forms\Container', 'addSelect', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Forms\Container', 'addSelect', 3, new IntegerType()),
|
||||
new AddParamTypeDeclaration('Nette\Forms\Container', 'addMultiSelect', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Forms\Container', 'addMultiSelect', 3, new IntegerType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Nette\Forms\Rendering\DefaultFormRenderer',
|
||||
'render',
|
||||
1,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'RadekDostal\NetteComponents\DateTimePicker\DateTimePicker',
|
||||
'register',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Nette\Bridges\SecurityDI\SecurityExtension',
|
||||
MethodName::CONSTRUCT,
|
||||
0,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration('Nette\Security\IUserStorage', 'setAuthenticated', 0, new BooleanType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Nette\Security\IUserStorage',
|
||||
'setIdentity',
|
||||
0,
|
||||
new UnionType([new ObjectType('Nette\Security\IIdentity'), new NullType()])
|
||||
),
|
||||
new AddParamTypeDeclaration('Nette\Security\IUserStorage', 'setExpiration', 1, new IntegerType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Identity', MethodName::CONSTRUCT, 2, $iterableType),
|
||||
new AddParamTypeDeclaration('Nette\Security\Identity', '__set', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Identity', '&__get', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Identity', '__isset', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Passwords', 'hash', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Passwords', 'verify', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Passwords', 'verify', 1, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Passwords', 'needsRehash', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'addRole', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'hasRole', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'getRoleParents', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'removeRole', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'addResource', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'addResource', 1, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'hasResource', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'resourceInheritsFrom', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'resourceInheritsFrom', 1, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'resourceInheritsFrom', 2, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'removeResource', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'allow', 3, new CallableType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'deny', 3, new CallableType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'setRule', 0, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'setRule', 1, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\Permission', 'setRule', 5, new CallableType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\User', 'logout', 0, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\User', 'getAuthenticator', 0, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\User', 'isInRole', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\User', 'getAuthorizator', 0, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Nette\Security\User', 'getAuthorizator', 1, new StringType()),
|
||||
]),
|
||||
]]);
|
||||
};
|
|
@ -1,581 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use PHPStan\Type\ArrayType;
|
||||
use PHPStan\Type\BooleanType;
|
||||
use PHPStan\Type\IntegerType;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\NullType;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\StringType;
|
||||
use PHPStan\Type\UnionType;
|
||||
use PHPStan\Type\VoidType;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
# scalar type hints, see https://github.com/nette/security/commit/84024f612fb3f55f5d6e3e3e28eef1ad0388fa56
|
||||
$arrayType = new ArrayType(new MixedType(), new MixedType());
|
||||
|
||||
$services->set(AddReturnTypeDeclarationRector::class)
|
||||
->call('configure', [[
|
||||
AddReturnTypeDeclarationRector::METHOD_RETURN_TYPES => ValueObjectInliner::inline([
|
||||
new AddReturnTypeDeclaration('Nette\Mail\Mailer', 'send', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Forms\Rendering\DefaultFormRenderer',
|
||||
'renderControl',
|
||||
new ObjectType('Nette\Utils\Html')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Forms\Container',
|
||||
'addContainer',
|
||||
new ObjectType('Nette\Forms\Container')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Forms\Container',
|
||||
'addSelect',
|
||||
new ObjectType('Nette\Forms\Controls\SelectBox')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Forms\Container',
|
||||
'addMultiSelect',
|
||||
new ObjectType('Nette\Forms\Controls\MultiSelectBox')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Forms\IFormRenderer', 'render', new StringType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Forms\Controls\TextBase',
|
||||
'getControl',
|
||||
new ObjectType('Nette\Utils\Html')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'RadekDostal\NetteComponents\DateTimePicker\DateTimePicker',
|
||||
'register',
|
||||
new VoidType()
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Caching\Cache', 'generateKey', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Localization\ITranslator', 'translate', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Security\IResource', 'getResourceId', new StringType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Security\IAuthenticator',
|
||||
'authenticate',
|
||||
new ObjectType('Nette\Security\IIdentity')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Security\IAuthorizator', 'isAllowed', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Security\Identity', 'getData', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Security\IIdentity', 'getRoles', $arrayType),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Security\User',
|
||||
'getStorage',
|
||||
new ObjectType('Nette\Security\IUserStorage')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Security\User', 'login', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Security\User', 'logout', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Security\User', 'isLoggedIn', new BooleanType()),
|
||||
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Security\User',
|
||||
'getIdentity',
|
||||
new UnionType([new ObjectType('Nette\Security\IIdentity'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Security\User',
|
||||
'getAuthenticator',
|
||||
new UnionType([new ObjectType('Nette\Security\IAuthenticator'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Security\User',
|
||||
'getAuthorizator',
|
||||
new UnionType([new ObjectType('Nette\Security\IAuthorizator'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Security\User', 'getLogoutReason',
|
||||
new UnionType([new IntegerType(), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Security\User', 'getRoles', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Security\User', 'isInRole', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Security\User', 'isAllowed', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Security\IUserStorage', 'isAuthenticated', new BooleanType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Security\IUserStorage',
|
||||
'getIdentity',
|
||||
new UnionType([new ObjectType('Nette\Security\IIdentity'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Security\IUserStorage',
|
||||
'getLogoutReason',
|
||||
new UnionType([new IntegerType(), new NullType()])),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\ComponentModel\Component',
|
||||
'lookup',
|
||||
new ObjectType('Nette\ComponentModel\IComponent')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\ComponentModel\Component', 'lookupPath', new UnionType([
|
||||
new StringType(),
|
||||
new NullType(),
|
||||
])),
|
||||
new AddReturnTypeDeclaration('Nette\ComponentModel\Component', 'monitor', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\ComponentModel\Component', 'unmonitor', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\ComponentModel\Component', 'attached', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\ComponentModel\Component', 'detached', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\ComponentModel\Component',
|
||||
'getName',
|
||||
new UnionType([new StringType(), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\ComponentModel\IComponent',
|
||||
'getName',
|
||||
new UnionType([new StringType(), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\ComponentModel\IComponent',
|
||||
'getParent',
|
||||
new UnionType([new ObjectType('Nette\ComponentModel\IContainer'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\ComponentModel\Container', 'removeComponent', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\ComponentModel\Container',
|
||||
'getComponent',
|
||||
new UnionType([new ObjectType('Nette\ComponentModel\IComponent'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\ComponentModel\Container',
|
||||
'createComponent',
|
||||
new UnionType([new ObjectType('Nette\ComponentModel\IComponent'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\ComponentModel\Container', 'getComponents',
|
||||
new ObjectType('Iterator')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\ComponentModel\Container',
|
||||
'validateChildComponent',
|
||||
new VoidType()
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\ComponentModel\Container',
|
||||
'_isCloning',
|
||||
new UnionType([new ObjectType('Nette\ComponentModel\IComponent'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\ComponentModel\IContainer', 'removeComponent', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\ComponentModel\IContainer',
|
||||
'getComponent',
|
||||
new UnionType([new ObjectType('Nette\ComponentModel\IContainer'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\ComponentModel\IContainer', 'getComponents', new ObjectType(
|
||||
'Iterator'
|
||||
)),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Application', 'run', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\Application',
|
||||
'createInitialRequest',
|
||||
new ObjectType('Nette\Application\Request')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Application', 'processRequest', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Application', 'processException', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Application', 'getRequests', $arrayType),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\Application',
|
||||
'getPresenter',
|
||||
new UnionType([new ObjectType('Nette\Application\IPresenter'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\Application',
|
||||
'getRouter',
|
||||
new UnionType([new ObjectType('Nette\Application\IRouter'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\Application',
|
||||
'getPresenterFactory',
|
||||
new UnionType([new ObjectType('Nette\Application\IPresenterFactory'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Helpers', 'splitName', $arrayType),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\IPresenter',
|
||||
'run',
|
||||
new ObjectType('Nette\Application\IResponse')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\IPresenterFactory',
|
||||
'getPresenterClass',
|
||||
new StringType()
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\IPresenterFactory',
|
||||
'createPresenter',
|
||||
new ObjectType('Nette\Application\IPresenter')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\PresenterFactory',
|
||||
'formatPresenterClass',
|
||||
new StringType()
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\PresenterFactory',
|
||||
'unformatPresenterClass',
|
||||
new UnionType([new StringType(), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\IResponse', 'send', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Responses\FileResponse', 'getFile', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Responses\FileResponse', 'getName', new StringType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\Responses\FileResponse',
|
||||
'getContentType',
|
||||
new StringType()
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\Responses\ForwardResponse',
|
||||
'getRequest',
|
||||
new ObjectType('Nette\Application\Request')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Request', 'getPresenterName', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Request', 'getParameters', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Request', 'getFiles', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Request', 'getMethod', new UnionType([
|
||||
new StringType(),
|
||||
new NullType(),
|
||||
])),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Request', 'isMethod', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Request', 'hasFlag', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\RedirectResponse', 'getUrl', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\RedirectResponse', 'getCode', new IntegerType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\JsonResponse', 'getContentType', new StringType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\IRouter',
|
||||
'match',
|
||||
new UnionType([new ObjectType('Nette\Application\Request'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\IRouter', 'constructUrl', new UnionType([
|
||||
new StringType(),
|
||||
new NullType(),
|
||||
])),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Routers\Route', 'getMask', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Routers\Route', 'getDefaults', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Routers\Route', 'getFlags', new IntegerType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\Routers\Route',
|
||||
'getTargetPresenters',
|
||||
new UnionType([$arrayType, new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Routers\RouteList', 'warmupCache', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Routers\RouteList', 'offsetSet', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Routers\RouteList', 'getModule', new UnionType([
|
||||
new StringType(),
|
||||
new NullType(),
|
||||
])),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Routers\CliRouter', 'getDefaults', $arrayType),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Component',
|
||||
'getPresenter',
|
||||
new UnionType([new ObjectType('Nette\Application\UI\Presenter'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'getUniqueId', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'tryCall', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'checkRequirements', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Component',
|
||||
'getReflection',
|
||||
new ObjectType('Nette\Application\UI\ComponentReflection')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'loadState', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'saveState', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'getParameters', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'getParameterId', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'getPersistentParams', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'signalReceived', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'formatSignalMethod', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'link', new StringType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Component',
|
||||
'lazyLink',
|
||||
new ObjectType('Nette\Application\UI\Link')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'isLinkCurrent', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'redirect', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'redirectPermanent', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'offsetSet', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Component',
|
||||
'offsetGet',
|
||||
new ObjectType('Nette\ComponentModel\IComponent')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'offsetExists', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Component', 'offsetUnset', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getRequest',
|
||||
new ObjectType('Nette\Application\Request')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getPresenter',
|
||||
new ObjectType('Nette\Application\UI\Presenter')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'getUniqueId', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'checkRequirements', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'processSignal', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getSignal',
|
||||
new UnionType([$arrayType, new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'isSignalReceiver', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'getAction', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'changeAction', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'getView', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'sendTemplate', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'findLayoutTemplateFile', new UnionType([
|
||||
new StringType(),
|
||||
new NullType(),
|
||||
])),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'formatLayoutTemplateFiles', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'formatTemplateFiles', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'formatActionMethod', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'formatRenderMethod', new StringType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'createTemplate',
|
||||
new ObjectType('Nette\Application\UI\ITemplate')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getPayload',
|
||||
new ObjectType('stdClass')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'isAjax', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'sendPayload', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'sendJson', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'sendResponse', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'terminate', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'forward', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'redirectUrl', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'error', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getLastCreatedRequest',
|
||||
new UnionType([new ObjectType('Nette\Application\Request'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getLastCreatedRequestFlag',
|
||||
new BooleanType()
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'canonicalize', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'lastModified', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'createRequest', new UnionType([
|
||||
new StringType(),
|
||||
new NullType(),
|
||||
])),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'argsToParams', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'handleInvalidLink', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'storeRequest', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'restoreRequest', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'getPersistentComponents', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'getGlobalState', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'saveGlobalState', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'initGlobalParameters', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'popGlobalParameters', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'getFlashKey', new UnionType([
|
||||
new StringType(),
|
||||
new NullType(),
|
||||
])),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Presenter', 'hasFlashSession', new BooleanType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getFlashSession',
|
||||
new ObjectType('Nette\Http\SessionSection')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getContext',
|
||||
new ObjectType('Nette\DI\Container')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getHttpRequest',
|
||||
new ObjectType('Nette\Http\IRequest')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getHttpResponse',
|
||||
new ObjectType('Nette\Http\IResponse')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getUser',
|
||||
new ObjectType('Nette\Security\User')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'getTemplateFactory',
|
||||
new ObjectType('Nette\Application\UI\ITemplateFactory')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\Exception\BadRequestException',
|
||||
'getHttpCode',
|
||||
new IntegerType()
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Bridges\ApplicationDI\LatteExtension', 'addMacro', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Bridges\ApplicationDI\PresenterFactoryCallback',
|
||||
'__invoke',
|
||||
new ObjectType('Nette\Application\IPresenter')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Bridges\ApplicationLatte\ILatteFactory',
|
||||
'create',
|
||||
new ObjectType('Latte\Engine')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Bridges\ApplicationLatte\Template',
|
||||
'getLatte',
|
||||
new ObjectType('Latte\Engine')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Bridges\ApplicationLatte\Template', 'render', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Bridges\ApplicationLatte\Template', '__toString', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Bridges\ApplicationLatte\Template', 'getFile', new UnionType([
|
||||
new StringType(),
|
||||
new NullType(),
|
||||
])),
|
||||
new AddReturnTypeDeclaration('Nette\Bridges\ApplicationLatte\Template', 'getParameters', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Bridges\ApplicationLatte\Template', '__set', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Bridges\ApplicationLatte\Template', '__unset', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Bridges\ApplicationLatte\TemplateFactory',
|
||||
'createTemplate',
|
||||
new ObjectType('Nette\Application\UI\ITemplate')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Bridges\ApplicationLatte\UIMacros', 'initialize', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Bridges\ApplicationTracy\RoutingPanel',
|
||||
'initializePanel',
|
||||
new VoidType()
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Bridges\ApplicationTracy\RoutingPanel', 'getTab', new StringType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Bridges\ApplicationTracy\RoutingPanel',
|
||||
'getPanel',
|
||||
new StringType()
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Bridges\ApplicationLatte\UIRuntime', 'initialize', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\ComponentReflection',
|
||||
'getPersistentParams',
|
||||
$arrayType
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\ComponentReflection',
|
||||
'getPersistentComponents',
|
||||
$arrayType
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\ComponentReflection',
|
||||
'hasCallableMethod',
|
||||
new BooleanType()
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\ComponentReflection', 'combineArgs', $arrayType),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\ComponentReflection',
|
||||
'convertType',
|
||||
new BooleanType()
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\ComponentReflection',
|
||||
'parseAnnotation',
|
||||
new UnionType([$arrayType, new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\ComponentReflection',
|
||||
'getParameterType',
|
||||
$arrayType
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\ComponentReflection',
|
||||
'hasAnnotation',
|
||||
new BooleanType()
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\ComponentReflection', 'getMethods', $arrayType),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Control',
|
||||
'getTemplate',
|
||||
new ObjectType('Nette\Application\UI\ITemplate')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Control',
|
||||
'createTemplate',
|
||||
new ObjectType('Nette\Application\UI\ITemplate')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Control', 'templatePrepareFilters', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Control',
|
||||
'flashMessage',
|
||||
new ObjectType('stdClass')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Control', 'redrawControl', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Control', 'isControlInvalid', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Control', 'getSnippetId', new StringType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\Form',
|
||||
'getPresenter',
|
||||
new UnionType([new ObjectType('Nette\Application\UI\Presenter'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Form', 'signalReceived', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\IRenderable', 'redrawControl', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\IRenderable', 'isControlInvalid', new BooleanType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\ITemplate', 'render', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\ITemplate', 'getFile', new UnionType([
|
||||
new StringType(),
|
||||
new NullType(),
|
||||
])),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\ITemplateFactory',
|
||||
'createTemplate',
|
||||
new ObjectType('Nette\Application\UI\ITemplate')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Link', 'getDestination', new StringType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Link', 'getParameters', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\Link', '__toString', new StringType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\UI\MethodReflection',
|
||||
'hasAnnotation',
|
||||
new BooleanType()
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\IStatePersistent', 'loadState', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\IStatePersistent', 'saveState', new VoidType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\UI\ISignalReceiver', 'signalReceived', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\Routers\SimpleRouter',
|
||||
'match',
|
||||
new UnionType([new ObjectType('Nette\Application\Request'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Routers\SimpleRouter', 'getDefaults', $arrayType),
|
||||
new AddReturnTypeDeclaration('Nette\Application\Routers\SimpleRouter', 'getFlags', new IntegerType()),
|
||||
new AddReturnTypeDeclaration('Nette\Application\LinkGenerator', 'link', new StringType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\MicroPresenter',
|
||||
'getContext',
|
||||
new UnionType([new ObjectType('Nette\DI\Container'), new NullType()])
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\MicroPresenter',
|
||||
'createTemplate',
|
||||
new ObjectType('Nette\Application\UI\ITemplate')
|
||||
),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\MicroPresenter',
|
||||
'redirectUrl',
|
||||
new ObjectType('Nette\Application\Responses\RedirectResponse')
|
||||
),
|
||||
new AddReturnTypeDeclaration('Nette\Application\MicroPresenter', 'error', new VoidType()),
|
||||
new AddReturnTypeDeclaration(
|
||||
'Nette\Application\MicroPresenter',
|
||||
'getRequest',
|
||||
new UnionType([new ObjectType('Nette\Application\Request'), new NullType()])
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
};
|
|
@ -1,110 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Arguments\Rector\ClassMethod\ArgumentDefaultValueReplacerRector;
|
||||
use Rector\Arguments\ValueObject\ArgumentDefaultValueReplacer;
|
||||
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
|
||||
use Rector\Nette\Rector\Class_\MoveFinalGetUserToCheckRequirementsClassMethodRector;
|
||||
use Rector\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector;
|
||||
use Rector\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector;
|
||||
use Rector\Nette\Rector\MethodCall\ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector;
|
||||
use Rector\Nette\Rector\MethodCall\MagicHtmlCallToAppendAttributeRector;
|
||||
use Rector\Nette\Rector\MethodCall\MergeDefaultsInGetConfigCompilerExtensionRector;
|
||||
use Rector\Nette\Rector\MethodCall\RequestGetCookieDefaultArgumentToCoalesceRector;
|
||||
use Rector\NetteCodeQuality\Rector\ArrayDimFetch\ChangeFormArrayAccessToAnnotatedControlVariableRector;
|
||||
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Renaming\ValueObject\RenameClassConstFetch;
|
||||
use Rector\Transform\Rector\StaticCall\StaticCallToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\StaticCallToMethodCall;
|
||||
use Rector\TypeDeclaration\Rector\MethodCall\FormerNullableArgumentToScalarTypedRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->import(__DIR__ . '/nette-30-composer.php');
|
||||
$containerConfigurator->import(__DIR__ . '/nette-30-dependency-injection.php');
|
||||
$containerConfigurator->import(__DIR__ . '/nette-30-return-types.php');
|
||||
$containerConfigurator->import(__DIR__ . '/nette-30-param-types.php');
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(AddNextrasDatePickerToDateControlRector::class);
|
||||
$services->set(ChangeFormArrayAccessToAnnotatedControlVariableRector::class);
|
||||
$services->set(MergeDefaultsInGetConfigCompilerExtensionRector::class);
|
||||
// Control class has remove __construct(), e.g. https://github.com/Pixidos/GPWebPay/pull/16/files#diff-fdc8251950f85c5467c63c249df05786
|
||||
$services->set(RemoveParentCallWithoutParentRector::class);
|
||||
// https://github.com/nette/utils/commit/d0041ba59f5d8bf1f5b3795fd76d43fb13ea2e15
|
||||
$services->set(FormerNullableArgumentToScalarTypedRector::class);
|
||||
$services->set(StaticCallToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
StaticCallToMethodCallRector::STATIC_CALLS_TO_METHOD_CALLS => ValueObjectInliner::inline([
|
||||
new StaticCallToMethodCall('Nette\Security\Passwords', 'hash', 'Nette\Security\Passwords', 'hash'),
|
||||
new StaticCallToMethodCall('Nette\Security\Passwords', 'verify', 'Nette\Security\Passwords', 'verify'),
|
||||
new StaticCallToMethodCall(
|
||||
'Nette\Security\Passwords',
|
||||
'needsRehash',
|
||||
'Nette\Security\Passwords',
|
||||
'needsRehash'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
// https://github.com/contributte/event-dispatcher-extra/tree/v0.4.3 and higher
|
||||
$services->set(RenameClassConstFetchRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassConstFetchRector::CLASS_CONSTANT_RENAME => ValueObjectInliner::inline([
|
||||
new RenameClassConstFetch('Contributte\Events\Extra\Event\Security\LoggedInEvent', 'NAME', 'class'),
|
||||
new RenameClassConstFetch('Contributte\Events\Extra\Event\Security\LoggedOutEvent', 'NAME', 'class'),
|
||||
new RenameClassConstFetch('Contributte\Events\Extra\Event\Application\ShutdownEvent', 'NAME', 'class'),
|
||||
]),
|
||||
]]);
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
# nextras/forms was split into 2 packages
|
||||
'Nextras\FormComponents\Controls\DatePicker' => 'Nextras\FormComponents\Controls\DateControl',
|
||||
# @see https://github.com/nette/di/commit/a0d361192f8ac35f1d9f82aab7eb351e4be395ea
|
||||
'Nette\DI\ServiceDefinition' => 'Nette\DI\Definitions\ServiceDefinition',
|
||||
'Nette\DI\Statement' => 'Nette\DI\Definitions\Statement',
|
||||
'WebChemistry\Forms\Controls\Multiplier' => 'Contributte\FormMultiplier\Multiplier',
|
||||
],
|
||||
]]);
|
||||
$services->set(ArgumentDefaultValueReplacerRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentDefaultValueReplacerRector::REPLACED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
// json 2nd argument is now `int` typed
|
||||
new ArgumentDefaultValueReplacer(
|
||||
'Nette\Utils\Json',
|
||||
'decode',
|
||||
1,
|
||||
true,
|
||||
'Nette\Utils\Json::FORCE_ARRAY'
|
||||
),
|
||||
// @see https://github.com/nette/forms/commit/574b97f9d5e7a902a224e57d7d584e7afc9fefec
|
||||
new ArgumentDefaultValueReplacer('Nette\Forms\Form', 'decode', 0, true, 'array'),
|
||||
]),
|
||||
]]);
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
// see https://github.com/nette/forms/commit/b99385aa9d24d729a18f6397a414ea88eab6895a
|
||||
new MethodCallRename('Nette\Forms\Controls\BaseControl', 'setType', 'setHtmlType'),
|
||||
new MethodCallRename('Nette\Forms\Controls\BaseControl', 'setAttribute', 'setHtmlAttribute'),
|
||||
new MethodCallRename(
|
||||
'Nette\DI\Definitions\ServiceDefinition',
|
||||
# see https://github.com/nette/di/commit/1705a5db431423fc610a6f339f88dead1b5dc4fb
|
||||
'setClass',
|
||||
'setType'
|
||||
),
|
||||
new MethodCallRename('Nette\DI\Definitions\ServiceDefinition', 'getClass', 'getType'),
|
||||
new MethodCallRename('Nette\DI\Definitions\Definition', 'isAutowired', 'getAutowired'),
|
||||
]),
|
||||
]]);
|
||||
$services->set(MagicHtmlCallToAppendAttributeRector::class);
|
||||
$services->set(RequestGetCookieDefaultArgumentToCoalesceRector::class);
|
||||
$services->set(RemoveParentAndNameFromComponentConstructorRector::class);
|
||||
$services->set(MoveFinalGetUserToCheckRequirementsClassMethodRector::class);
|
||||
$services->set(ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector::class);
|
||||
};
|
|
@ -1,180 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use PHPStan\Type\NullType;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\Composer\Rector\ChangePackageVersionComposerRector;
|
||||
use Rector\Composer\Rector\RemovePackageComposerRector;
|
||||
use Rector\Composer\ValueObject\PackageAndVersion;
|
||||
use Rector\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\Rector\StaticCall\RenameStaticMethodRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Renaming\ValueObject\RenameStaticMethod;
|
||||
use Rector\Transform\Rector\Assign\DimFetchAssignToMethodCallRector;
|
||||
use Rector\Transform\Rector\MethodCall\CallableInMethodCallToVariableRector;
|
||||
use Rector\Transform\ValueObject\CallableInMethodCallToVariable;
|
||||
use Rector\Transform\ValueObject\DimFetchAssignToMethodCall;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(CallableInMethodCallToVariableRector::class)
|
||||
->call('configure', [[
|
||||
// see https://github.com/nette/caching/commit/5ffe263752af5ccf3866a28305e7b2669ab4da82
|
||||
CallableInMethodCallToVariableRector::CALLABLE_IN_METHOD_CALL_TO_VARIABLE => ValueObjectInliner::inline([
|
||||
new CallableInMethodCallToVariable('Nette\Caching\Cache', 'save', 1),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
'Nette\Bridges\ApplicationLatte\Template' => 'Nette\Bridges\ApplicationLatte\DefaultTemplate',
|
||||
|
||||
// https://github.com/nette/application/compare/v3.0.7...v3.1.0
|
||||
'Nette\Application\IRouter' => 'Nette\Routing\Router',
|
||||
'Nette\Application\IResponse' => 'Nette\Application\Response',
|
||||
'Nette\Application\UI\IRenderable' => 'Nette\Application\UI\Renderable',
|
||||
'Nette\Application\UI\ISignalReceiver' => 'Nette\Application\UI\SignalReceiver',
|
||||
'Nette\Application\UI\IStatePersistent' => 'Nette\Application\UI\StatePersistent',
|
||||
'Nette\Application\UI\ITemplate' => 'Nette\Application\UI\Template',
|
||||
'Nette\Application\UI\ITemplateFactory' => 'Nette\Application\UI\TemplateFactory',
|
||||
'Nette\Bridges\ApplicationLatte\ILatteFactory' => 'Nette\Bridges\ApplicationLatte\LatteFactory',
|
||||
|
||||
// https://github.com/nette/bootstrap/compare/v3.0.2...v3.1.0
|
||||
'Nette\Configurator' => 'Nette\Bootstrap\Configurator',
|
||||
|
||||
// https://github.com/nette/caching/compare/v3.0.2...v3.1.0
|
||||
'Nette\Caching\IBulkReader' => 'Nette\Caching\BulkReader',
|
||||
'Nette\Caching\IStorage' => 'Nette\Caching\Storage',
|
||||
'Nette\Caching\Storages\IJournal' => 'Nette\Caching\Storages\Journal',
|
||||
|
||||
// https://github.com/nette/database/compare/v3.0.7...v3.1.1
|
||||
'Nette\Database\ISupplementalDriver' => 'Nette\Database\Driver',
|
||||
'Nette\Database\IConventions' => 'Nette\Database\Conventions',
|
||||
'Nette\Database\Context' => 'Nette\Database\Explorer',
|
||||
'Nette\Database\IRow' => 'Nette\Database\Row',
|
||||
'Nette\Database\IRowContainer' => 'Nette\Database\ResultSet',
|
||||
'Nette\Database\Table\IRow' => 'Nette\Database\Table\ActiveRow',
|
||||
'Nette\Database\Table\IRowContainer' => 'Nette\Database\Table\Selection',
|
||||
|
||||
// https://github.com/nette/forms/compare/v3.0.7...v3.1.0-RC2
|
||||
'Nette\Forms\IControl' => 'Nette\Forms\Control',
|
||||
'Nette\Forms\IFormRenderer' => 'Nette\Forms\FormRenderer',
|
||||
'Nette\Forms\ISubmitterControl' => 'Nette\Forms\SubmitterControl',
|
||||
|
||||
// https://github.com/nette/mail/compare/v3.0.1...v3.1.5
|
||||
'Nette\Mail\IMailer' => 'Nette\Mail\Mailer',
|
||||
|
||||
// https://github.com/nette/security/compare/v3.0.5...v3.1.2
|
||||
'Nette\Security\IAuthorizator' => 'Nette\Security\Authorizator',
|
||||
'Nette\Security\Identity' => 'Nette\Security\SimpleIdentity',
|
||||
'Nette\Security\IResource' => 'Nette\Security\Resource',
|
||||
'Nette\Security\IRole' => 'Nette\Security\Role',
|
||||
|
||||
// https://github.com/nette/utils/compare/v3.1.4...v3.2.1
|
||||
'Nette\Utils\IHtmlString' => 'Nette\HtmlStringable',
|
||||
'Nette\Localization\ITranslator' => 'Nette\Localization\Translator',
|
||||
|
||||
// https://github.com/nette/latte/compare/v2.5.5...v2.9.2
|
||||
'Latte\ILoader' => 'Latte\Loader',
|
||||
'Latte\IMacro' => 'Latte\Macro',
|
||||
'Latte\Runtime\IHtmlString' => 'Latte\Runtime\HtmlStringable',
|
||||
'Latte\Runtime\ISnippetBridge' => 'Latte\Runtime\SnippetBridge',
|
||||
],
|
||||
]]);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
// https://github.com/nette/caching/commit/60281abf366c4ab76e9436dc1bfe2e402db18b67
|
||||
new MethodCallRename('Nette\Caching\Cache', 'start', 'capture'),
|
||||
// https://github.com/nette/forms/commit/faaaf8b8fd3408a274a9de7ca3f342091010ad5d
|
||||
new MethodCallRename('Nette\Forms\Container', 'addImage', 'addImageButton'),
|
||||
// https://github.com/nette/utils/commit/d0427c1811462dbb6c503143eabe5478b26685f7
|
||||
new MethodCallRename('Nette\Utils\Arrays', 'searchKey', 'getKeyOffset'),
|
||||
new MethodCallRename('Nette\Configurator', 'addParameters', 'addStaticParameters'),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(RenameStaticMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameStaticMethodRector::OLD_TO_NEW_METHODS_BY_CLASSES => ValueObjectInliner::inline([
|
||||
// https://github.com/nette/utils/commit/8a4b795acd00f3f6754c28a73a7e776b60350c34
|
||||
new RenameStaticMethod('Nette\Utils\Callback', 'closure', 'Closure', 'fromCallable'),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(DimFetchAssignToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
DimFetchAssignToMethodCallRector::DIM_FETCH_ASSIGN_TO_METHOD_CALL => ValueObjectInliner::inline([
|
||||
new DimFetchAssignToMethodCall(
|
||||
'Nette\Application\Routers\RouteList',
|
||||
'Nette\Application\Routers\Route',
|
||||
'addRoute'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(AddParamTypeDeclarationRector::class)
|
||||
->call('configure', [[
|
||||
AddParamTypeDeclarationRector::PARAMETER_TYPEHINTS => ValueObjectInliner::inline([
|
||||
new AddParamTypeDeclaration(
|
||||
'Nette\Application\UI\Presenter',
|
||||
'sendTemplate',
|
||||
0,
|
||||
new UnionType([new ObjectType('Nette\Application\UI\Template'), new NullType()])
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(ContextGetByTypeToConstructorInjectionRector::class);
|
||||
|
||||
$services->set(ChangePackageVersionComposerRector::class)
|
||||
->call('configure', [[
|
||||
ChangePackageVersionComposerRector::PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
// meta package
|
||||
new PackageAndVersion('nette/nette', '^3.1'),
|
||||
// https://github.com/nette/nette/blob/v3.0.0/composer.json vs https://github.com/nette/nette/blob/v3.1.0/composer.json
|
||||
new PackageAndVersion('nette/application', '^3.1'),
|
||||
new PackageAndVersion('nette/bootstrap', '^3.1'),
|
||||
new PackageAndVersion('nette/caching', '^3.1'),
|
||||
new PackageAndVersion('nette/database', '^3.1'),
|
||||
new PackageAndVersion('nette/di', '^3.0'),
|
||||
new PackageAndVersion('nette/finder', '^2.5'),
|
||||
new PackageAndVersion('nette/forms', '^3.1'),
|
||||
new PackageAndVersion('nette/http', '^3.1'),
|
||||
new PackageAndVersion('nette/mail', '^3.1'),
|
||||
new PackageAndVersion('nette/php-generator', '^3.5'),
|
||||
new PackageAndVersion('nette/robot-loader', '^3.3'),
|
||||
new PackageAndVersion('nette/safe-stream', '^2.4'),
|
||||
new PackageAndVersion('nette/security', '^3.1'),
|
||||
new PackageAndVersion('nette/tokenizer', '^3.0'),
|
||||
new PackageAndVersion('nette/utils', '^3.2'),
|
||||
new PackageAndVersion('latte/latte', '^2.9'),
|
||||
new PackageAndVersion('tracy/tracy', '^2.8'),
|
||||
|
||||
// contributte
|
||||
new PackageAndVersion('contributte/console', '^0.9'),
|
||||
new PackageAndVersion('contributte/event-dispatcher', '^0.8'),
|
||||
new PackageAndVersion('contributte/event-dispatcher-extra', '^0.8'),
|
||||
|
||||
// nettrine
|
||||
new PackageAndVersion('nettrine/annotations', '^0.7'),
|
||||
new PackageAndVersion('nettrine/cache', '^0.3'),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(RemovePackageComposerRector::class)
|
||||
->call('configure', [[
|
||||
RemovePackageComposerRector::PACKAGE_NAMES => ['nette/component-model', 'nette/neon'],
|
||||
]]);
|
||||
};
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector;
|
||||
use Rector\NetteCodeQuality\Rector\ArrayDimFetch\AnnotateMagicalControlArrayAccessRector;
|
||||
use Rector\NetteCodeQuality\Rector\Assign\ArrayAccessGetControlToGetComponentMethodCallRector;
|
||||
use Rector\NetteCodeQuality\Rector\Assign\ArrayAccessSetControlToAddComponentMethodCallRector;
|
||||
use Rector\NetteCodeQuality\Rector\Assign\MakeGetComponentAssignAnnotatedRector;
|
||||
use Rector\NetteCodeQuality\Rector\Identical\SubstrMinusToStringEndsWithRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(TemplateMagicAssignToExplicitVariableArrayRector::class);
|
||||
|
||||
$services->set(MakeGetComponentAssignAnnotatedRector::class);
|
||||
|
||||
$services->set(AnnotateMagicalControlArrayAccessRector::class);
|
||||
|
||||
$services->set(ArrayAccessSetControlToAddComponentMethodCallRector::class);
|
||||
|
||||
$services->set(ArrayAccessGetControlToGetComponentMethodCallRector::class);
|
||||
|
||||
$services->set(SubstrMinusToStringEndsWithRector::class);
|
||||
};
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Nette\Rector\FuncCall\FilePutContentsToFileSystemWriteRector;
|
||||
use Rector\Nette\Rector\FuncCall\JsonDecodeEncodeToNetteUtilsJsonDecodeEncodeRector;
|
||||
use Rector\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector;
|
||||
use Rector\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector;
|
||||
use Rector\Nette\Rector\FuncCall\SubstrStrlenFunctionToNetteUtilsStringsRector;
|
||||
use Rector\Nette\Rector\Identical\EndsWithFunctionToNetteUtilsStringsRector;
|
||||
use Rector\Nette\Rector\Identical\StartsWithFunctionToNetteUtilsStringsRector;
|
||||
use Rector\Nette\Rector\LNumber\ReplaceTimeNumberWithDateTimeConstantRector;
|
||||
use Rector\Nette\Rector\NotIdentical\StrposToStringsContainsRector;
|
||||
use Rector\Transform\Rector\FuncCall\FuncCallToStaticCallRector;
|
||||
use Rector\Transform\ValueObject\FuncCallToStaticCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
# @see https://tomasvotruba.com/blog/2018/07/30/hidden-gems-of-php-packages-nette-utils
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(FuncCallToStaticCallRector::class)
|
||||
->call('configure', [[
|
||||
FuncCallToStaticCallRector::FUNC_CALLS_TO_STATIC_CALLS => ValueObjectInliner::inline([
|
||||
new FuncCallToStaticCall('file_get_contents', 'Nette\Utils\FileSystem', 'read'),
|
||||
new FuncCallToStaticCall('unlink', 'Nette\Utils\FileSystem', 'delete'),
|
||||
new FuncCallToStaticCall('rmdir', 'Nette\Utils\FileSystem', 'delete'),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(StrposToStringsContainsRector::class);
|
||||
$services->set(SubstrStrlenFunctionToNetteUtilsStringsRector::class);
|
||||
$services->set(StartsWithFunctionToNetteUtilsStringsRector::class);
|
||||
$services->set(PregMatchFunctionToNetteUtilsStringsRector::class);
|
||||
$services->set(PregFunctionToNetteUtilsStringsRector::class);
|
||||
$services->set(EndsWithFunctionToNetteUtilsStringsRector::class);
|
||||
$services->set(JsonDecodeEncodeToNetteUtilsJsonDecodeEncodeRector::class);
|
||||
$services->set(FilePutContentsToFileSystemWriteRector::class);
|
||||
$services->set(ReplaceTimeNumberWithDateTimeConstantRector::class);
|
||||
};
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Set\ValueObject;
|
||||
|
||||
use Rector\Set\Contract\SetListInterface;
|
||||
use Rector\Set\NetteSetList;
|
||||
use Rector\Set\SymfonySetList;
|
||||
|
||||
final class SetList implements SetListInterface
|
||||
|
@ -262,37 +263,27 @@ final class SetList implements SetListInterface
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NETTE_24 = __DIR__ . '/../../../config/set/nette-24.php';
|
||||
public const NETTE_24 = NetteSetList::NETTE_24;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NETTE_30 = __DIR__ . '/../../../config/set/nette-30.php';
|
||||
public const NETTE_30 = NetteSetList::NETTE_30;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NETTE_30_PARAM_TYPES = __DIR__ . '/../../../config/set/nette-30-param-types.php';
|
||||
public const NETTE_31 = NetteSetList::NETTE_31;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NETTE_30_RETURN_TYPES = __DIR__ . '/../../../config/set/nette-30-return-types.php';
|
||||
public const NETTE_CODE_QUALITY = NetteSetList::NETTE_CODE_QUALITY;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NETTE_30_DEPENDENCY_INJECTION = __DIR__ . '/../../../config/set/nette-30-dependency-injection.php';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NETTE_31 = __DIR__ . '/../../../config/set/nette-31.php';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NETTE_CODE_QUALITY = __DIR__ . '/../../../config/set/nette-code-quality.php';
|
||||
public const NETTE_UTILS_CODE_QUALITY = NetteSetList::NETTE_UTILS_CODE_QUALITY;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -304,16 +295,6 @@ final class SetList implements SetListInterface
|
|||
*/
|
||||
public const NETTE_FORMS_TO_SYMFONY = __DIR__ . '/../../../config/set/nette-forms-to-symfony.php';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NETTE_PARAM_TYPES = __DIR__ . '/../../../config/set/nette-30-param-types.php';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NETTE_RETURN_TYPES = __DIR__ . '/../../../config/set/nette-30-return-types.php';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -324,11 +305,6 @@ final class SetList implements SetListInterface
|
|||
*/
|
||||
public const NETTE_TO_SYMFONY = __DIR__ . '/../../../config/set/nette-to-symfony.php';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NETTE_UTILS_CODE_QUALITY = __DIR__ . '/../../../config/set/nette-utils-code-quality.php';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
|
|
@ -14,6 +14,5 @@ services:
|
|||
|
||||
includes:
|
||||
- utils/phpstan-extensions/config/phpstan-extensions.neon
|
||||
- vendor/phpstan/phpstan-nette/extension.neon
|
||||
- vendor/symplify/astral/config/services.neon
|
||||
- vendor/symplify/phpstan-extensions/config/config.neon
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\CodeQuality\Rector\If_\ExplicitBoolCompareRector\Fixture;
|
||||
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
|
||||
final class SplFileInfoEdgeCase
|
||||
{
|
||||
public function run(?SplFileInfo $fileInfo)
|
||||
{
|
||||
if ($fileInfo === null) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
if (! $fileInfo->getRealPath()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\CodeQuality\Rector\If_\ExplicitBoolCompareRector\Fixture;
|
||||
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
|
||||
final class SplFileInfoEdgeCase
|
||||
{
|
||||
public function run(?SplFileInfo $fileInfo)
|
||||
{
|
||||
if ($fileInfo === null) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
if ($fileInfo->getRealPath() === '') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
use Nette\ComponentModel\IContainer;
|
||||
|
||||
class BackOrderControl extends Control
|
||||
{
|
||||
public function __construct($name = null, int $value, IContainer $parent = null)
|
||||
{
|
||||
parent::__construct($parent, $name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
use Nette\ComponentModel\IContainer;
|
||||
|
||||
class BackOrderControl extends Control
|
||||
{
|
||||
public function __construct(int $value)
|
||||
{
|
||||
parent::__construct($value);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
use Nette\ComponentModel\IContainer;
|
||||
|
||||
final class DoNotRemoveFutureUseName extends Control
|
||||
{
|
||||
private $customName;
|
||||
|
||||
private $value;
|
||||
|
||||
public function __construct(IContainer $parent = null, $name = null, int $value)
|
||||
{
|
||||
parent::__construct($parent, $name);
|
||||
$this->customName = $name;
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
use Nette\ComponentModel\IContainer;
|
||||
|
||||
final class DoNotRemoveFutureUseName extends Control
|
||||
{
|
||||
private $customName;
|
||||
|
||||
private $value;
|
||||
|
||||
public function __construct($name = null, int $value)
|
||||
{
|
||||
$this->customName = $name;
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
use Nette\ComponentModel\IContainer;
|
||||
|
||||
class SomeControl extends Control
|
||||
{
|
||||
public function __construct(IContainer $parent = null, $name = null, int $value)
|
||||
{
|
||||
parent::__construct($parent, $name);
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
use Nette\ComponentModel\IContainer;
|
||||
|
||||
class SomeControl extends Control
|
||||
{
|
||||
public function __construct(int $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Presenter;
|
||||
|
||||
class KeepPresenterPrent extends Presenter
|
||||
{
|
||||
private $dependency;
|
||||
|
||||
public function __construct($dependency)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dependency = $dependency;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Source\SomeControlWithConstructorParentAndName;
|
||||
|
||||
final class NewInstance
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$someControlWithConstructorParentAndName = new SomeControlWithConstructorParentAndName(null, 'hey');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Source\SomeControlWithConstructorParentAndName;
|
||||
|
||||
final class NewInstance
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$someControlWithConstructorParentAndName = new SomeControlWithConstructorParentAndName();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Source\SomeControlWithoutConstructorParentAndName;
|
||||
|
||||
final class SkipAnotherParamInNewInstance
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$someControlWithConstructorParentAndName = new SomeControlWithoutConstructorParentAndName('key', 'value');
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Fixture;
|
||||
|
||||
use Nette\ComponentModel\IContainer;
|
||||
use Nette\Forms\Form;
|
||||
|
||||
class SkipForm extends Form
|
||||
{
|
||||
public function __construct(IContainer $parent = null, $name = null, int $value)
|
||||
{
|
||||
parent::__construct($parent, $name);
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class RemoveParentAndNameFromComponentConstructorRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return RemoveParentAndNameFromComponentConstructorRector::class;
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Source;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SomeControlWithConstructorParentAndName extends Control
|
||||
{
|
||||
public function __construct($parent = null, $name = '')
|
||||
{
|
||||
$this->parent = $parent;
|
||||
$this->name = $name;
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\RemoveParentAndNameFromComponentConstructorRector\Source;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SomeControlWithoutConstructorParentAndName extends Control
|
||||
{
|
||||
private $key;
|
||||
private $value;
|
||||
|
||||
public function __construct($key, $value)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class CallbackReturn extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$this->template->maybe = 'true';
|
||||
|
||||
$values = function () {
|
||||
return 100;
|
||||
};
|
||||
|
||||
$this->template->definitely = 'true';
|
||||
|
||||
$this->template->render(__DIR__ . '/someFile.latte');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class CallbackReturn extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$values = function () {
|
||||
return 100;
|
||||
};
|
||||
|
||||
$this->template->render(__DIR__ . '/someFile.latte', ['maybe' => 'true', 'definitely' => 'true']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class ConditionalAndOneNormalVariables extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
if (mt_rand(0, 1000)) {
|
||||
$this->template->yes = 'true';
|
||||
}
|
||||
|
||||
$this->template->normalVariable = 'include me!';
|
||||
$this->template->render(__DIR__ . '/someFile.latte');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class ConditionalAndOneNormalVariables extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
if (mt_rand(0, 1000)) {
|
||||
$this->template->yes = 'true';
|
||||
}
|
||||
$this->template->render(__DIR__ . '/someFile.latte', ['normalVariable' => 'include me!']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class DoubleRender extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$this->template->yes = 'true';
|
||||
|
||||
if (mt_rand(0, 100)) {
|
||||
$this->template->render(__DIR__ . '/first.latte');
|
||||
} else {
|
||||
$this->template->render(__DIR__ . '/second.latte');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class DoubleRender extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$parameters = [];
|
||||
$parameters['yes'] = 'true';
|
||||
|
||||
if (mt_rand(0, 100)) {
|
||||
$this->template->render(__DIR__ . '/first.latte', $parameters);
|
||||
} else {
|
||||
$this->template->render(__DIR__ . '/second.latte', $parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class RenderAfterReturn extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$this->template->maybe = 'true';
|
||||
|
||||
if (mt_rand(0, 1000)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->template->definitely = 'true';
|
||||
|
||||
$this->template->render(__DIR__ . '/someFile.latte');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class RenderAfterReturn extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$this->template->maybe = 'true';
|
||||
|
||||
if (mt_rand(0, 1000)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->template->render(__DIR__ . '/someFile.latte', ['definitely' => 'true']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SingleConditionalVariable extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
if (mt_rand(0, 1000)) {
|
||||
$this->template->someKey = 'true';
|
||||
} else {
|
||||
$this->template->someKey = 'false';
|
||||
}
|
||||
|
||||
$this->template->render(__DIR__ . '/someFile.latte');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SingleConditionalVariable extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
if (mt_rand(0, 1000)) {
|
||||
$someKey = 'true';
|
||||
} else {
|
||||
$someKey = 'false';
|
||||
}
|
||||
|
||||
$this->template->render(__DIR__ . '/someFile.latte', ['someKey' => $someKey]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
abstract class SkipAbstractControl extends Control
|
||||
{
|
||||
public function checkRequirements($element): void
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SkipConditionalVariables extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
if (mt_rand(0, 1000)) {
|
||||
$this->template->yes = 'true';
|
||||
} else {
|
||||
$this->template->no = 'false';
|
||||
}
|
||||
|
||||
$this->template->render(__DIR__ . '/someFile.latte');
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SkipDoubleSetFile extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$this->template->value = 'key';
|
||||
|
||||
if (mt_rand(0, 100)) {
|
||||
$this->template->setFile('one.latte');
|
||||
} else {
|
||||
$this->template->setFile('two.latte');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SkipJustDoubleRender extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
$this->template->render(__DIR__ . '/first.latte');
|
||||
} else {
|
||||
$this->template->render(__DIR__ . '/second.latte');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SkipMissingRender extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$this->template->value = 'key';
|
||||
$this->template->setFile('one.latte');
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Presenter;
|
||||
|
||||
final class SkipPresenter extends Presenter
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$this->template->param = 'some value';
|
||||
$this->template->render(__DIR__ . '/poll.latte');
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SkipRenderWithMissingTemplate extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$this->template->key = 'value';
|
||||
$this->template->render();
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SomeControl extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$this->template->param = 'some value';
|
||||
$this->template->render(__DIR__ . '/poll.latte');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SomeControl extends Control
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$this->template->render(__DIR__ . '/poll.latte', ['param' => 'some value']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SomeControlWithCustomRender extends Control
|
||||
{
|
||||
public function renderYolo()
|
||||
{
|
||||
$this->template->param = 'some value';
|
||||
$this->template->render(__DIR__ . '/poll.latte');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Control;
|
||||
|
||||
final class SomeControlWithCustomRender extends Control
|
||||
{
|
||||
public function renderYolo()
|
||||
{
|
||||
$this->template->render(__DIR__ . '/poll.latte', ['param' => 'some value']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\ClassMethod\TemplateMagicAssignToExplicitVariableArrayRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class TemplateMagicAssignToExplicitVariableArrayRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return TemplateMagicAssignToExplicitVariableArrayRector::class;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TranslateClassMethodToVariadicsRector\Fixture;
|
||||
|
||||
use Nette\Localization\ITranslator;
|
||||
|
||||
final class SomeClass implements ITranslator
|
||||
{
|
||||
public function translate($message, $count = null)
|
||||
{
|
||||
return [$message, $count];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TranslateClassMethodToVariadicsRector\Fixture;
|
||||
|
||||
use Nette\Localization\ITranslator;
|
||||
|
||||
final class SomeClass implements ITranslator
|
||||
{
|
||||
public function translate($message, ...$parameters)
|
||||
{
|
||||
$count = $parameters[0] ?? null;
|
||||
return [$message, $count];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\ClassMethod\TranslateClassMethodToVariadicsRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\ClassMethod\TranslateClassMethodToVariadicsRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class TranslateClassMethodToVariadicsRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$localFilePath = __DIR__ . '/../../../../../../vendor/nette/utils/src/Utils/ITranslator.php';
|
||||
if (file_exists($localFilePath)) {
|
||||
$this->smartFileSystem->remove($localFilePath);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/../../../../../stubs/Nette/Localization/ITranslation.php';
|
||||
|
||||
// to make test work with fixture
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return TranslateClassMethodToVariadicsRector::class;
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\FilePutContentsToFileSystemWriteRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\FuncCall\FilePutContentsToFileSystemWriteRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class FilePutContentsToFileSystemWriteRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return FilePutContentsToFileSystemWriteRector::class;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\FilePutContentsToFileSystemWriteRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
file_put_contents('file.txt', 'content');
|
||||
|
||||
file_put_contents('file.txt', 'content_to_append', FILE_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\FilePutContentsToFileSystemWriteRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
\Nette\Utils\FileSystem::write('file.txt', 'content');
|
||||
|
||||
file_put_contents('file.txt', 'content_to_append', FILE_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\JsonDecodeEncodeToNetteUtilsJsonDecodeEncodeRector\Fixture;
|
||||
|
||||
class JsonDecode
|
||||
{
|
||||
public function decodeJson(string $jsonString)
|
||||
{
|
||||
$stdClass = json_decode($jsonString);
|
||||
|
||||
$array = json_decode($jsonString, true);
|
||||
$array = json_decode($jsonString, false);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\JsonDecodeEncodeToNetteUtilsJsonDecodeEncodeRector\Fixture;
|
||||
|
||||
class JsonDecode
|
||||
{
|
||||
public function decodeJson(string $jsonString)
|
||||
{
|
||||
$stdClass = \Nette\Utils\Json::decode($jsonString);
|
||||
|
||||
$array = \Nette\Utils\Json::decode($jsonString, \Nette\Utils\Json::FORCE_ARRAY);
|
||||
$array = \Nette\Utils\Json::decode($jsonString);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\JsonDecodeEncodeToNetteUtilsJsonDecodeEncodeRector\Fixture;
|
||||
|
||||
class JsonEncode
|
||||
{
|
||||
public function encodeJson(array $data)
|
||||
{
|
||||
$jsonString = json_encode($data);
|
||||
|
||||
$prettyJsonString = json_encode($data, JSON_PRETTY_PRINT);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\JsonDecodeEncodeToNetteUtilsJsonDecodeEncodeRector\Fixture;
|
||||
|
||||
class JsonEncode
|
||||
{
|
||||
public function encodeJson(array $data)
|
||||
{
|
||||
$jsonString = \Nette\Utils\Json::encode($data);
|
||||
|
||||
$prettyJsonString = \Nette\Utils\Json::encode($data, \Nette\Utils\Json::PRETTY);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\JsonDecodeEncodeToNetteUtilsJsonDecodeEncodeRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\FuncCall\JsonDecodeEncodeToNetteUtilsJsonDecodeEncodeRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class JsonDecodeEncodeToNetteUtilsJsonDecodeEncodeRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return JsonDecodeEncodeToNetteUtilsJsonDecodeEncodeRector::class;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregReplace
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$newContent = preg_replace('#Hi#', 'Hello', $content);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregReplace
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$newContent = \Nette\Utils\Strings::replace($content, '#Hi#', 'Hello');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregReplaceCallback
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$newContent = preg_replace_callback('#Hi#', function ($value) {
|
||||
return 'Hello';
|
||||
}, $content);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregReplaceCallback
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$newContent = \Nette\Utils\Strings::replace($content, '#Hi#', function ($value) {
|
||||
return 'Hello';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregReplaceWithString
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
return (string) preg_replace('#[^0-9a-zA-Z]#', '_', $content);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregReplaceWithString
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
return (string) \Nette\Utils\Strings::replace($content, '#[^0-9a-zA-Z]#', '_');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregSplit
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$splitted = preg_split('#Hi#', $content);
|
||||
$splitted = preg_split('#Hi#', $content, -1);
|
||||
$splitted = preg_split('#Hi#', $content, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
$splitted = preg_split('#Hi#', $content, 2);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregSplit
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$splitted = \Nette\Utils\Strings::split($content, '#Hi#');
|
||||
$splitted = \Nette\Utils\Strings::split($content, '#Hi#');
|
||||
$splitted = \Nette\Utils\Strings::split($content, '#Hi#', PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
$splitted = preg_split('#Hi#', $content, 2);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregSplitWithSubpattern
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$pieces = preg_split('#\s#', $content);
|
||||
|
||||
$pieces = preg_split('#(\s)#', $content);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregSplitWithSubpattern
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$pieces = \Nette\Utils\Strings::split($content, '#\s#');
|
||||
|
||||
$pieces = \Nette\Utils\Strings::split($content, '#(\s)#', 0 & ~PREG_SPLIT_DELIM_CAPTURE);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\FuncCall\PregFunctionToNetteUtilsStringsRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class PregFunctionToNetteUtilsStringsRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return PregFunctionToNetteUtilsStringsRector::class;
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatch2Arguments
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$isIt = preg_match('#Hi#', $content);
|
||||
|
||||
if (preg_match('#Hi#', $content)) {
|
||||
// matched!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatch2Arguments
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$isIt = preg_match('#Hi#', $content);
|
||||
|
||||
if (\Nette\Utils\Strings::match($content, '#Hi#')) {
|
||||
// matched!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatch3Arguments
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
preg_match('#Hi#', $content, $matches);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatch3Arguments
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom';
|
||||
|
||||
$matches = \Nette\Utils\Strings::match($content, '#Hi#');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatchAll2Arguments
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom, Hi';
|
||||
|
||||
$countOfMatches = preg_match_all('#Hi#', $content);
|
||||
|
||||
if (preg_match_all('#Hi#', $content)) {
|
||||
// matched!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatchAll2Arguments
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom, Hi';
|
||||
|
||||
$countOfMatches = count(\Nette\Utils\Strings::matchAll($content, '#Hi#'));
|
||||
|
||||
if (\Nette\Utils\Strings::matchAll($content, '#Hi#')) {
|
||||
// matched!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatchAll3Arguments
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom, Hi';
|
||||
|
||||
preg_match_all('#Hi#', $content, $matches);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatchAll3Arguments
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$content = 'Hi my name is Tom, Hi';
|
||||
|
||||
$matches = \Nette\Utils\Strings::matchAll($content, '#Hi#', PREG_SET_ORDER - 1);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatchAllKeepFormat
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$mentionPattern = '/(^|[^a-z0-9_])[@]([a-z0-9-_]{3,16})([@\xC0-\xD6\xD8-\xF6\xF8-\xFF]?)/iu';
|
||||
$content = 'Hello @tom and @david, how are you?';
|
||||
|
||||
\preg_match_all($mentionPattern, $content, $result);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatchAllKeepFormat
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$mentionPattern = '/(^|[^a-z0-9_])[@]([a-z0-9-_]{3,16})([@\xC0-\xD6\xD8-\xF6\xF8-\xFF]?)/iu';
|
||||
$content = 'Hello @tom and @david, how are you?';
|
||||
|
||||
$result = \Nette\Utils\Strings::matchAll($content, $mentionPattern, PREG_SET_ORDER - 1);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatchIdenticalOne
|
||||
{
|
||||
public function run($content)
|
||||
{
|
||||
return preg_match('#\d#', $content, $matches) === 1;
|
||||
}
|
||||
|
||||
public function go($content)
|
||||
{
|
||||
return 1 === preg_match('#\d#', $content);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatchIdenticalOne
|
||||
{
|
||||
public function run($content)
|
||||
{
|
||||
return (bool) \Nette\Utils\Strings::match($content, '#\d#');
|
||||
}
|
||||
|
||||
public function go($content)
|
||||
{
|
||||
return (bool) \Nette\Utils\Strings::match($content, '#\d#');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatchIdenticalOneWithMatches
|
||||
{
|
||||
public function run($content)
|
||||
{
|
||||
$haveResults = preg_match('#\d#', $content, $matches) === 1;
|
||||
$this->matches = $matches;
|
||||
|
||||
return $haveResults;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class PregMatchIdenticalOneWithMatches
|
||||
{
|
||||
public function run($content)
|
||||
{
|
||||
$haveResults = (bool) ($matches = \Nette\Utils\Strings::match($content, '#\d#'));
|
||||
$this->matches = $matches;
|
||||
|
||||
return $haveResults;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\FuncCall\PregMatchFunctionToNetteUtilsStringsRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class PregMatchFunctionToNetteUtilsStringsRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return PregMatchFunctionToNetteUtilsStringsRector::class;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\SubstrStrlenFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
return substr($value, 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\SubstrStrlenFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
return \Nette\Utils\Strings::substring($value, 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\FuncCall\SubstrStrlenFunctionToNetteUtilsStringsRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\FuncCall\SubstrStrlenFunctionToNetteUtilsStringsRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class SubstrStrlenFunctionToNetteUtilsStringsRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return SubstrStrlenFunctionToNetteUtilsStringsRector::class;
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\Identical\EndsWithFunctionToNetteUtilsStringsRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\Identical\EndsWithFunctionToNetteUtilsStringsRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class EndsWithFunctionToNetteUtilsStringsRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return EndsWithFunctionToNetteUtilsStringsRector::class;
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\Identical\EndsWithFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
public function end($needle)
|
||||
{
|
||||
$content = 'Hi, my name is Tom';
|
||||
|
||||
$yes = substr($content, -strlen($needle)) === $needle;
|
||||
$no = $needle !== substr($content, -strlen($needle));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\Identical\EndsWithFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
public function end($needle)
|
||||
{
|
||||
$content = 'Hi, my name is Tom';
|
||||
|
||||
$yes = \Nette\Utils\Strings::endsWith($content, $needle);
|
||||
$no = !\Nette\Utils\Strings::endsWith($content, $needle);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\Identical\StartsWithFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
public function start($needle)
|
||||
{
|
||||
$content = 'Hi, my name is Tom';
|
||||
|
||||
$yes = substr($content, 0, strlen($needle)) === $needle;
|
||||
$no = $needle !== substr($content, 0, strlen($needle));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\Identical\StartsWithFunctionToNetteUtilsStringsRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
public function start($needle)
|
||||
{
|
||||
$content = 'Hi, my name is Tom';
|
||||
|
||||
$yes = \Nette\Utils\Strings::startsWith($content, $needle);
|
||||
$no = !\Nette\Utils\Strings::startsWith($content, $needle);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\Identical\StartsWithFunctionToNetteUtilsStringsRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\Identical\StartsWithFunctionToNetteUtilsStringsRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class StartsWithFunctionToNetteUtilsStringsRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return StartsWithFunctionToNetteUtilsStringsRector::class;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\LNumber\ReplaceTimeNumberWithDateTimeConstantRector\Fixture;
|
||||
|
||||
final class Fixture
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
return 86400;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\LNumber\ReplaceTimeNumberWithDateTimeConstantRector\Fixture;
|
||||
|
||||
final class Fixture
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
return \Nette\Utils\DateTime::DAY;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\LNumber\ReplaceTimeNumberWithDateTimeConstantRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\LNumber\ReplaceTimeNumberWithDateTimeConstantRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ReplaceTimeNumberWithDateTimeConstantRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return ReplaceTimeNumberWithDateTimeConstantRector::class;
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class AddNextrasDatePickerToDateControlRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return AddNextrasDatePickerToDateControlRector::class;
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Form;
|
||||
|
||||
class AddRule
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$form = new Form();
|
||||
$form->addDatePicker('key', 'Label')
|
||||
->addRule('...');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Form;
|
||||
|
||||
class AddRule
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$form = new Form();
|
||||
$keyDateControl = $form['key'] = new \Nextras\FormComponents\Controls\DateControl('Label');
|
||||
$keyDateControl->addRule('...');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Form;
|
||||
|
||||
class AddRuleChainCalls
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$form = new Form();
|
||||
$form->addDatePicker('key', 'Label')
|
||||
->addRule('...')
|
||||
->addContitionOn('...');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Form;
|
||||
|
||||
class AddRuleChainCalls
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$form = new Form();
|
||||
$keyDateControl = $form['key'] = new \Nextras\FormComponents\Controls\DateControl('Label');
|
||||
$keyDateControl->addRule('...')
|
||||
->addContitionOn('...');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Form;
|
||||
|
||||
class AssignedValue
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$form = new Form();
|
||||
$datePicker = $form->addDatePicker('key', 'Label');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Form;
|
||||
|
||||
class AssignedValue
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$form = new Form();
|
||||
$datePicker = new \Nextras\FormComponents\Controls\DateControl('Label');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Form;
|
||||
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$form = new Form();
|
||||
$form->addDatePicker('key', 'Label');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\AddNextrasDatePickerToDateControlRector\Fixture;
|
||||
|
||||
use Nette\Application\UI\Form;
|
||||
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$form = new Form();
|
||||
$form['key'] = new \Nextras\FormComponents\Controls\DateControl('Label');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\BuilderExpandToHelperExpandRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\MethodCall\BuilderExpandToHelperExpandRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class BuilderExpandToHelperExpandRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return BuilderExpandToHelperExpandRector::class;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\BuilderExpandToHelperExpandRector\Fixture;
|
||||
|
||||
use Nette\DI\CompilerExtension;
|
||||
|
||||
final class SomeClass extends CompilerExtension
|
||||
{
|
||||
public function loadConfiguration()
|
||||
{
|
||||
$value = $this->getContainerBuilder()->expand('%value');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\BuilderExpandToHelperExpandRector\Fixture;
|
||||
|
||||
use Nette\DI\CompilerExtension;
|
||||
|
||||
final class SomeClass extends CompilerExtension
|
||||
{
|
||||
public function loadConfiguration()
|
||||
{
|
||||
$value = \Nette\DI\Helpers::expand('%value', $this->getContainerBuilder()->parameters);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ContextGetByTypeToConstructorInjectionRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return ContextGetByTypeToConstructorInjectionRector::class;
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
class ExistingConstructorParam
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
/**
|
||||
* @var \Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject
|
||||
*/
|
||||
private $someInterfaceToInject;
|
||||
|
||||
public function __construct(ISomeInterfaceToInject $someInterfaceToInject)
|
||||
{
|
||||
$this->someInterfaceToInject = $someInterfaceToInject;
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$someTypeToInject = $this->context->getByType(ISomeInterfaceToInject::class);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
class ExistingConstructorParam
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
/**
|
||||
* @var \Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject
|
||||
*/
|
||||
private $someInterfaceToInject;
|
||||
|
||||
public function __construct(ISomeInterfaceToInject $someInterfaceToInject)
|
||||
{
|
||||
$this->someInterfaceToInject = $someInterfaceToInject;
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$someTypeToInject = $this->someInterfaceToInject;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\SomeTypeToInject;
|
||||
|
||||
class SomeClass
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$someTypeToInject = $this->context->getByType(SomeTypeToInject::class);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\SomeTypeToInject;
|
||||
|
||||
class SomeClass
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
public function __construct(private \Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\SomeTypeToInject $someTypeToInject)
|
||||
{
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$someTypeToInject = $this->someTypeToInject;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
class InterfaceName
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$someTypeToInject = $this->context->getByType(ISomeInterfaceToInject::class);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
class InterfaceName
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
public function __construct(private \Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject $someInterfaceToInject)
|
||||
{
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$someTypeToInject = $this->someInterfaceToInject;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ConstructorInjectionParentPresenter;
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
final class RespectInjectParentConstructPreferLocalConstructorPresenter extends ConstructorInjectionParentPresenter
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$some = 100;
|
||||
}
|
||||
|
||||
public function go()
|
||||
{
|
||||
$someTypeToInject = $this->context->getByType(ISomeInterfaceToInject::class);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ConstructorInjectionParentPresenter;
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
final class RespectInjectParentConstructPreferLocalConstructorPresenter extends ConstructorInjectionParentPresenter
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
public function __construct(private \Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject $someInterfaceToInject)
|
||||
{
|
||||
$some = 100;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function go()
|
||||
{
|
||||
$someTypeToInject = $this->someInterfaceToInject;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ConstructorInjectionParentPresenter;
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
final class RespectInjectParentConstructPresenter extends ConstructorInjectionParentPresenter
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
public function go()
|
||||
{
|
||||
$someTypeToInject = $this->context->getByType(ISomeInterfaceToInject::class);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ConstructorInjectionParentPresenter;
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
final class RespectInjectParentConstructPresenter extends ConstructorInjectionParentPresenter
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
/**
|
||||
* @inject
|
||||
*/
|
||||
public \Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject $someInterfaceToInject;
|
||||
|
||||
public function go()
|
||||
{
|
||||
$someTypeToInject = $this->someInterfaceToInject;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
class RespectInjectPresenter
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
/**
|
||||
* @inject
|
||||
* @var \Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\SomeTypeToInject
|
||||
*/
|
||||
public $otherInjectedService;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$someTypeToInject = $this->context->getByType(ISomeInterfaceToInject::class);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
class RespectInjectPresenter
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
/**
|
||||
* @inject
|
||||
* @var \Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\SomeTypeToInject
|
||||
*/
|
||||
public $otherInjectedService;
|
||||
/**
|
||||
* @inject
|
||||
*/
|
||||
public \Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject $someInterfaceToInject;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$someTypeToInject = $this->someInterfaceToInject;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ParentWithSomeTypeToInjectPropertyPresenter;
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\SomeTypeToInject;
|
||||
|
||||
class ReuseParentPropertyWithSameType extends ParentWithSomeTypeToInjectPropertyPresenter
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
public function go()
|
||||
{
|
||||
$someTypeToInject = $this->context->getByType(SomeTypeToInject::class);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ParentWithSomeTypeToInjectPropertyPresenter;
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\SomeTypeToInject;
|
||||
|
||||
class ReuseParentPropertyWithSameType extends ParentWithSomeTypeToInjectPropertyPresenter
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
public function go()
|
||||
{
|
||||
$someTypeToInject = $this->someTypeToInject;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Fixture;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\SomeTypeToInject;
|
||||
|
||||
class SkipTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Nette\DI\Container
|
||||
*/
|
||||
private $context;
|
||||
|
||||
public function testThat()
|
||||
{
|
||||
$someTypeToInject = $this->context->getByType(SomeTypeToInject::class);
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\FixturePhp74;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
class SomeService
|
||||
{
|
||||
private \Nette\DI\Container $context;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$someTypeToInject = $this->context->getByType(ISomeInterfaceToInject::class);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\FixturePhp74;
|
||||
|
||||
use Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject;
|
||||
|
||||
class SomeService
|
||||
{
|
||||
private \Nette\DI\Container $context;
|
||||
public function __construct(private \Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source\ISomeInterfaceToInject $someInterfaceToInject)
|
||||
{
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$someTypeToInject = $this->someInterfaceToInject;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class Php74Test extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @requires PHP 7.4
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/FixturePhp74');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return ContextGetByTypeToConstructorInjectionRector::class;
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source;
|
||||
|
||||
use Nette\Application\IPresenter;
|
||||
use Nette\Application\IResponse;
|
||||
use Nette\Application\Request;
|
||||
|
||||
abstract class ConstructorInjectionParentPresenter implements IPresenter
|
||||
{
|
||||
/**
|
||||
* @var SomeTypeToInject
|
||||
*/
|
||||
private $someTypeToInject;
|
||||
|
||||
public function __construct(SomeTypeToInject $someTypeToInject)
|
||||
{
|
||||
$this->someTypeToInject = $someTypeToInject;
|
||||
}
|
||||
|
||||
function run(Request $request): IResponse
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source;
|
||||
|
||||
interface ISomeInterfaceToInject
|
||||
{
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source;
|
||||
|
||||
use Nette\Application\IPresenter;
|
||||
use Nette\Application\IResponse;
|
||||
use Nette\Application\Request;
|
||||
|
||||
class ParentWithInjectedPropertyPresenter implements IPresenter
|
||||
{
|
||||
/**
|
||||
* @inject
|
||||
* @var SomeTypeToInject
|
||||
*/
|
||||
public $someTypeToInject;
|
||||
|
||||
function run(Request $request): IResponse
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source;
|
||||
|
||||
use Nette\Application\IPresenter;
|
||||
use Nette\Application\IResponse;
|
||||
use Nette\Application\Request;
|
||||
|
||||
class ParentWithSomeTypeToInjectPropertyPresenter implements IPresenter
|
||||
{
|
||||
/**
|
||||
* @var SomeTypeToInject
|
||||
*/
|
||||
protected $someTypeToInject;
|
||||
|
||||
public function __construct(SomeTypeToInject $someTypeToInject)
|
||||
{
|
||||
$this->someTypeToInject = $someTypeToInject;
|
||||
}
|
||||
|
||||
function run(Request $request): IResponse
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ContextGetByTypeToConstructorInjectionRector\Source;
|
||||
|
||||
final class SomeTypeToInject
|
||||
{
|
||||
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\MethodCall\ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector::class;
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector\Fixture;
|
||||
|
||||
use Nette\Forms\Form;
|
||||
|
||||
final class SomeClass
|
||||
{
|
||||
public function upload()
|
||||
{
|
||||
$form = new Form();
|
||||
$form->addUpload('a', 'a', true);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector\Fixture;
|
||||
|
||||
use Nette\Forms\Form;
|
||||
|
||||
final class SomeClass
|
||||
{
|
||||
public function upload()
|
||||
{
|
||||
$form = new Form();
|
||||
$form->addMultiUpload('a', 'a');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector\Fixture;
|
||||
|
||||
use Nette\Forms\Form;
|
||||
|
||||
final class SkipSomeClass
|
||||
{
|
||||
public function upload()
|
||||
{
|
||||
$form = new Form();
|
||||
$form->addUpload('a', 'a');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector\Fixture;
|
||||
|
||||
use DateTime;
|
||||
|
||||
final class SkipSomeClass2
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$d = new DateTime('now');
|
||||
$d->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector\Fixture;
|
||||
|
||||
use Nette\Forms\Form;
|
||||
|
||||
final class SkipSomeClass3
|
||||
{
|
||||
public function upload()
|
||||
{
|
||||
$form = new Form();
|
||||
$form->setHtmlAttribute('a', 'a');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\MagicHtmlCallToAppendAttributeRector\Fixture;
|
||||
|
||||
use Nette\Utils\Html;
|
||||
|
||||
final class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$html = Html::el();
|
||||
$html->setClass('first');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\MagicHtmlCallToAppendAttributeRector\Fixture;
|
||||
|
||||
use Nette\Utils\Html;
|
||||
|
||||
final class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$html = Html::el();
|
||||
$html->appendAttribute('class', 'first');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Nette\Rector\MethodCall\MagicHtmlCallToAppendAttributeRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Nette\Rector\MethodCall\MagicHtmlCallToAppendAttributeRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class MagicHtmlCallToAppendAttributeRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return MagicHtmlCallToAppendAttributeRector::class;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user