mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
Less traits 3, drop duplicated issue tests (#5385)
This commit is contained in:
parent
7293c3c2a8
commit
b6b8ac0c4c
@ -118,7 +118,6 @@
|
||||
"Rector\\Generic\\": "rules/generic/src",
|
||||
"Rector\\Laravel\\": "rules/laravel/src",
|
||||
"Rector\\Legacy\\": "rules/legacy/src",
|
||||
"Rector\\MagicDisclosure\\": "rules/magic-disclosure/src",
|
||||
"Rector\\MockeryToProphecy\\": "rules/mockery-to-prophecy/src",
|
||||
"Rector\\MockistaToMockery\\": "rules/mockista-to-mockery/src",
|
||||
"Rector\\MysqlToMysqli\\": "rules/mysql-to-mysqli/src",
|
||||
@ -242,7 +241,6 @@
|
||||
"Rector\\Laravel\\Tests\\": "rules/laravel/tests",
|
||||
"Rector\\Legacy\\Tests\\": "rules/legacy/tests",
|
||||
"Rector\\Defluent\\Tests\\": "rules/defluent/tests",
|
||||
"Rector\\MagicDisclosure\\Tests\\": "rules/magic-disclosure/tests",
|
||||
"Rector\\MockeryToProphecy\\Tests\\": "rules/mockery-to-prophecy/tests",
|
||||
"Rector\\MockistaToMockery\\Tests\\": "rules/mockista-to-mockery/tests",
|
||||
"Rector\\MysqlToMysqli\\Tests\\": "rules/mysql-to-mysqli/tests",
|
||||
|
@ -7535,10 +7535,10 @@ Turns defined `__get`/`__set` to specific method calls.
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: `Rector\MagicDisclosure\Rector\Assign\GetAndSetToMethodCallRector`
|
||||
- class: `Rector\Transform\Rector\Assign\GetAndSetToMethodCallRector`
|
||||
|
||||
```php
|
||||
use Rector\MagicDisclosure\Rector\Assign\GetAndSetToMethodCallRector;
|
||||
use Rector\Transform\Rector\Assign\GetAndSetToMethodCallRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
@ -7566,7 +7566,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
<br>
|
||||
|
||||
```php
|
||||
use Rector\MagicDisclosure\Rector\Assign\GetAndSetToMethodCallRector;
|
||||
use Rector\Transform\Rector\Assign\GetAndSetToMethodCallRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
@ -7599,10 +7599,10 @@ Turns defined code uses of `"__toString()"` method to specific method calls.
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: `Rector\MagicDisclosure\Rector\String_\ToStringToMethodCallRector`
|
||||
- class: `Rector\Transform\Rector\String_\ToStringToMethodCallRector`
|
||||
|
||||
```php
|
||||
use Rector\MagicDisclosure\Rector\String_\ToStringToMethodCallRector;
|
||||
use Rector\Transform\Rector\String_\ToStringToMethodCallRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
@ -7635,11 +7635,11 @@ Turns defined `__isset`/`__unset` calls to specific method calls.
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: `Rector\MagicDisclosure\Rector\Isset_\UnsetAndIssetToMethodCallRector`
|
||||
- class: `Rector\Transform\Rector\Isset_\UnsetAndIssetToMethodCallRector`
|
||||
|
||||
```php
|
||||
use Rector\MagicDisclosure\Rector\Isset_\UnsetAndIssetToMethodCallRector;
|
||||
use Rector\MagicDisclosure\ValueObject\IssetUnsetToMethodCall;
|
||||
use Rector\Transform\Rector\Isset_\UnsetAndIssetToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\IssetUnsetToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
@ -7666,8 +7666,8 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
<br>
|
||||
|
||||
```php
|
||||
use Rector\MagicDisclosure\Rector\Isset_\UnsetAndIssetToMethodCallRector;
|
||||
use Rector\MagicDisclosure\ValueObject\IssetUnsetToMethodCall;
|
||||
use Rector\Transform\Rector\Isset_\UnsetAndIssetToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\IssetUnsetToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
|
@ -27,7 +27,7 @@ use Rector\BetterPhpDocParser\Contract\PhpDocNode\ShortNameAwareTagInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\TypeAwareTagValueNodeInterface;
|
||||
use Rector\ChangesReporting\Collector\RectorChangeCollector;
|
||||
use Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use Rector\Core\Exception\NotImplementedException;
|
||||
use Rector\Core\Exception\NotImplementedYetException;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\Util\StaticInstanceOf;
|
||||
use Rector\PhpAttribute\Contract\PhpAttributableTagNodeInterface;
|
||||
@ -521,7 +521,7 @@ final class PhpDocInfo
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotImplementedException(get_class($phpDocTagValueNode));
|
||||
throw new NotImplementedYetException(get_class($phpDocTagValueNode));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\PhpDoc;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
|
||||
use Rector\BetterPhpDocParser\Contract\Doctrine\DoctrineRelationTagValueNodeInterface;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\PhpDoc;
|
||||
namespace Rector\BetterPhpDocParser\PhpDocManipulator;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode;
|
||||
@ -11,7 +11,7 @@ use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
||||
use Symplify\SimplePhpDocParser\SimplePhpDocParser;
|
||||
|
||||
/**
|
||||
* @see \Rector\Core\Tests\PhpDoc\PhpDocTagsFinderTest
|
||||
* @see \Rector\BetterPhpDocParser\Tests\PhpDocManipulator\PhpDocTagsFinderTest
|
||||
*/
|
||||
final class PhpDocTagsFinder
|
||||
{
|
||||
@ -34,15 +34,6 @@ final class PhpDocTagsFinder
|
||||
return $this->resolveTypes($simplePhpDocNode->getThrowsTagValues());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function extractReturnTypesFromDocBlock(string $docBlock): array
|
||||
{
|
||||
$simplePhpDocNode = $this->simplePhpDocParser->parseDocBlock($docBlock);
|
||||
return $this->resolveTypes($simplePhpDocNode->getReturnTagValues());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ThrowsTagValueNode[]|ReturnTagValueNode[] $tagValueNodes
|
||||
* @return string[]
|
@ -2,12 +2,12 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\PhpDoc;
|
||||
namespace Rector\BetterPhpDocParser\Tests\PhpDocManipulator;
|
||||
|
||||
use PhpParser\Node\Stmt\Nop;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagsFinder;
|
||||
use Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use Rector\Core\HttpKernel\RectorKernel;
|
||||
use Rector\Core\PhpDoc\PhpDocTagsFinder;
|
||||
use Symplify\PackageBuilder\Testing\AbstractKernelTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileSystem;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Context;
|
||||
namespace Rector\NodeNestingScope;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\FunctionLike;
|
@ -16,7 +16,7 @@ use PHPStan\Type\Constant\ConstantIntegerType;
|
||||
use PHPStan\Type\Constant\ConstantStringType;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\Exception\NotImplementedException;
|
||||
use Rector\Core\Exception\NotImplementedYetException;
|
||||
use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
|
||||
|
||||
final class ScalarTypeResolver implements NodeTypeResolverInterface
|
||||
@ -51,6 +51,6 @@ final class ScalarTypeResolver implements NodeTypeResolverInterface
|
||||
return new MixedType();
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
throw new NotImplementedYetException();
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\UnionType as PhpParserUnionType;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\Exception\NotImplementedException;
|
||||
use Rector\Core\Exception\NotImplementedYetException;
|
||||
use Rector\PHPStanStaticTypeMapper\Contract\PHPStanStaticTypeMapperAwareInterface;
|
||||
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
|
||||
|
||||
@ -60,7 +60,7 @@ final class PHPStanStaticTypeMapper
|
||||
return $typeMapper->mapToPHPStanPhpDocTypeNode($type);
|
||||
}
|
||||
|
||||
throw new NotImplementedException(__METHOD__ . ' for ' . get_class($type));
|
||||
throw new NotImplementedYetException(__METHOD__ . ' for ' . get_class($type));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,7 +76,7 @@ final class PHPStanStaticTypeMapper
|
||||
return $typeMapper->mapToPhpParserNode($type, $kind);
|
||||
}
|
||||
|
||||
throw new NotImplementedException(__METHOD__ . ' for ' . get_class($type));
|
||||
throw new NotImplementedYetException(__METHOD__ . ' for ' . get_class($type));
|
||||
}
|
||||
|
||||
public function mapToDocString(Type $type, ?Type $parentType = null): string
|
||||
@ -89,6 +89,6 @@ final class PHPStanStaticTypeMapper
|
||||
return $typeMapper->mapToDocString($type, $parentType);
|
||||
}
|
||||
|
||||
throw new NotImplementedException(__METHOD__ . ' for ' . get_class($type));
|
||||
throw new NotImplementedYetException(__METHOD__ . ' for ' . get_class($type));
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\Exception\NotImplementedException;
|
||||
use Rector\Core\Exception\NotImplementedYetException;
|
||||
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
|
||||
|
||||
final class PhpParserNodeMapper
|
||||
@ -42,6 +42,6 @@ final class PhpParserNodeMapper
|
||||
return $phpParserNodeMapper->mapToPHPStan($node);
|
||||
}
|
||||
|
||||
throw new NotImplementedException(get_class($node));
|
||||
throw new NotImplementedYetException(get_class($node));
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\Type\Generic\TemplateTypeMap;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\Exception\NotImplementedException;
|
||||
use Rector\Core\Exception\NotImplementedYetException;
|
||||
use Rector\Core\Util\StaticInstanceOf;
|
||||
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
|
||||
use Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper;
|
||||
@ -107,7 +107,7 @@ final class StaticTypeMapper
|
||||
return $this->mapPHPStanPhpDocTypeNodeToPHPStanType($phpDocTagValueNode->type, $node);
|
||||
}
|
||||
|
||||
throw new NotImplementedException(__METHOD__ . ' for ' . get_class($phpDocTagValueNode));
|
||||
throw new NotImplementedYetException(__METHOD__ . ' for ' . get_class($phpDocTagValueNode));
|
||||
}
|
||||
|
||||
public function mapPHPStanPhpDocTypeNodeToPhpDocString(TypeNode $typeNode, Node $node): string
|
||||
|
@ -8,11 +8,11 @@ use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\FunctionLike;
|
||||
use Rector\Core\Context\ContextAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\DeadCode\NodeCollector\NodeByTypeAndPositionCollector;
|
||||
use Rector\DeadCode\NodeFinder\VariableUseFinder;
|
||||
use Rector\DeadCode\ValueObject\VariableNodeUse;
|
||||
use Rector\NodeNestingScope\ContextAnalyzer;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -9,7 +9,7 @@ use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\Core\Exception\NotImplementedException;
|
||||
use Rector\Core\Exception\NotImplementedYetException;
|
||||
use Rector\NodeCollector\NodeCollector\ParsedNodeCollector;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
@ -107,7 +107,7 @@ final class UnusedClassResolver
|
||||
$paramTypeName = $this->nodeNameResolver->getName($param->type);
|
||||
$classNames[] = $paramTypeName;
|
||||
} else {
|
||||
throw new NotImplementedException();
|
||||
throw new NotImplementedYetException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use Rector\Core\Exception\Bridge\RectorProviderException;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\PhpParser\Node\Manipulator\ClassDependencyManipulator;
|
||||
use Rector\Core\PhpParser\Node\Manipulator\ClassInsertManipulator;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
@ -150,7 +150,7 @@ CODE_SAMPLE
|
||||
$repositoryClassName = (string) $repositoryClass->getAttribute(AttributeKey::CLASS_NAME);
|
||||
|
||||
if (! $entityObjectType instanceof TypeWithClassName) {
|
||||
throw new RectorProviderException(sprintf(
|
||||
throw new ShouldNotHappenException(sprintf(
|
||||
'An entity was not found for "%s" repository.',
|
||||
$repositoryClassName,
|
||||
));
|
||||
|
@ -19,7 +19,7 @@ use Rector\BetterPhpDocParser\ValueObject\PhpDocNode\JMS\JMSInjectTagValueNode;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocNode\PHPDI\PHPDIInjectTagValueNode;
|
||||
use Rector\ChangesReporting\Application\ErrorAndDiffCollector;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Exception\NotImplementedException;
|
||||
use Rector\Core\Exception\NotImplementedYetException;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
@ -182,7 +182,7 @@ CODE_SAMPLE
|
||||
implode('", "', $availableAnnotations)
|
||||
);
|
||||
|
||||
throw new NotImplementedException($errorMessage);
|
||||
throw new NotImplementedYetException($errorMessage);
|
||||
}
|
||||
|
||||
private function isParameterInject(PhpDocTagValueNode $phpDocTagValueNode): bool
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->defaults()
|
||||
->public()
|
||||
->autowire()
|
||||
->autoconfigure();
|
||||
|
||||
$services->load('Rector\MagicDisclosure\\', __DIR__ . '/../src')
|
||||
->exclude([__DIR__ . '/../src/Rector', __DIR__ . '/../src/ValueObject']);
|
||||
};
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source;
|
||||
|
||||
class Klarka
|
||||
{
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
function unsetAndIsset()
|
||||
{
|
||||
$container = new \Rector\MagicDisclosure\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Source\LocalContainer;
|
||||
isset($container['someService']);
|
||||
unset($container['someService']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
function unsetAndIsset()
|
||||
{
|
||||
$container = new \Rector\MagicDisclosure\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Source\LocalContainer;
|
||||
$container->hasService('someService');
|
||||
$container->removeService('someService');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Source;
|
||||
|
||||
final class LocalContainer
|
||||
{
|
||||
|
||||
}
|
@ -24,7 +24,6 @@ use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Type\ThisType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\CodingStyle\Naming\ClassNaming;
|
||||
use Rector\Core\Exception\NotImplementedException;
|
||||
use Rector\Core\Exception\NotImplementedYetException;
|
||||
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
||||
use Rector\Core\Util\StaticInstanceOf;
|
||||
@ -166,7 +165,7 @@ final class VariableNaming
|
||||
}
|
||||
|
||||
if (! $node instanceof Node) {
|
||||
throw new NotImplementedException();
|
||||
throw new NotImplementedYetException();
|
||||
}
|
||||
|
||||
$paramName = $this->nodeNameResolver->getName($node);
|
||||
@ -236,12 +235,12 @@ final class VariableNaming
|
||||
{
|
||||
$varName = $this->nodeNameResolver->getName($propertyFetch->var);
|
||||
if (! is_string($varName)) {
|
||||
throw new NotImplementedException();
|
||||
throw new NotImplementedYetException();
|
||||
}
|
||||
|
||||
$propertyName = $this->nodeNameResolver->getName($propertyFetch->name);
|
||||
if (! is_string($propertyName)) {
|
||||
throw new NotImplementedException();
|
||||
throw new NotImplementedYetException();
|
||||
}
|
||||
|
||||
if ($varName === 'this') {
|
||||
|
@ -11,7 +11,7 @@ use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use Rector\Core\Exception\NotImplementedException;
|
||||
use Rector\Core\Exception\NotImplementedYetException;
|
||||
use Rector\NetteKdyby\NodeManipulator\GetSubscribedEventsArrayManipulator;
|
||||
use Rector\NetteKdyby\NodeManipulator\ListeningClassMethodArgumentManipulator;
|
||||
use Rector\NetteKdyby\NodeResolver\ListeningMethodsCollector;
|
||||
@ -181,6 +181,6 @@ CODE_SAMPLE
|
||||
return (string) Strings::after($kdybyEventName, '::', - 1);
|
||||
}
|
||||
|
||||
throw new NotImplementedException($kdybyEventName);
|
||||
throw new NotImplementedYetException($kdybyEventName);
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ namespace Rector\Php70\Rector\Break_;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Break_;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use Rector\Core\Context\ContextAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeNestingScope\ContextAnalyzer;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
||||
|
@ -6,11 +6,10 @@ namespace Rector\PHPUnit\NodeFactory;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use Rector\Core\PhpParser\Node\NodeFactory;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\PhpSpecToPHPUnit\PHPUnitTypeDeclarationDecorator;
|
||||
use Rector\PHPUnit\NodeManipulator\StmtManipulator;
|
||||
use Rector\RemovingStatic\NodeFactory\SetUpFactory;
|
||||
use Symplify\Astral\ValueObject\NodeBuilder\MethodBuilder;
|
||||
|
||||
final class SetUpClassMethodFactory
|
||||
@ -20,24 +19,24 @@ final class SetUpClassMethodFactory
|
||||
*/
|
||||
private $phpUnitTypeDeclarationDecorator;
|
||||
|
||||
/**
|
||||
* @var NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
|
||||
/**
|
||||
* @var StmtManipulator
|
||||
*/
|
||||
private $stmtManipulator;
|
||||
|
||||
/**
|
||||
* @var SetUpFactory
|
||||
*/
|
||||
private $setUpFactory;
|
||||
|
||||
public function __construct(
|
||||
PHPUnitTypeDeclarationDecorator $phpUnitTypeDeclarationDecorator,
|
||||
NodeFactory $nodeFactory,
|
||||
StmtManipulator $stmtManipulator
|
||||
StmtManipulator $stmtManipulator,
|
||||
SetUpFactory $setUpFactory
|
||||
) {
|
||||
$this->phpUnitTypeDeclarationDecorator = $phpUnitTypeDeclarationDecorator;
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
$this->stmtManipulator = $stmtManipulator;
|
||||
$this->setUpFactory = $setUpFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,7 +49,7 @@ final class SetUpClassMethodFactory
|
||||
$classMethodBuilder = new MethodBuilder(MethodName::SET_UP);
|
||||
$classMethodBuilder->makeProtected();
|
||||
|
||||
$classMethodBuilder->addStmt($this->createParentSetUpStaticCall());
|
||||
$classMethodBuilder->addStmt($this->setUpFactory->createParentStaticCall());
|
||||
$classMethodBuilder->addStmts($stmts);
|
||||
|
||||
$classMethod = $classMethodBuilder->getNode();
|
||||
@ -58,10 +57,4 @@ final class SetUpClassMethodFactory
|
||||
|
||||
return $classMethod;
|
||||
}
|
||||
|
||||
private function createParentSetUpStaticCall(): Expression
|
||||
{
|
||||
$parentSetupStaticCall = $this->nodeFactory->createStaticCall('parent', MethodName::SET_UP);
|
||||
return new Expression($parentSetupStaticCall);
|
||||
}
|
||||
}
|
||||
|
28
rules/removing-static/src/NodeFactory/SetUpFactory.php
Normal file
28
rules/removing-static/src/NodeFactory/SetUpFactory.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\RemovingStatic\NodeFactory;
|
||||
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use Rector\Core\PhpParser\Node\NodeFactory;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
|
||||
final class SetUpFactory
|
||||
{
|
||||
/**
|
||||
* @var NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
|
||||
public function createParentStaticCall(): Expression
|
||||
{
|
||||
$parentSetupStaticCall = $this->nodeFactory->createStaticCall('parent', MethodName::SET_UP);
|
||||
return new Expression($parentSetupStaticCall);
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@ use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Naming\Naming\PropertyNaming;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\PHPUnit\NodeFactory\SetUpClassMethodFactory;
|
||||
use Rector\RemovingStatic\NodeFactory\SetUpFactory;
|
||||
use Rector\RemovingStatic\ValueObject\PHPUnitClass;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
@ -68,14 +69,21 @@ final class PHPUnitStaticToKernelTestCaseGetRector extends AbstractRector implem
|
||||
*/
|
||||
private $setUpClassMethodFactory;
|
||||
|
||||
/**
|
||||
* @var SetUpFactory
|
||||
*/
|
||||
private $setUpFactory;
|
||||
|
||||
public function __construct(
|
||||
PropertyNaming $propertyNaming,
|
||||
ClassInsertManipulator $classInsertManipulator,
|
||||
SetUpClassMethodFactory $setUpClassMethodFactory
|
||||
SetUpClassMethodFactory $setUpClassMethodFactory,
|
||||
SetUpFactory $setUpFactory
|
||||
) {
|
||||
$this->propertyNaming = $propertyNaming;
|
||||
$this->classInsertManipulator = $classInsertManipulator;
|
||||
$this->setUpClassMethodFactory = $setUpClassMethodFactory;
|
||||
$this->setUpFactory = $setUpFactory;
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
@ -209,7 +217,7 @@ CODE_SAMPLE
|
||||
// add all properties to class
|
||||
$class = $this->addNewPropertiesToClass($class, $newPropertyTypes);
|
||||
|
||||
$parentSetUpStaticCallExpression = $this->createParentSetUpStaticCall();
|
||||
$parentSetUpStaticCallExpression = $this->setUpFactory->createParentStaticCall();
|
||||
foreach ($newPropertyTypes as $type) {
|
||||
// container fetch assign
|
||||
$assign = $this->createContainerGetTypeToPropertyAssign($type);
|
||||
@ -289,12 +297,6 @@ CODE_SAMPLE
|
||||
return $class;
|
||||
}
|
||||
|
||||
private function createParentSetUpStaticCall(): Expression
|
||||
{
|
||||
$parentSetupStaticCall = $this->nodeFactory->createStaticCall('parent', MethodName::SET_UP);
|
||||
return new Expression($parentSetupStaticCall);
|
||||
}
|
||||
|
||||
private function createContainerGetTypeToPropertyAssign(ObjectType $objectType): Expression
|
||||
{
|
||||
$getMethodCall = $this->createContainerGetTypeMethodCall($objectType);
|
||||
|
@ -4,14 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\Removing\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Comment;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use Rector\Core\Comments\CommentableNodeResolver;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeRemoval\BreakingRemovalGuard;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Removing\ValueObject\RemoveFuncCall;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
@ -40,17 +37,9 @@ final class RemoveFuncCallRector extends AbstractRector implements ConfigurableR
|
||||
*/
|
||||
private $breakingRemovalGuard;
|
||||
|
||||
/**
|
||||
* @var CommentableNodeResolver
|
||||
*/
|
||||
private $commentableNodeResolver;
|
||||
|
||||
public function __construct(
|
||||
BreakingRemovalGuard $breakingRemovalGuard,
|
||||
CommentableNodeResolver $commentableNodeResolver
|
||||
) {
|
||||
public function __construct(BreakingRemovalGuard $breakingRemovalGuard)
|
||||
{
|
||||
$this->breakingRemovalGuard = $breakingRemovalGuard;
|
||||
$this->commentableNodeResolver = $commentableNodeResolver;
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
@ -126,9 +115,6 @@ CODE_SAMPLE
|
||||
|
||||
if ($this->breakingRemovalGuard->isLegalNodeRemoval($funcCall)) {
|
||||
$this->removeNode($funcCall);
|
||||
} else {
|
||||
$commentableNode = $this->commentableNodeResolver->resolve($funcCall);
|
||||
$commentableNode->setAttribute(AttributeKey::COMMENTS, [new Comment('// @fixme')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Removing\Tests\Rector\FuncCall\RemoveFuncCallRector\Fixture;
|
||||
|
||||
class GetAssign
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$getAssign = ini_get('safe_mode');
|
||||
|
||||
$notGetAssign = ! ini_get('safe_mode');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Removing\Tests\Rector\FuncCall\RemoveFuncCallRector\Fixture;
|
||||
|
||||
class GetAssign
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
// @fixme
|
||||
$getAssign = ini_get('safe_mode');
|
||||
|
||||
// @fixme
|
||||
$notGetAssign = ! ini_get('safe_mode');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Removing\Tests\Rector\FuncCall\RemoveFuncCallRector\Fixture;
|
||||
|
||||
class SkipAssign
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$getAssign = ini_get('safe_mode');
|
||||
|
||||
$notGetAssign = ! ini_get('safe_mode');
|
||||
}
|
||||
}
|
@ -17,8 +17,8 @@ use PhpParser\Node\Stmt\UseUse;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\TypeAwareTagValueNodeInterface;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocClassRenamer;
|
||||
use Rector\CodingStyle\Naming\ClassNaming;
|
||||
use Rector\Core\PhpDoc\PhpDocClassRenamer;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\ClassExistenceStaticHelper;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\Rector\Assign;
|
||||
namespace Rector\Transform\Rector\Assign;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
@ -21,7 +21,7 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
||||
/**
|
||||
* @see \Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\GetAndSetToMethodCallRectorTest
|
||||
* @see \Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\GetAndSetToMethodCallRectorTest
|
||||
*/
|
||||
final class GetAndSetToMethodCallRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\Rector\Isset_;
|
||||
namespace Rector\Transform\Rector\Isset_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
@ -10,13 +10,13 @@ use PhpParser\Node\Expr\Isset_;
|
||||
use PhpParser\Node\Stmt\Unset_;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\MagicDisclosure\ValueObject\IssetUnsetToMethodCall;
|
||||
use Rector\Transform\ValueObject\IssetUnsetToMethodCall;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* @see \Rector\MagicDisclosure\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\UnsetAndIssetToMethodCallRectorTest
|
||||
* @see \Rector\Transform\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\UnsetAndIssetToMethodCallRectorTest
|
||||
*/
|
||||
final class UnsetAndIssetToMethodCallRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\Rector\String_;
|
||||
namespace Rector\Transform\Rector\String_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Cast\String_;
|
||||
@ -14,7 +14,7 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
||||
/**
|
||||
* @see \Rector\MagicDisclosure\Tests\Rector\String_\ToStringToMethodCallRector\ToStringToMethodCallRectorTest
|
||||
* @see \Rector\Transform\Tests\Rector\String_\ToStringToMethodCallRector\ToStringToMethodCallRectorTest
|
||||
*/
|
||||
final class ToStringToMethodCallRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\ValueObject;
|
||||
namespace Rector\Transform\ValueObject;
|
||||
|
||||
final class IssetUnsetToMethodCall
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\SomeContainer;
|
||||
use Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\SomeContainer;
|
||||
|
||||
function getAndSetToMethodCall2()
|
||||
{
|
||||
@ -14,7 +14,7 @@ function getAndSetToMethodCall2()
|
||||
-----
|
||||
<?php
|
||||
|
||||
use Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\SomeContainer;
|
||||
use Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\SomeContainer;
|
||||
|
||||
function getAndSetToMethodCall2()
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\SomeContainer;
|
||||
use Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\SomeContainer;
|
||||
|
||||
function getAndSetToMethodCall()
|
||||
{
|
||||
@ -18,7 +18,7 @@ function getAndSetToMethodCall()
|
||||
-----
|
||||
<?php
|
||||
|
||||
use Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\SomeContainer;
|
||||
use Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\SomeContainer;
|
||||
|
||||
function getAndSetToMethodCall()
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Fixture;
|
||||
namespace Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Fixture;
|
||||
|
||||
use Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\Klarka;
|
||||
use Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\Klarka;
|
||||
|
||||
class KlarkaExtended extends Klarka
|
||||
{
|
||||
@ -28,9 +28,9 @@ class KlarkaExtended extends Klarka
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Fixture;
|
||||
namespace Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Fixture;
|
||||
|
||||
use Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\Klarka;
|
||||
use Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\Klarka;
|
||||
|
||||
class KlarkaExtended extends Klarka
|
||||
{
|
@ -2,13 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector;
|
||||
namespace Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\MagicDisclosure\Rector\Assign\GetAndSetToMethodCallRector;
|
||||
use Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\Klarka;
|
||||
use Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\SomeContainer;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Transform\Rector\Assign\GetAndSetToMethodCallRector;
|
||||
use Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\Klarka;
|
||||
use Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source\SomeContainer;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class GetAndSetToMethodCallRectorTest extends AbstractRectorTestCase
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source;
|
||||
|
||||
class Klarka
|
||||
{
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source;
|
||||
namespace Rector\Transform\Tests\Rector\Assign\GetAndSetToMethodCallRector\Source;
|
||||
|
||||
final class SomeContainer
|
||||
{
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Transform\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
function unsetAndIsset()
|
||||
{
|
||||
$container = new \Rector\Transform\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Source\LocalContainer;
|
||||
isset($container['someService']);
|
||||
unset($container['someService']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Transform\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
function unsetAndIsset()
|
||||
{
|
||||
$container = new \Rector\Transform\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Source\LocalContainer;
|
||||
$container->hasService('someService');
|
||||
$container->removeService('someService');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Transform\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Source;
|
||||
|
||||
final class LocalContainer
|
||||
{
|
||||
|
||||
}
|
@ -2,13 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector;
|
||||
namespace Rector\Transform\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\MagicDisclosure\Rector\Isset_\UnsetAndIssetToMethodCallRector;
|
||||
use Rector\MagicDisclosure\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Source\LocalContainer;
|
||||
use Rector\MagicDisclosure\ValueObject\IssetUnsetToMethodCall;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Transform\Rector\Isset_\UnsetAndIssetToMethodCallRector;
|
||||
use Rector\Transform\Tests\Rector\Isset_\UnsetAndIssetToMethodCallRector\Source\LocalContainer;
|
||||
use Rector\Transform\ValueObject\IssetUnsetToMethodCall;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class UnsetAndIssetToMethodCallRectorTest extends AbstractRectorTestCase
|
@ -2,11 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\String_\ToStringToMethodCallRector;
|
||||
namespace Rector\Transform\Tests\Rector\String_\ToStringToMethodCallRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\MagicDisclosure\Rector\String_\ToStringToMethodCallRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Transform\Rector\String_\ToStringToMethodCallRector;
|
||||
use Symfony\Component\Config\ConfigCache;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Comments;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
|
||||
/**
|
||||
* Resolve nearest node, where we can add comment
|
||||
*/
|
||||
final class CommentableNodeResolver
|
||||
{
|
||||
public function resolve(Node $node): Node
|
||||
{
|
||||
$currentNode = $node;
|
||||
$previousNode = $node;
|
||||
|
||||
while (! $currentNode instanceof Stmt) {
|
||||
$currentNode = $currentNode->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (! $currentNode instanceof Node) {
|
||||
return $previousNode;
|
||||
}
|
||||
|
||||
$previousNode = $currentNode;
|
||||
}
|
||||
|
||||
return $currentNode;
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception\Application;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class PhpVersionException extends Exception
|
||||
{
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception\Bridge;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class RectorProviderException extends Exception
|
||||
{
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception\Command;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class FileProcessingException extends Exception
|
||||
{
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception\Configuration;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class InvalidConfigurationTypeException extends Exception
|
||||
{
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception\Configuration;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class RectorRuleNotFoundException extends Exception
|
||||
{
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception\DependencyInjection;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class ClassNotFoundException extends Exception
|
||||
{
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception\Linter;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class LintingException extends Exception
|
||||
{
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class NotImplementedException extends Exception
|
||||
{
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception\Rector;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class InvalidRectorException extends Exception
|
||||
{
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception\Rector;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class RectorNotFoundOrNotValidRectorClassException extends Exception
|
||||
{
|
||||
public function __construct(string $rector)
|
||||
{
|
||||
$message = sprintf('"%s" was not found or is not valid Rector class', $rector);
|
||||
|
||||
parent::__construct($message);
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class ShouldBeImplementedException extends Exception
|
||||
{
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Exception\Validator;
|
||||
|
||||
use Exception;
|
||||
|
||||
final class InvalidRectorClassException extends Exception
|
||||
{
|
||||
}
|
@ -47,7 +47,7 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocNode\Nette\NetteInjectTagNode;
|
||||
use Rector\Core\Configuration\CurrentNodeProvider;
|
||||
use Rector\Core\Exception\NotImplementedException;
|
||||
use Rector\Core\Exception\NotImplementedYetException;
|
||||
use Rector\Core\Php\PhpVersionProvider;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
@ -631,7 +631,7 @@ final class NodeFactory
|
||||
return $this->createArrayItemWithKey($key, $arrayItem);
|
||||
}
|
||||
|
||||
throw new NotImplementedException(sprintf(
|
||||
throw new NotImplementedYetException(sprintf(
|
||||
'Not implemented yet. Go to "%s()" and add check for "%s" node.',
|
||||
__METHOD__,
|
||||
is_object($item) ? get_class($item) : $item
|
||||
|
@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace Rector\Core\Reflection;
|
||||
|
||||
use Nette\Utils\Reflection;
|
||||
use Rector\Core\PhpDoc\PhpDocTagsFinder;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagsFinder;
|
||||
use ReflectionMethod;
|
||||
|
||||
final class ClassMethodReflectionHelper
|
||||
|
@ -7,8 +7,8 @@ namespace Rector\Core\Reflection;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
use PhpParser\Node\Stmt\UseUse;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagsFinder;
|
||||
use Rector\CodingStyle\Naming\ClassNaming;
|
||||
use Rector\Core\PhpDoc\PhpDocTagsFinder;
|
||||
use Rector\Core\PhpParser\Parser\FunctionLikeParser;
|
||||
use ReflectionFunction;
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3383\DoNotReImportFunction;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotReImportFunctionTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3383\DoNotReImportFunction\Fixture;
|
||||
|
||||
use function Rector\Transform\Tests\Rector\FuncCall\FuncCallToMethodCallRector\Source\some_view_function;
|
||||
|
||||
some_view_function();
|
||||
|
||||
?>
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SETS, [SetList::DEAD_CODE]);
|
||||
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3388\DoNotChangeAnnotationRouteLocalization;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotChangeAnnotationRouteLocalizationTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3388\DoNotChangeAnnotationRouteLocalization\Fixture;
|
||||
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class TestController
|
||||
{
|
||||
/**
|
||||
* @Route({
|
||||
* "en": "/about-us",
|
||||
* "nl": "/over-ons"
|
||||
* }, name="about_us")
|
||||
*/
|
||||
public function about()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SETS, [SetList::DEAD_CODE]);
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3673\DoNotChangeAnnotationComment;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotChangeAnnotationCommentTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3673\DoNotChangeAnnotationComment\Fixture;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
class DemoEntity
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="test", type="string", length=255, nullable=true, options={"comment"="The comment fails"})
|
||||
*/
|
||||
private $test;
|
||||
}
|
||||
|
||||
?>
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SETS, [SetList::DEAD_CODE]);
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4191\DoNotDuplicateComment;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotDuplicateCommentTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4191\DoNotDuplicateComment\Fixture;
|
||||
|
||||
// First Comment
|
||||
// Second Comment
|
||||
/**
|
||||
*/
|
||||
class a {}
|
||||
|
||||
?>
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4191\DoNotDuplicateComment\Fixture;
|
||||
|
||||
// first comment
|
||||
// second comment
|
||||
// third comment
|
||||
class b {}
|
||||
|
||||
/**
|
||||
*/
|
||||
// forth comment
|
||||
// fifth comment
|
||||
// sixth comment
|
||||
class c {}
|
||||
|
||||
?>
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SETS, [SetList::DEAD_CODE]);
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4274_4573\DoNotChangeAnnotationCallback;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotChangeAnnotationCallbackTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4274_4573\DoNotChangeAnnotationCallback\Fixture;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
final class SkipAnnotationCallback
|
||||
{
|
||||
/**
|
||||
* @Assert\Choice(callback={Invoice::class, "typeChoices"})
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @Assert\Choice(callback={Invoice::class, "typeChoices2"})
|
||||
*/
|
||||
private $type2;
|
||||
}
|
||||
|
||||
?>
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4274_4573\DoNotChangeAnnotationCallback\Fixture;
|
||||
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/route/{view}.{_format}", name="views.test", defaults={"_format":"json"}, methods={"POST"})
|
||||
*/
|
||||
public function updateAction()
|
||||
{
|
||||
return 'oops';
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Php74\Rector\Property\TypedPropertyRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
// put anything here
|
||||
$services->set(TypedPropertyRector::class);
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4476\DoNotChangeAnnotationConstraint;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotChangeAnnotationConstraintTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4476\DoNotChangeAnnotationConstraint\Fixture;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table(name="UserPasswordReset", uniqueConstraints={
|
||||
* @ORM\UniqueConstraint(
|
||||
* name="unique_reset", columns={
|
||||
* "token",
|
||||
* "bar"
|
||||
* }
|
||||
* )
|
||||
* })
|
||||
*/
|
||||
class UserPasswordReset {}
|
||||
|
||||
?>
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SETS, [SetList::DEAD_CODE]);
|
||||
};
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4581\DoNotChangeAnnotationColumn;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotChangeAnnotationColumnTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @requires PHP 7.4
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4581\DoNotChangeAnnotationColumn\Fixture;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Entity\Traits\TimestampableEntity;
|
||||
|
||||
/**
|
||||
* Sessions
|
||||
*
|
||||
* @ORM\Table(name="sessions")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class Session
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="sess_id", type="string", length=128, nullable=false)
|
||||
* @ORM\Id
|
||||
*/
|
||||
protected string $id;
|
||||
|
||||
/** @ORM\Column(name="sess_data", type="blob") */
|
||||
protected string $data;
|
||||
|
||||
/** @ORM\Column(name="sess_time", type="integer", options={"unsigned"=true}) */
|
||||
protected int $time;
|
||||
|
||||
/** @ORM\Column(name="sess_lifetime", type="integer", options={"default"="84600"}) */
|
||||
protected int $lifetime = 84600;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\User\User")
|
||||
* @ORM\JoinColumn(name="user_id")
|
||||
*/
|
||||
protected ?int $user = null;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Php74\Rector\Property\TypedPropertyRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
// put anything here
|
||||
$services->set(TypedPropertyRector::class);
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4620\DoNotChangeAnnotationRouteOption;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotChangeAnnotationRouteOptionTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4620\DoNotChangeAnnotationRouteOption\Fixture;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Class InvoiceAdminController.
|
||||
*/
|
||||
class InvoiceAdminController
|
||||
{
|
||||
/**
|
||||
* @Route("/admin/invoice/show/{id}", options={ "expose" = true, "another_option" = false }, name="invoice_admin_show")
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function showAction(Request $request, $id)
|
||||
{
|
||||
var_dump($request, $id);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SETS, [SetList::DEAD_CODE]);
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4652\DoNotChangeExplicitCommentFormat;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotChangeExplicitCommentFormatTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4652\DoNotChangeExplicitCommentFormat\Fixture;
|
||||
|
||||
/**
|
||||
* @return (0)
|
||||
*/
|
||||
function one(int $value)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ""|"0"
|
||||
*/
|
||||
function two(int $value)
|
||||
{
|
||||
}
|
||||
|
||||
one(1);
|
||||
two(2);
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SETS, [SetList::DEAD_CODE]);
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4691\DoNotChangeExplicitQuotedStringComment;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotChangeExplicitQuotedStringCommentTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue4691\DoNotChangeExplicitQuotedStringComment\Fixture;
|
||||
|
||||
final class SkipExplicitFormat
|
||||
{
|
||||
/**
|
||||
* @var boolean|"frozen"|array
|
||||
*/
|
||||
public $use_session = \true;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SETS, [SetList::DEAD_CODE]);
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue5267\DoNotThrowShouldNotHappenException;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DoNotThrowShouldNotHappenExceptionTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
// bin/rector process ... --config config/some_config.php
|
||||
|
||||
protected function provideConfigFileInfo(): SmartFileInfo
|
||||
{
|
||||
return new SmartFileInfo(__DIR__ . '/config/some_config.php');
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue5267\DoNotThrowShouldNotHappenException\Fixture;
|
||||
|
||||
use Rector\Core\Tests\Issues\Issue5267\DoNotThrowShouldNotHappenException\Source\Xyz;
|
||||
|
||||
class SkipThrowShouldNotHappenException
|
||||
{
|
||||
public function fails(Xyz $xyz): void
|
||||
{
|
||||
$xyz->abc->get('xxx');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue5267\DoNotThrowShouldNotHappenException\Source;
|
||||
|
||||
class Xyz
|
||||
{
|
||||
/**
|
||||
* @var Xyz
|
||||
*/
|
||||
public $abc;
|
||||
|
||||
public function get(string $s): string
|
||||
{
|
||||
return $s;
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SETS, [SetList::DEAD_CODE]);
|
||||
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
|
||||
};
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* some comment */
|
||||
$value = 1;
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
|
||||
$value = 1;
|
||||
|
||||
?>
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
$value = 1;// some comment
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
$value = 1;
|
||||
|
||||
?>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user