mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-28 23:10:51 +00:00
Various stabilizations (#5381)
This commit is contained in:
parent
737b6471c2
commit
e2757242be
|
@ -31,6 +31,8 @@ use Rector\DeadCode\Rector\FunctionLike\RemoveDuplicatedIfReturnRector;
|
|||
use Rector\DeadCode\Rector\FunctionLike\RemoveOverriddenValuesRector;
|
||||
use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
|
||||
use Rector\DeadCode\Rector\If_\SimplifyIfElseWithSameContentRector;
|
||||
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
|
||||
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
|
||||
use Rector\DeadCode\Rector\MethodCall\RemoveDefaultArgumentValueRector;
|
||||
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
|
||||
use Rector\DeadCode\Rector\Property\RemoveSetterOnlyPropertyAndMethodCallRector;
|
||||
|
@ -48,6 +50,10 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(UnwrapFutureCompatibleIfFunctionExistsRector::class);
|
||||
|
||||
$services->set(UnwrapFutureCompatibleIfPhpVersionRector::class);
|
||||
|
||||
$services->set(RecastingRemovalRector::class);
|
||||
|
||||
$services->set(RemoveDeadStmtRector::class);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\TypeDeclaration\OverrideGuard;
|
||||
namespace Rector\VendorLocker\NodeVendorLocker;
|
||||
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\NodeVisitor;
|
|
@ -536,3 +536,10 @@ parameters:
|
|||
- '#Content of method "getFunctionLikePhpDocInfo\(\)" is duplicated with method "getFunctionLikePhpDocInfo\(\)" in "Rector\\NodeTypeResolver\\NodeTypeResolver\\ParamTypeResolver" class\. Use unique content or abstract service instead#'
|
||||
# constants
|
||||
- '#Parameter \#1 \$types of method Rector\\BetterPhpDocParser\\PhpDocInfo\\PhpDocInfo\:\:hasByTypes\(\) expects array<class\-string<PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\>\>, array<int, (.*?)\> given#'
|
||||
|
||||
# part of the rule, depends on PHP version
|
||||
-
|
||||
message: '#Unreachable statement \- code above always terminates#'
|
||||
paths:
|
||||
- rules/php71/src/Rector/BooleanOr/IsIterableRector.php
|
||||
- rules/php73/src/Rector/BooleanOr/IsCountableRector.php
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Composer\Rector;
|
||||
|
||||
use Rector\Composer\Contract\Rector\ComposerRectorInterface;
|
||||
use Rector\Composer\Contract\Rector\CoreComposerRectorInterface;
|
||||
use Rector\Composer\Guard\VersionGuard;
|
||||
use Rector\Composer\ValueObject\PackageAndVersion;
|
||||
use Symplify\ComposerJsonManipulator\ValueObject\ComposerJson;
|
||||
|
@ -14,7 +15,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
/**
|
||||
* @see \Rector\Composer\Tests\Rector\AddPackageToRequireComposerRector\AddPackageToRequireComposerRectorTest
|
||||
*/
|
||||
final class AddPackageToRequireComposerRector implements ComposerRectorInterface
|
||||
final class AddPackageToRequireComposerRector implements CoreComposerRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Composer\Rector;
|
||||
|
||||
use Rector\Composer\Contract\Rector\ComposerRectorInterface;
|
||||
use Rector\Composer\Contract\Rector\CoreComposerRectorInterface;
|
||||
use Rector\Composer\Guard\VersionGuard;
|
||||
use Rector\Composer\ValueObject\PackageAndVersion;
|
||||
use Symplify\ComposerJsonManipulator\ValueObject\ComposerJson;
|
||||
|
@ -14,7 +15,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
/**
|
||||
* @see \Rector\Composer\Tests\Rector\AddPackageToRequireDevComposerRector\AddPackageToRequireDevComposerRectorTest
|
||||
*/
|
||||
final class AddPackageToRequireDevComposerRector implements ComposerRectorInterface
|
||||
final class AddPackageToRequireDevComposerRector implements CoreComposerRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Composer\Rector;
|
||||
|
||||
use Rector\Composer\Contract\Rector\ComposerRectorInterface;
|
||||
use Rector\Composer\Contract\Rector\CoreComposerRectorInterface;
|
||||
use Rector\Composer\Guard\VersionGuard;
|
||||
use Rector\Composer\ValueObject\PackageAndVersion;
|
||||
use Symplify\ComposerJsonManipulator\ValueObject\ComposerJson;
|
||||
|
@ -14,7 +15,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
/**
|
||||
* @see \Rector\Composer\Tests\Rector\ChangePackageVersionComposerRector\ChangePackageVersionComposerRectorTest
|
||||
*/
|
||||
final class ChangePackageVersionComposerRector implements ComposerRectorInterface
|
||||
final class ChangePackageVersionComposerRector implements CoreComposerRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Composer\Rector;
|
||||
|
||||
use Rector\Composer\Contract\Rector\ComposerRectorInterface;
|
||||
use Rector\Composer\Contract\Rector\CoreComposerRectorInterface;
|
||||
use Symplify\ComposerJsonManipulator\ValueObject\ComposerJson;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -12,7 +13,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
/**
|
||||
* @see \Rector\Composer\Tests\Rector\RemovePackageComposerRector\RemovePackageComposerRectorTest
|
||||
*/
|
||||
final class RemovePackageComposerRector implements ComposerRectorInterface
|
||||
final class RemovePackageComposerRector implements CoreComposerRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Composer\Rector;
|
||||
|
||||
use Rector\Composer\Contract\Rector\ComposerRectorInterface;
|
||||
use Rector\Composer\Contract\Rector\CoreComposerRectorInterface;
|
||||
use Rector\Composer\Guard\VersionGuard;
|
||||
use Rector\Composer\ValueObject\ReplacePackageAndVersion;
|
||||
use Symplify\ComposerJsonManipulator\ValueObject\ComposerJson;
|
||||
|
@ -14,7 +15,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
/**
|
||||
* @see \Rector\Composer\Tests\Rector\ReplacePackageAndVersionComposerRector\ReplacePackageAndVersionComposerRectorTest
|
||||
*/
|
||||
final class ReplacePackageAndVersionComposerRector implements ComposerRectorInterface
|
||||
final class ReplacePackageAndVersionComposerRector implements CoreComposerRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
|
|
|
@ -7,7 +7,6 @@ namespace Rector\Php71\Rector\BooleanOr;
|
|||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\BinaryOp\BooleanOr;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Php71\IsArrayAndDualCheckToAble;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -56,10 +55,6 @@ final class IsIterableRector extends AbstractRector
|
|||
|
||||
private function shouldSkip(): bool
|
||||
{
|
||||
if (function_exists('is_iterable')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ! $this->isAtLeastPhpVersion(PhpVersionFeature::IS_ITERABLE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ namespace Rector\Php73\Rector\BooleanOr;
|
|||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\BinaryOp\BooleanOr;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Php71\IsArrayAndDualCheckToAble;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -67,10 +66,6 @@ CODE_SAMPLE
|
|||
|
||||
private function shouldSkip(): bool
|
||||
{
|
||||
if (function_exists('is_countable')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->isAtLeastPhpVersion(PhpVersionFeature::IS_COUNTABLE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\TypeDeclaration\NodeTypeAnalyzer;
|
||||
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
|
||||
final class TraitTypeAnalyzer
|
||||
{
|
||||
/**
|
||||
* @var NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
|
||||
/**
|
||||
* @var ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
|
||||
public function __construct(NodeTypeResolver $nodeTypeResolver, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
}
|
||||
|
||||
public function isTraitType(Type $type): bool
|
||||
{
|
||||
if (! $type instanceof TypeWithClassName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fullyQualifiedName = $this->nodeTypeResolver->getFullyQualifiedClassName($type);
|
||||
|
||||
$classReflection = $this->reflectionProvider->getClass($fullyQualifiedName);
|
||||
return $classReflection->isTrait();
|
||||
}
|
||||
}
|
|
@ -79,9 +79,11 @@ final class PhpParserTypeAnalyzer
|
|||
if (in_array($possibleSubtype, ['array', 'Traversable'], true) && $possibleParentType === 'iterable') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! in_array($possibleSubtype, ['array', 'ArrayIterator'], true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $possibleParentType === 'countable';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
|||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Privatization\TypeManipulator\NormalizeTypeToRespectArrayScalarType;
|
||||
use Rector\TypeDeclaration\OverrideGuard\ClassMethodReturnTypeOverrideGuard;
|
||||
use Rector\TypeDeclaration\TypeAnalyzer\AdvancedArrayAnalyzer;
|
||||
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer;
|
||||
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer\ReturnTypeDeclarationReturnTypeInferer;
|
||||
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
||||
|
|
|
@ -10,15 +10,13 @@ use PhpParser\Node\Param;
|
|||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\Node\Stmt\Interface_;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\DeadDocBlock\TagRemover\ParamTagRemover;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
|
||||
use Rector\TypeDeclaration\ChildPopulator\ChildParamPopulator;
|
||||
use Rector\TypeDeclaration\NodeTypeAnalyzer\TraitTypeAnalyzer;
|
||||
use Rector\TypeDeclaration\TypeInferer\ParamTypeInferer;
|
||||
use Rector\TypeDeclaration\ValueObject\NewType;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
|
@ -40,25 +38,25 @@ final class ParamTypeDeclarationRector extends AbstractTypeDeclarationRector
|
|||
private $childParamPopulator;
|
||||
|
||||
/**
|
||||
* @var NodeTypeResolver
|
||||
* @var TraitTypeAnalyzer
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
private $traitTypeAnalyzer;
|
||||
|
||||
/**
|
||||
* @var ReflectionProvider
|
||||
* @var ParamTagRemover
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
private $paramTagRemover;
|
||||
|
||||
public function __construct(
|
||||
ChildParamPopulator $childParamPopulator,
|
||||
ParamTypeInferer $paramTypeInferer,
|
||||
NodeTypeResolver $nodeTypeResolver,
|
||||
ReflectionProvider $reflectionProvider
|
||||
TraitTypeAnalyzer $traitTypeAnalyzer,
|
||||
ParamTagRemover $paramTagRemover
|
||||
) {
|
||||
$this->paramTypeInferer = $paramTypeInferer;
|
||||
$this->childParamPopulator = $childParamPopulator;
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->traitTypeAnalyzer = $traitTypeAnalyzer;
|
||||
$this->paramTagRemover = $paramTagRemover;
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
|
@ -116,9 +114,6 @@ final class ChildClass extends ParentClass
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $number
|
||||
*/
|
||||
public function change(int $number)
|
||||
{
|
||||
}
|
||||
|
@ -137,9 +132,7 @@ CODE_SAMPLE
|
|||
if (! $this->isAtLeastPhpVersion(PhpVersionFeature::SCALAR_TYPES)) {
|
||||
return null;
|
||||
}
|
||||
if ($node->params === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($node->params === []) {
|
||||
return null;
|
||||
}
|
||||
|
@ -165,7 +158,7 @@ CODE_SAMPLE
|
|||
return;
|
||||
}
|
||||
|
||||
if ($this->isTraitType($inferedType)) {
|
||||
if ($this->traitTypeAnalyzer->isTraitType($inferedType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -184,6 +177,10 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
$param->type = $paramTypeNode;
|
||||
|
||||
$functionLikePhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($functionLike);
|
||||
$this->paramTagRemover->removeParamTagsIfUseless($functionLikePhpDocInfo, $functionLike);
|
||||
|
||||
$this->childParamPopulator->populateChildClassMethod($functionLike, $position, $inferedType);
|
||||
}
|
||||
|
||||
|
@ -205,16 +202,4 @@ CODE_SAMPLE
|
|||
// already set → skip
|
||||
return ! $param->type->getAttribute(NewType::HAS_NEW_INHERITED_TYPE, false);
|
||||
}
|
||||
|
||||
private function isTraitType(Type $type): bool
|
||||
{
|
||||
if (! $type instanceof TypeWithClassName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fullyQualifiedName = $this->nodeTypeResolver->getFullyQualifiedClassName($type);
|
||||
$classReflection = $this->reflectionProvider->getClass($fullyQualifiedName);
|
||||
|
||||
return $classReflection->isTrait();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ use Rector\Core\ValueObject\PhpVersionFeature;
|
|||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
|
||||
use Rector\TypeDeclaration\ChildPopulator\ChildReturnPopulator;
|
||||
use Rector\TypeDeclaration\OverrideGuard\ClassMethodReturnTypeOverrideGuard;
|
||||
use Rector\TypeDeclaration\PhpDocParser\NonInformativeReturnTagRemover;
|
||||
use Rector\TypeDeclaration\TypeAlreadyAddedChecker\ReturnTypeAlreadyAddedChecker;
|
||||
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer;
|
||||
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer\ReturnTypeDeclarationReturnTypeInferer;
|
||||
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
class BoolClass
|
||||
{
|
||||
/**
|
||||
* @param true $ojoj
|
||||
* @param FALSE $ojoj2
|
||||
* @param true|false $ojoj3
|
||||
* @param int|null|true|false $ojoj5
|
||||
*/
|
||||
function someFunction(bool $ojoj, bool $ojoj2, bool $ojoj3, $ojoj5)
|
||||
|
|
|
@ -21,8 +21,6 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
interface BarInterface
|
||||
{
|
||||
/**
|
||||
* @param array $a
|
||||
* @param int $b
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
trait BazTrait
|
||||
{
|
||||
/**
|
||||
* @param int $a
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
|
|
|
@ -80,9 +80,6 @@ class Foo
|
|||
public function bar($foo)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @param float $a
|
||||
*/
|
||||
public function test(float $a)
|
||||
{
|
||||
$closure = function ($a, $c) {
|
||||
|
@ -93,7 +90,6 @@ class Foo
|
|||
trait BazTrait
|
||||
{
|
||||
/**
|
||||
* @param int $a
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
|
@ -105,8 +101,6 @@ trait BazTrait
|
|||
interface BarInterface
|
||||
{
|
||||
/**
|
||||
* @param array $a
|
||||
* @param int $b
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
|
|
|
@ -29,9 +29,6 @@ function not_by_reference($a)
|
|||
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
|
||||
|
||||
/**
|
||||
* @param string $a
|
||||
* @param array $b
|
||||
* @param int $c
|
||||
* @return bool
|
||||
*/
|
||||
function pass_by_reference(string $a, array &$b, int &$c)
|
||||
|
@ -42,9 +39,6 @@ $closure = function (&$a) {
|
|||
function pass_by_reference_undocumented(&$a, $b = 1 & 1)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @param string $a
|
||||
*/
|
||||
function not_by_reference(string $a)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -63,8 +63,6 @@ function foo()
|
|||
/**
|
||||
* Must be converted.
|
||||
*
|
||||
* @param int|null $c
|
||||
* @param string $d
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
|
|
|
@ -20,9 +20,6 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
function myFunction($param = false)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @param string $param
|
||||
*/
|
||||
function myOtherFunction(string $param)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -93,8 +93,6 @@ function foo()
|
|||
/**
|
||||
* Must be converted.
|
||||
*
|
||||
* @param \DateTime|null $a
|
||||
* @param int|null $c
|
||||
* @param string[]|null $d
|
||||
*
|
||||
* @return float
|
||||
|
|
|
@ -28,15 +28,10 @@ class AnyClass
|
|||
{}
|
||||
|
||||
/**
|
||||
* @param integer $integer
|
||||
* @param boolean $boolean
|
||||
* @param real $real
|
||||
* @param double $double
|
||||
* @param callback $callback
|
||||
* @param void $void
|
||||
* @param mixed $mixed
|
||||
* @param unknown $unknown
|
||||
* @param AnyClass $class
|
||||
*/
|
||||
function aliases(int $integer, bool $boolean, float $real, float $double, callable $callback, $void, $mixed, $unkown, \Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas\AnyClass $class) {
|
||||
}
|
||||
|
|
|
@ -38,9 +38,6 @@ final class ChildClass extends AbstractParentClass
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $number
|
||||
*/
|
||||
public function change(int $number)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -37,9 +37,6 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
|
||||
final class LocalChildClass extends AbstractLocalParentClass
|
||||
{
|
||||
/**
|
||||
* @param int $number
|
||||
*/
|
||||
public function change(int $number)
|
||||
{
|
||||
}
|
||||
|
@ -54,9 +51,6 @@ final class LocalChildClass extends AbstractLocalParentClass
|
|||
|
||||
abstract class AbstractLocalParentClass
|
||||
{
|
||||
/**
|
||||
* @param int $number
|
||||
*/
|
||||
public function changeToo(int $number)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -28,9 +28,6 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
|
||||
interface SniffInterface
|
||||
{
|
||||
/**
|
||||
* @param int $position
|
||||
*/
|
||||
public function process(string $file, int $position);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ new class {
|
|||
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\AnonClass;
|
||||
|
||||
new class {
|
||||
/** @param int $a */
|
||||
public function test(int $a) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@ class Number {
|
|||
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Basic;
|
||||
|
||||
/**
|
||||
* @param int $a
|
||||
* @param int $b
|
||||
* @return int
|
||||
*/
|
||||
function add2(int $a, int $b) {
|
||||
|
@ -39,8 +37,6 @@ function add2(int $a, int $b) {
|
|||
|
||||
class Number {
|
||||
/**
|
||||
* @param int $a
|
||||
* @param int $b
|
||||
* @return int
|
||||
*/
|
||||
public function add2(int $a, int $b) {
|
||||
|
|
|
@ -38,10 +38,8 @@ function foo() {
|
|||
/** @param null $a */
|
||||
function foo2($a) {}
|
||||
|
||||
/** @param null|A $a */
|
||||
function foo3(?\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Nikic\Null_\A $a = null) {}
|
||||
|
||||
/** @param null|A $a */
|
||||
function foo4(?\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Nikic\Null_\A $a) {}
|
||||
|
||||
?>
|
||||
|
|
|
@ -30,10 +30,6 @@ class Bar
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Foo|null $a
|
||||
* @param Bar|null $b
|
||||
*/
|
||||
function test2(?\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Nikic\Nullable\Foo $a, ?\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Nikic\Nullable\Bar $b = null) {}
|
||||
|
||||
?>
|
||||
|
|
|
@ -24,12 +24,10 @@ class Foo
|
|||
{}
|
||||
|
||||
class A {
|
||||
/** @param Foo $a */
|
||||
public function test2(\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\NullableInheritance\Foo $a) {}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
/** @param null|Foo $a */
|
||||
public function test2(?\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\NullableInheritance\Foo $a) {}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -22,10 +22,6 @@ class B extends A {
|
|||
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Rename;
|
||||
|
||||
class A {
|
||||
/**
|
||||
* @param string $a
|
||||
* @param int $b
|
||||
*/
|
||||
public function test(string $a, int $b) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,10 +21,6 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
|
||||
class NullableFalse
|
||||
{
|
||||
/**
|
||||
* @param true|false|null $ojoj3
|
||||
* @param null|BOOL|true|false $ojoj6
|
||||
*/
|
||||
function someFunction(?bool $ojoj3, ?bool $ojoj6)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
|
||||
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\ArrayNativeType;
|
||||
|
||||
/** @param array $foo */ function my_foo(array $foo) {}
|
||||
function my_foo(array $foo) {}
|
||||
?>
|
||||
|
|
|
@ -20,7 +20,6 @@ class Bar {}
|
|||
|
||||
interface Foo
|
||||
{
|
||||
/** @param Bar $bar */
|
||||
function my_foo(\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\Interface_\Bar $bar);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,13 +25,8 @@ class NonRootClassWithDifferentTypeOfParams
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $bar
|
||||
* @param int $baz
|
||||
* @param float $tab
|
||||
*/
|
||||
function my_foo(string $bar, int $baz, float $tab) {}
|
||||
|
||||
/** @param NonRootClassWithDifferentTypeOfParams $foo */ function my_foo2(\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\TypehintAlreadyDefinedWithWrongPhpdocTypehint\NonRootClassWithDifferentTypeOfParams $foo) {}
|
||||
function my_foo2(\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\TypehintAlreadyDefinedWithWrongPhpdocTypehint\NonRootClassWithDifferentTypeOfParams $foo) {}
|
||||
|
||||
?>
|
||||
|
|
|
@ -18,10 +18,10 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
|
||||
class Foo {}
|
||||
|
||||
/** @param null|bool $foo */ function my_foo(?bool $foo) {}
|
||||
/** @param null|Foo $foo */ function my_foo2(?\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\Nullable\Foo $foo) {}
|
||||
function my_foo(?bool $foo) {}
|
||||
function my_foo2(?\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\Nullable\Foo $foo) {}
|
||||
/** @param null|callable $foo */ function my_foo3(?callable $foo) {}
|
||||
/** @param null|Foo[] $foo */ function my_foo4(?array $foo) {}
|
||||
/** @param null|iterable $foo */ function my_foo5(?iterable $foo) {}
|
||||
function my_foo5(?iterable $foo) {}
|
||||
|
||||
?>
|
||||
|
|
|
@ -12,8 +12,8 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
|
||||
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\Number;
|
||||
|
||||
/** @param float $bar */ function my_foo(float $bar) {}
|
||||
function my_foo(float $bar) {}
|
||||
|
||||
/** @param int $bar */ function my_foo2(int $bar) {}
|
||||
function my_foo2(int $bar) {}
|
||||
|
||||
?>
|
||||
|
|
|
@ -9,5 +9,5 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
|
||||
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\RootClass;
|
||||
|
||||
/** @param \My\Bar $foo */ function my_foo(\My\Bar $foo) {}
|
||||
function my_foo(\My\Bar $foo) {}
|
||||
?>
|
||||
|
|
|
@ -24,12 +24,5 @@ class Baz
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $foo
|
||||
* @param string $bar
|
||||
* @param Baz $hey
|
||||
* @param float $tab
|
||||
* @param bool $baz
|
||||
*/
|
||||
function my_foo(string $bar, int $foo, bool $baz, float $tab, \Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\Unsorted\Baz $hey) {}
|
||||
?>
|
||||
|
|
|
@ -41,7 +41,6 @@ trait TraitWithInterfaceImplementation
|
|||
interface SomeInterface
|
||||
{
|
||||
/**
|
||||
* @param array $items
|
||||
* @return int
|
||||
*/
|
||||
public function getCount(array $items);
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationR
|
|||
|
||||
/**
|
||||
* @param real|int $a
|
||||
* @param int $b
|
||||
* @param int|void $c
|
||||
*/
|
||||
function someFunction($a, int $b, $c) {
|
||||
|
|
|
@ -17,8 +17,6 @@ function someFunction($a, $b, $c) {
|
|||
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\FixtureUnionType;
|
||||
|
||||
/**
|
||||
* @param real|int $a
|
||||
* @param int $b
|
||||
* @param int|void $c
|
||||
*/
|
||||
function someFunction(float|int $a, int $b, $c) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user