[fixtures] require skip prefix on skipped files (#5079)

* skip unnecesary test case

* namespace corrections, skip prefix corrections

* hide for now

* skip new phpstan cases
This commit is contained in:
Tomas Votruba 2021-01-03 16:54:27 +01:00 committed by GitHub
parent e081d8e22c
commit 014c019449
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
198 changed files with 574 additions and 1022 deletions

View File

@ -33,6 +33,11 @@ jobs:
name: Validate Fixtures class name
run: bin/rector validate-fixture-classname --ansi
# make sure skipped files have "skip_" prefix
# -
# name: Validate Fixtures skip file prefix
# run: vendor/bin/easy-testing validate-fixture-skip-naming rules tests
-
name: 'Validate Sets Loading'
# this is very slow, so it has to be in own workflow

View File

@ -185,9 +185,9 @@
"rules/dead-code/tests/Rector/MethodCall/RemoveDefaultArgumentValueRector/Source/UserDefined.php",
"rules/naming/tests/ValueObjectFactory/PropertyRenameFactory/Fixture/SomeClass.php.inc",
"rules/renaming/tests/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector/Source/ChangeMeAnotherNamespace.php",
"rules/renaming/tests/Rector/Name/RenameClassRector/Source/ClassImportingSameName.php",
"rules/renaming/tests/Rector/Name/RenameClassRector/Source/SkipClassImportingSameName.php",
"rules/renaming/tests/Rector/Name/RenameClassRector/Source/SkipSameNamedInterface.php",
"rules/renaming/tests/Rector/Name/RenameClassRector/Source/Manual_Twig_Filter.php",
"rules/renaming/tests/Rector/Name/RenameClassRector/Source/SomeInterface.php",
"rules/renaming/tests/Rector/Name/RenameClassRector/Source/TwigFilter.php",
"rules/renaming/tests/Rector/Name/RenameClassRector/Source/Twig_Extension_Sandbox.php",
"rules/transform/tests/Rector/FuncCall/FuncCallToMethodCallRector/Source/some_view_function.php",

View File

@ -591,3 +591,8 @@ parameters:
- utils/compiler/tests/PatchersCallbackTest.php
- '#Parameter \#3 \$type of method Rector\\CodeQualityStrict\\Rector\\ClassMethod\\ParamTypeToAssertTypeRector\:\:getToBeProcessedTypes\(\) expects PHPStan\\Type\\ObjectType\|PHPStan\\Type\\UnionType, PHPStan\\Type\\Type given#'
- '#Anonymous class is not allowed#'
- '#File "ClassInCorrectNamespaceRector\.php" should have prefix "Skip" prefix#'
- '#File "HaveSameStarts\.php" should have prefix "Skip" prefix#'
- '#File "AbstractSkip\.php" should have prefix "Skip" prefix#'

View File

@ -2,7 +2,7 @@
namespace Rector\Php56\Tests\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector\Fixture;
class AnonymousFunction
class SkipAnonymousFunction
{
public function run()
{

View File

@ -2,7 +2,7 @@
namespace Rector\Php70\Tests\Rector\Assign\ListSwapArrayOrderRector\Fixture;
class SkipEmpty
class MissingListItem
{
public function b()
{
@ -16,7 +16,7 @@ class SkipEmpty
namespace Rector\Php70\Tests\Rector\Assign\ListSwapArrayOrderRector\Fixture;
class SkipEmpty
class MissingListItem
{
public function b()
{

View File

@ -1,10 +0,0 @@
<?php
class NonExpression
{
function insertRecord()
{
if (true) {
}
}
}

View File

@ -4,9 +4,9 @@ declare(strict_types=1);
namespace Rector\Php70\Tests\Rector\ClassMethod\Php4ConstructorRector\Fixture;
final class InNamespace
final class SkipInNamespace
{
public function InNamespacePhp4ConstructorClass()
public function SkipInNamespace()
{
}
}

View File

@ -4,7 +4,7 @@ namespace Rector\Php70\Tests\Rector\MethodCall\ThisCallOnStaticMethodToStaticCal
use Rector\Php70\Tests\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector\Source\AnotherClass;
class AnotherCall
class SkipAnotherCall
{
public function __construct()
{

View File

@ -4,7 +4,7 @@ namespace Rector\Php70\Tests\Rector\StaticCall\StaticCallOnNonStaticToInstanceCa
use Rector\Php70\Tests\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector\Source\WithOnlyStaticMethods;
final class StaticCallOnProperty
final class SkipStaticCallOnProperty
{
/**
* @var WithOnlyStaticMethods

View File

@ -1,16 +0,0 @@
<?php
namespace Rector\Php71\Tests\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector\Fixture;
class EdgeCase
{
public function run()
{
$old = '01234';
$count = $old[0];
if ($count < 8) {
return 'all';
}
}
}

View File

@ -2,7 +2,7 @@
namespace Rector\Php71\Tests\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector\Fixture;
class IgnoreConcatenationDot
final class SkipConcatenationDot
{
public function run()
{

View File

@ -1,12 +0,0 @@
<?php
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
use Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Source\CountableClass;
use stdClass;
$values = [];
$count = count($values);
$values = new CountableClass();
$count = count($values);

View File

@ -1,40 +0,0 @@
<?php
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
function a(array $a = [])
{
count($a);
}
/**
* @param array $b
*/
function b($b = [])
{
count($b);
}
/**
* @param array $c
*/
function c($c)
{
count($c);
}
/**
* @param mixed[] $d
*/
function d($d)
{
count($d);
}
/**
* @param string[] $e
*/
function e($e)
{
count($e);
}

View File

@ -1,25 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
$fn = function() {
$primaryColumns = Dibi::getColumns();
if (count($primaryColumns) === 0) {
throw new \Exception("x");
}
if (count($primaryColumns) > 1) {
throw new \Exception("y");
}
};
class Dibi
{
public static function getColumns(): array
{
return [];
}
}

View File

@ -1,10 +0,0 @@
<?php
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
use PhpParser\Node\Expr\Isset_;
$issetNode = new Isset_([]);
if (! isset($issetNode->vars[0]) || count($issetNode->vars) > 1) {
}

View File

@ -1,21 +0,0 @@
<?php // @covers https://github.com/rectorphp/rector/issues/786
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
function pregMatchArray()
{
$version = 'hi';
preg_match('#\d\.\d(\.\d)?(-?\S*)?#i', $version, $matches);
if (count($matches) > 0) {
return 'found';
}
preg_match_all('#\d\.\d(\.\d)?(-?\S*)?#i', $version, $matches);
if (count($matches) > 0) {
return 'found';
}
return 'none';
}

View File

@ -0,0 +1,43 @@
<?php
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
class SkipCountableAnnotatedParams
{
function a(array $a = [])
{
count($a);
}
/**
* @param array $b
*/
function b($b = [])
{
count($b);
}
/**
* @param array $c
*/
function c($c)
{
count($c);
}
/**
* @param mixed[] $d
*/
function d($d)
{
count($d);
}
/**
* @param string[] $e
*/
function e($e)
{
count($e);
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
use Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Source\CountableClass;
class SkipCountableClass
{
public function run()
{
$values = [];
$count = count($values);
$values = new CountableClass();
$count = count($values);
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
class SkipDoubleSameVariable
{
public function run()
{
$fn = function() {
$primaryColumns = Dibi::getColumns();
if (count($primaryColumns) === 0) {
throw new \Exception("x");
}
if (count($primaryColumns) > 1) {
throw new \Exception("y");
}
};
}
}
class Dibi
{
public static function getColumns(): array
{
return [];
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
use PhpParser\Node\Expr\Isset_;
class SkipExternalProperty
{
public function run()
{
$issetNode = new Isset_([]);
if (! isset($issetNode->vars[0]) || count($issetNode->vars) > 1) {
}
}
}

View File

@ -0,0 +1,26 @@
<?php
// @covers https://github.com/rectorphp/rector/issues/786
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
class SkipPregMatchArray
{
function pregMatchArray()
{
$version = 'hi';
preg_match('#\d\.\d(\.\d)?(-?\S*)?#i', $version, $matches);
if (count($matches) > 0) {
return 'found';
}
preg_match_all('#\d\.\d(\.\d)?(-?\S*)?#i', $version, $matches);
if (count($matches) > 0) {
return 'found';
}
return 'none';
}
}

View File

@ -2,7 +2,7 @@
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
trait PropertyWithinTraitMethod
trait SkipPropertyWithinTraitMethod
{
/**
* @var array

View File

@ -2,9 +2,7 @@
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
use Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Source\CountableClass;
class SomeClassUsingTrait
class SkipVariableWithintTraitMethod
{
use VariableWithinTraitMethod;
}

View File

@ -1,22 +0,0 @@
<?php
namespace Rector\Php71\Tests\Rector\FuncCall\RemoveExtraParametersRector\Fixture;
function each(array $array, callable $fn): array
{
foreach ($array as $key => $value) {
if ($fn($value, $key) === false) {
break;
}
}
return $array;
}
function eachSpread(array $array, callable $fn): array
{
return each($array, static function (array $chunk, $key) use ($fn) {
$chunk[] = $key;
return $fn(...$chunk);
});
}

View File

@ -4,7 +4,10 @@ namespace Rector\Php71\Tests\Rector\FuncCall\RemoveExtraParametersRector\Fixture
use Rector\Php71\Tests\Rector\FuncCall\RemoveExtraParametersRector\Source\MethodWithFuncGetArgs;
function removeExtaParametersExternalScope()
class SkipExternalScope
{
MethodWithFuncGetArgs::call(1, 2, 3);
function run()
{
MethodWithFuncGetArgs::call(1, 2, 3);
}
}

View File

@ -2,7 +2,7 @@
namespace Rector\Php71\Tests\Rector\FuncCall\RemoveExtraParametersRector\Fixture;
final class FuncGetAll
final class SkipFuncGetAll
{
public function run()
{

View File

@ -4,7 +4,7 @@ namespace Rector\Php71\Tests\Rector\FuncCall\RemoveExtraParametersRector\Fixture
use Rector\Php71\Tests\Rector\FuncCall\RemoveExtraParametersRector\Source\ChildOrmion;
class StaticCallParent
class SkipStaticCallParent
{
public function someMethod()
{

View File

@ -1,9 +0,0 @@
<?php
namespace Rector\Php73\Tests\Rector\FuncCall\RegexDashEscapeRector\Fixture;
function regexFalsePositive()
{
// keep
preg_match("#^\d{4}-\d{2}-\d{2}$#", 'some text');
}

View File

@ -0,0 +1,12 @@
<?php
namespace Rector\Php73\Tests\Rector\FuncCall\RegexDashEscapeRector\Fixture;
class SkipRegexDatetime
{
public function run()
{
// keep
preg_match("#^\d{4}-\d{2}-\d{2}$#", 'some text');
}
}

View File

@ -1,17 +0,0 @@
<?php
if (false) {
setcookie('name');
setcookie('name', 'value');
$name = 'name';
$value = 'value';
$expire = 3600;
$args = [$name, $value, $expire];
setcookie($name);
setcookie($name, $value);
setcookie($name, $value, $expire);
setcookie($name, $value, ...$args);
setcookie(...$args);
setrawcookie('name');
setrawcookie('name', 'value');
}
?>

View File

@ -1,39 +1,55 @@
<?php
if (false) {
$expire = 3600;
$path = '';
$domain = '';
$secure = false;
$httponly = false;
setcookie('name', 'value', 3600);
setcookie('name', 'value', $expire, $path);
setcookie('name', 'value', $expire, $path, $domain);
setcookie('name', 'value', $expire, $path, $domain, $secure);
setcookie('name', 'value', $expire, $path, $domain, $secure, $httponly);
setcookie('name', 'value', 0, '');
setcookie('name', 'value', 0, '', '');
setcookie('name', 'value', 0, '', '', false);
setcookie('name', 'value', 0, '', '', false, false);
setrawcookie('name', 'value', 3600);
namespace Rector\Php73\Tests\Rector\FuncCall\SetcookieRector\Fixture;
class OptionsSpecified
{
public function run()
{
$expire = 3600;
$path = '';
$domain = '';
$secure = false;
$httponly = false;
setcookie('name', 'value', 3600);
setcookie('name', 'value', $expire, $path);
setcookie('name', 'value', $expire, $path, $domain);
setcookie('name', 'value', $expire, $path, $domain, $secure);
setcookie('name', 'value', $expire, $path, $domain, $secure, $httponly);
setcookie('name', 'value', 0, '');
setcookie('name', 'value', 0, '', '');
setcookie('name', 'value', 0, '', '', false);
setcookie('name', 'value', 0, '', '', false, false);
setrawcookie('name', 'value', 3600);
}
}
?>
-----
<?php
if (false) {
$expire = 3600;
$path = '';
$domain = '';
$secure = false;
$httponly = false;
setcookie('name', 'value', ['expires' => 3600]);
setcookie('name', 'value', ['expires' => $expire, 'path' => $path]);
setcookie('name', 'value', ['expires' => $expire, 'path' => $path, 'domain' => $domain]);
setcookie('name', 'value', ['expires' => $expire, 'path' => $path, 'domain' => $domain, 'secure' => $secure]);
setcookie('name', 'value', ['expires' => $expire, 'path' => $path, 'domain' => $domain, 'secure' => $secure, 'httponly' => $httponly]);
setcookie('name', 'value', ['expires' => 0, 'path' => '']);
setcookie('name', 'value', ['expires' => 0, 'path' => '', 'domain' => '']);
setcookie('name', 'value', ['expires' => 0, 'path' => '', 'domain' => '', 'secure' => false]);
setcookie('name', 'value', ['expires' => 0, 'path' => '', 'domain' => '', 'secure' => false, 'httponly' => false]);
setrawcookie('name', 'value', ['expires' => 3600]);
namespace Rector\Php73\Tests\Rector\FuncCall\SetcookieRector\Fixture;
class OptionsSpecified
{
public function run()
{
$expire = 3600;
$path = '';
$domain = '';
$secure = false;
$httponly = false;
setcookie('name', 'value', ['expires' => 3600]);
setcookie('name', 'value', ['expires' => $expire, 'path' => $path]);
setcookie('name', 'value', ['expires' => $expire, 'path' => $path, 'domain' => $domain]);
setcookie('name', 'value', ['expires' => $expire, 'path' => $path, 'domain' => $domain, 'secure' => $secure]);
setcookie('name', 'value', ['expires' => $expire, 'path' => $path, 'domain' => $domain, 'secure' => $secure, 'httponly' => $httponly]);
setcookie('name', 'value', ['expires' => 0, 'path' => '']);
setcookie('name', 'value', ['expires' => 0, 'path' => '', 'domain' => '']);
setcookie('name', 'value', ['expires' => 0, 'path' => '', 'domain' => '', 'secure' => false]);
setcookie('name', 'value', ['expires' => 0, 'path' => '', 'domain' => '', 'secure' => false, 'httponly' => false]);
setrawcookie('name', 'value', ['expires' => 3600]);
}
}
?>

View File

@ -0,0 +1,23 @@
<?php
namespace Rector\Php73\Tests\Rector\FuncCall\SetcookieRector\Fixture;
class SkipSetCookieWithoutModifier
{
public function run()
{
setcookie('name');
setcookie('name', 'value');
$name = 'name';
$value = 'value';
$expire = 3600;
$args = [$name, $value, $expire];
setcookie($name);
setcookie($name, $value);
setcookie($name, $value, $expire);
setcookie($name, $value, ...$args);
setcookie(...$args);
setrawcookie('name');
setrawcookie('name', 'value');
}
}

View File

@ -1,18 +0,0 @@
<?php
namespace Rector\Php74\Tests\Rector\Property\TypedPropertyRector\Fixture;
use Rector\Php74\Tests\Rector\Property\TypedPropertyRector\Source\SomeParent;
final class Child extends SomeParent
{
/**
* @var string
*/
protected $name = 'child';
/**
* @var string
*/
protected $typedName = 'child';
}

View File

@ -4,11 +4,7 @@ namespace Rector\Php74\Tests\Rector\Property\TypedPropertyRector\Fixture;
use Rector\Php74\Tests\Rector\Property\TypedPropertyRector\Source\SomeParent;
abstract class Middle extends SomeParent
{
}
final class Child2 extends Middle
final class SkipParentFromVendor extends Middle
{
/**
* @var string
@ -20,3 +16,9 @@ final class Child2 extends Middle
*/
protected $typedName = 'child';
}
abstract class Middle extends SomeParent
{
}

View File

@ -2,7 +2,7 @@
namespace Rector\Php74\Tests\Rector\Property\TypedPropertyRector\Fixture;
final class PropertyFromMethodCall
final class SkipPropertyFromMethodCall
{
private $object;

View File

@ -2,7 +2,7 @@
namespace Rector\Php80\Tests\Rector\FuncCall\TokenGetAllToObjectRector\Fixture;
final class SkipNonTokenArray
final class ProcessTokenGetAllButKeepNonTokenArray
{
public function run()
{
@ -27,7 +27,7 @@ final class SkipNonTokenArray
namespace Rector\Php80\Tests\Rector\FuncCall\TokenGetAllToObjectRector\Fixture;
final class SkipNonTokenArray
final class ProcessTokenGetAllButKeepNonTokenArray
{
public function run()
{

View File

@ -1,13 +0,0 @@
<?php
namespace Rector\PHPUnit\Tests\Rector\MethodCall\AssertRegExpRector\Fixture;
use PHPUnit\Framework\TestCase;
final class Fixture2Test extends TestCase
{
public function testSomething(object $object, string $method, array $input, string $expected): void
{
static::assertSame($expected, $object::$method($input));
}
}

View File

@ -5,7 +5,7 @@ namespace Rector\PHPUnit\Tests\Rector\MethodCall\SpecificAssertContainsWithoutId
use PHPUnit\Framework\TestCase;
use stdClass;
final class PartialArguments extends TestCase
final class SkipPartialArguments extends TestCase
{
public function test()
{

View File

@ -4,7 +4,7 @@ namespace Rector\PHPUnit\Tests\Rector\MethodCall\SpecificAssertContainsWithoutId
use PHPUnit\Framework\TestCase;
final class NoChangeOnStrings extends TestCase
final class SkipStrings extends TestCase
{
public function test()
{

View File

@ -5,7 +5,7 @@ namespace Rector\PHPUnit\Tests\Rector\MethodCall\SpecificAssertContainsWithoutId
use PHPUnit\Framework\TestCase;
use stdClass;
final class CheckIdentity extends TestCase
final class SkipWithIdentityCheck extends TestCase
{
public function test()
{
@ -14,5 +14,3 @@ final class CheckIdentity extends TestCase
$this->assertNotContains(new stdClass(), $objects, 'message', false, true);
}
}
?>

View File

@ -1,49 +0,0 @@
<?php
namespace Rector\Privatization\Tests\Rector\ClassConst\PrivatizeLocalClassConstantRector\Fixture;
// The class using the constant must be parsed first
class ForeignConstantAddictUser2
{
public function run()
{
return ClassWithConstantUsedSomewhereElse2::NON_LOCAL_ONLY;
}
}
class ClassWithConstantUsedSomewhereElse2Parent
{
}
// The class declaring the constant must have a superclass, so that rector must find out which one declares the constant
class ClassWithConstantUsedSomewhereElse2 extends ClassWithConstantUsedSomewhereElse2Parent
{
const NON_LOCAL_ONLY = true;
}
?>
-----
<?php
namespace Rector\Privatization\Tests\Rector\ClassConst\PrivatizeLocalClassConstantRector\Fixture;
// The class using the constant must be parsed first
class ForeignConstantAddictUser2
{
public function run()
{
return ClassWithConstantUsedSomewhereElse2::NON_LOCAL_ONLY;
}
}
class ClassWithConstantUsedSomewhereElse2Parent
{
}
// The class declaring the constant must have a superclass, so that rector must find out which one declares the constant
class ClassWithConstantUsedSomewhereElse2 extends ClassWithConstantUsedSomewhereElse2Parent
{
public const NON_LOCAL_ONLY = true;
}
?>

View File

@ -1,7 +0,0 @@
<?php
namespace Rector\Privatization\Tests\Rector\Class_\FinalizeClassesWithoutChildrenRector\Fixture;
abstract class Skip
{
}

View File

@ -10,7 +10,7 @@ use Snowflake\Snowflake;
* @ORM\Table
* @ORM\Entity
*/
class Issue1639
class SkipWithLifecycleCallbacks
{
/**
* @var Expense

View File

@ -4,6 +4,6 @@ declare(strict_types=1);
namespace Rector\PSR4\Tests\Rector\Namespace_\MultipleClassFileToPsr4ClassesRector\Fixture;
final class Readyexception
final class SkipReadyException
{
}

View File

@ -86,7 +86,7 @@ final class MultipleClassFileToPsr4ClassesRectorTest extends AbstractRectorTestC
],
];
yield [new SmartFileInfo(__DIR__ . '/Fixture/ReadyException.php.inc'), []];
yield [new SmartFileInfo(__DIR__ . '/Fixture/skip_ready_exception.php.inc'), []];
}
protected function getRectorClass(): string

View File

@ -2,7 +2,7 @@
namespace Rector\Renaming\Tests\Rector\FileWithoutNamespace\PseudoNamespaceToNamespaceRector\Fixture;
class PreslashedBug
class SkipClassFromSameNamespace
{
/**
* @param \DateTime $time1

View File

@ -2,7 +2,7 @@
namespace Rector\Renaming\Tests\Rector\FileWithoutNamespace\PseudoNamespaceToNamespaceRector\Fixture;
class Fixture4
class SkipExcludedClasses
{
/**
* @return Synapse|\PHPUnit_Framework_MockObject_MockObject

View File

@ -2,7 +2,7 @@
namespace Rector\Renaming\Tests\Rector\MethodCall\RenameMethodRector\Fixture;
class UnderAnonymousClass
class SkipUnderAnonymousClass
{
public function testErrorHandler(): void
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
use Rector\Renaming\Tests\Rector\Name\RenameClassRector\Source\FirstNamespace\FirstOriginalClass as AliasedClass;
use Rector\Renaming\Tests\Rector\Name\RenameClassRector\Source\SecondNamespace;
@ -12,7 +12,7 @@ $secondClass = new SecondNamespace\SecondOriginalClass();
-----
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
use Rector\Renaming\Tests\Rector\Name\RenameClassRector\Source\SecondNamespace\SecondOriginalClass;
use Rector\Renaming\Tests\Rector\Name\RenameClassRector\Source\FirstNamespace\FirstOriginalClass as AliasedClass;

View File

@ -1,9 +0,0 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
use NotExistingNamespace\ClassName as Alias;
if (false) {
$someAlias = new Alias();
}

View File

@ -1,7 +0,0 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
class ClassImportingSameName implements \ClassImportingSameName
{
}

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
use Rector\Renaming\Tests\Rector\Name\RenameClassRector\Source\OldClass;
@ -16,7 +16,7 @@ class ClassToNewWithPostImport
-----
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
use Rector\Renaming\Tests\Rector\Name\RenameClassRector\Source\NewClass;

View File

@ -1,7 +0,0 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
class Exception extends \Exception
{
}

View File

@ -1,7 +0,0 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
interface SomeInterface extends \SomeInterface
{
}

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
use PhpParser\Node;
@ -16,7 +16,7 @@ class PartialExpression
-----
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node;

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
use Safe\DateTimeImmutable;

View File

@ -0,0 +1,7 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
class SkipClassImportingSameName implements \SkipClassImportingSameName
{
}

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
use PhpParser\Node\Expr\Closure;

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
final class SkipParentClassSameName extends \Rector\Renaming\Tests\Rector\Name\RenameClassRector\Source\SkipParentClassSameName
{

View File

@ -0,0 +1,7 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
interface SkipSameNamedInterface extends \SkipSameNamedInterface
{
}

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\Fixture\AutoImportNamesParameter;
namespace Rector\Renaming\Tests\Rector\Name\RenameClassRector\FixtureAutoImportNames;
use Safe\DateTimeImmutable;

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
interface SomeInterface
interface SkipClassImportingSameName
{
}

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
interface ClassImportingSameName
interface SkipSameNamedInterface
{
}

View File

@ -6,7 +6,7 @@ use Rector\Sensio\Tests\Rector\ClassMethod\TemplateAnnotationToThisRenderRector\
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
final class SkipArrayMapReturnController extends AbstractController
final class ArrayMapReturnController extends AbstractController
{
/**
* @Template("items_template")
@ -31,7 +31,7 @@ use Rector\Sensio\Tests\Rector\ClassMethod\TemplateAnnotationToThisRenderRector\
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
final class SkipArrayMapReturnController extends AbstractController
final class ArrayMapReturnController extends AbstractController
{
public function indexAction($items): \Symfony\Component\HttpFoundation\Response
{

View File

@ -1,4 +1,6 @@
<?php declare (strict_types=1);
<?php
declare(strict_types=1);
namespace AppBundle\Controller;
@ -22,7 +24,9 @@ final class ClassWithAnonymousFunctionReturnController extends AbstractControlle
?>
-----
<?php declare (strict_types=1);
<?php
declare(strict_types=1);
namespace AppBundle\Controller;

View File

@ -1,28 +0,0 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/hey", name="hey")
* @Route("/hey-me", name="hey_me")
*/
class DoubleRoute extends AbstractController
{
/**
* @Route("/property", name="property")
* @Route("/property-me", name="property_me")
*/
private $value;
/**
* @Route("/change", name="facility_change")
* @Route("/change-me", name="facility_change_me")
*/
public function index()
{
return [];
}
}

View File

@ -6,7 +6,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
class SkipReturnResponseController extends AbstractController
class ReturnResponseController extends AbstractController
{
/**
* @Template()
@ -43,7 +43,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
class SkipReturnResponseController extends AbstractController
class ReturnResponseController extends AbstractController
{
public function indexAction(): \Symfony\Component\HttpFoundation\Response
{

View File

@ -4,12 +4,10 @@ namespace Rector\Symfony\Tests\Rector\MethodCall\GetToConstructorInjectionRector
use Rector\Symfony\Tests\Rector\MethodCall\GetToConstructorInjectionRector\Source\ParentClassWithGetTrait;
class ClassCallNotFoundService extends ParentClassWithGetTrait
class SkipUnknownService extends ParentClassWithGetTrait
{
public function render()
{
$this->get('notfound');
}
}
?>

View File

@ -4,7 +4,7 @@ namespace Rector\Symfony2\Tests\Rector\MethodCall\AddFlashRector\Fixture;
use Symfony\Component\HttpFoundation\Request;
class AnyClass2
class SkipOutsideController
{
public function someAction(Request $request)
{

View File

@ -1,120 +0,0 @@
<?php
namespace Rector\Symfony3\Tests\Rector\ClassMethod\GetRequestRector\Fixture;
use Rector\Symfony3\Tests\Rector\Source\SymfonyController;
use Symfony\Component\HttpFoundation\Request;
use App\Entity\Captcha;
use App\Form\CaptchaType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
class CaptchaController extends SymfonyController
{
/**
* @Security("has_role('ROLE_ADMIN')")
*/
public function addAction(Request $request)
{
get('request');
$form = $this->createForm(new CaptchaType(), new Captcha());
$form->add('Enregistrer', 'submit', [
'attr' => ['class' => 'btn btn-default'],
]);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($form->getData());
$em->flush();
$this->get('session')->getFlashBag()->add(
'success',
'Le captcha a bien été ajouté.'
);
return $this->redirect($this->generateUrl('captcha'));
}
return $this->render('App:Captcha:add.html.twig', [
'form' => $form->createView(),
]);
}
/**
* @Security("has_role('ROLE_ADMIN')")
*
* @param mixed $id
*/
public function editAction($id, Request $request)
{
$em = $this->getDoctrine()->getManager();
$captcha = $em->getRepository('App:Captcha')->find($id);
if (!$captcha) {
throw new \Exception('Le Captcha nexiste pas.');
}
$form = $this->createForm(new CaptchaType(), $captcha);
$form->add('Enregistrer', 'submit', [
'attr' => ['class' => 'btn btn-default']
]);
$form->handleRequest($request);
if ($form->isValid()) {
$em->flush();
$this->get('session')->getFlashBag()->add(
'success',
'Le captcha a bien été modifié.'
);
return $this->redirect($this->generateUrl('captcha'));
}
return $this->render('App:Captcha:edit.html.twig', [
'form' => $form->createView(),
]);
}
/**
* @Security("has_role('ROLE_ADMIN')")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$queryBuilder = $em->createQueryBuilder()
->select('c')
->from('App:Captcha', 'c')
;
$captchas = $queryBuilder->getQuery()->getResult();
return $this->render('App:Captcha:index.html.twig', [
'captchas' => $captchas,
]);
}
/**
* @Security("has_role('ROLE_ADMIN')")
*
* @param mixed $id
*/
public function removeAction($id)
{
$em = $this->getDoctrine()->getManager();
$captcha = $em->getRepository('App:Captcha')->find($id);
if (!$captcha) {
throw new \Exception('Le captcha demandé nexiste pas.');
}
$em->remove($captcha);
$em->flush();
$this->get('session')->getFlashBag()->add(
'success',
'Le captcha a bien été supprimé.'
);
return $this->redirect($this->generateUrl('captcha'));
}
}

View File

@ -1,41 +0,0 @@
<?php
namespace Rector\Symfony4\Tests\Rector\MethodCall\MakeDispatchFirstArgumentEventRector\Fixture;
use Rector\Symfony4\Tests\Rector\MethodCall\MakeDispatchFirstArgumentEventRector\Source\CustomEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Contracts\EventDispatcher\Event;
class KeepStringEventConstant
{
public function run(EventDispatcher $eventDispatcher)
{
/** @var Event|CustomEvent $customEvent */
$customEvent = new CustomEvent();
$eventDispatcher->dispatch(CustomEvent::NAME, $customEvent);
$eventDispatcher->dispatch($customEvent, CustomEvent::NAME);
}
}
?>
-----
<?php
namespace Rector\Symfony4\Tests\Rector\MethodCall\MakeDispatchFirstArgumentEventRector\Fixture;
use Rector\Symfony4\Tests\Rector\MethodCall\MakeDispatchFirstArgumentEventRector\Source\CustomEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Contracts\EventDispatcher\Event;
class KeepStringEventConstant
{
public function run(EventDispatcher $eventDispatcher)
{
/** @var Event|CustomEvent $customEvent */
$customEvent = new CustomEvent();
$eventDispatcher->dispatch($customEvent, CustomEvent::NAME);
$eventDispatcher->dispatch($customEvent, CustomEvent::NAME);
}
}
?>

View File

@ -0,0 +1,17 @@
<?php
namespace Rector\Symfony4\Tests\Rector\MethodCall\MakeDispatchFirstArgumentEventRector\Fixture;
use Rector\Symfony4\Tests\Rector\MethodCall\MakeDispatchFirstArgumentEventRector\Source\CustomEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Contracts\EventDispatcher\Event;
final class SkipAlreadyStringEventConstant
{
public function run(EventDispatcher $eventDispatcher)
{
/** @var Event|CustomEvent $customEvent */
$customEvent = new CustomEvent();
$eventDispatcher->dispatch($customEvent, CustomEvent::NAME);
}
}

View File

@ -4,7 +4,7 @@ namespace Rector\Symfony5\Tests\Rector\MethodCall\ReflectionExtractorEnableMagic
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
class OptionNotPresent
class SkipWithoutOptionArray
{
public function run()
{
@ -12,5 +12,3 @@ class OptionNotPresent
$readInfo = $reflectionExtractor->getReadInfo(Dummy::class, 'bar');
}
}
?>

View File

@ -4,12 +4,10 @@ namespace Rector\Symfony5\Tests\Rector\New_\PropertyAccessorCreationBooleanToFla
use Symfony\Component\PropertyAccess\PropertyAccessor;
class ArgumentFlag
class SkipAlreadyHasConstant
{
public function createPropertyAccessor()
{
return new PropertyAccessor(PropertyAccessor::MAGIC_CALL);
}
}
?>

View File

@ -1,8 +1,8 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture;
class VariadicTypes
class SkipVariadic
{
/**
* @param mixed[] $values

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture;
class ChangeUnionTypeMutuallyChildren
{
@ -24,14 +24,14 @@ class CTypeParent
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture;
class ChangeUnionTypeMutuallyChildren
{
/**
* @param CDataChild|CTypeParent $pointer
*/
public static function sizeof(\Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\CDataChild &$pointer): int
public static function sizeof(\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\CDataChild &$pointer): int
{
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
interface BarInterface
{
@ -16,7 +16,7 @@ interface BarInterface
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
interface BarInterface
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
trait BazTrait
{
@ -17,7 +17,7 @@ trait BazTrait
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
trait BazTrait
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas\Child;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas\Child;
class Child extends Foo implements BarInterface
{
@ -58,7 +58,7 @@ interface BarInterface
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas\Child;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas\Child;
class Child extends Foo implements BarInterface
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
# Typed arrays get simply converted to array
/**
@ -15,7 +15,7 @@ function array_no_types($ints, $strings, $someClasses) {
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
# Typed arrays get simply converted to array
/**

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
/**
* @param string $a
@ -26,7 +26,7 @@ function not_by_reference($a)
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
/**
* @param string $a

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
/**
* @var string
@ -46,7 +46,7 @@ function bat(int $a): string
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
/**
* @var string

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
function myFunction($param = false)
{
@ -15,7 +15,7 @@ function myOtherFunction($param)
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
function myFunction($param = false)
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas\NullableTypes;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas\NullableTypes;
/**
* Must be converted.
@ -80,7 +80,7 @@ function foobat(int $a = null)
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas\NullableTypes;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas\NullableTypes;
/**
* Must be converted.

View File

@ -1,10 +0,0 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
/**
* @param $noType
*/
function param_no_type($noType)
{
}

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
class AnyClass
{}
@ -22,7 +22,7 @@ function aliases($integer, $boolean, $real, $double, $callback, $void, $mixed, $
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Dunglas;
class AnyClass
{}
@ -38,6 +38,6 @@ class AnyClass
* @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\ClassMethod\ParamTypeDeclarationRector\Fixture\Dunglas\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) {
}
?>

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture;
class BoolClass
{
@ -21,7 +21,7 @@ class BoolClass
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture;
class BoolClass
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture;
class InferFromPropertyPhpdocType
{
@ -19,7 +19,7 @@ class InferFromPropertyPhpdocType
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture;
class InferFromPropertyPhpdocType
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\AnonClass;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\AnonClass;
new class {
/** @param int $a */
@ -11,7 +11,7 @@ new class {
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\AnonClass;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\AnonClass;
new class {
/** @param int $a */

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Basic;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Basic;
/**
* @param int $a
@ -26,7 +26,7 @@ class Number {
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Basic;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Basic;
/**
* @param int $a

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Iterable;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Iterable;
/** @param \Traversable|array $a */
function test($a) {}
@ -11,7 +11,7 @@ function test2($a) {}
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Iterable;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Iterable;
/** @param \Traversable|array $a */
function test(iterable $a) {}

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Nikic\Null_;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Nikic\Null_;
class A
{
@ -24,7 +24,7 @@ function foo4($a) {}
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Nikic\Null_;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Nikic\Null_;
class A
{
@ -39,9 +39,9 @@ function foo() {
function foo2($a) {}
/** @param null|A $a */
function foo3(?\Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Nikic\Null_\A $a = null) {}
function foo3(?\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Nikic\Null_\A $a = null) {}
/** @param null|A $a */
function foo4(?\Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Nikic\Null_\A $a) {}
function foo4(?\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Nikic\Null_\A $a) {}
?>

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Nikic\Nullable;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Nikic\Nullable;
class Foo
{
@ -20,7 +20,7 @@ function test2($a, $b = null) {}
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Nikic\Nullable;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Nikic\Nullable;
class Foo
{
@ -34,6 +34,6 @@ class Bar
* @param Foo|null $a
* @param Bar|null $b
*/
function test2(?\Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Nikic\Nullable\Foo $a, ?\Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Nikic\Nullable\Bar $b = null) {}
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) {}
?>

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\NullableInheritance;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\NullableInheritance;
class Foo
{}
@ -18,18 +18,18 @@ class B extends A {
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\NullableInheritance;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\NullableInheritance;
class Foo
{}
class A {
/** @param Foo $a */
public function test2(\Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\NullableInheritance\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\ClassMethod\ParamTypeDeclarationRector\Fixture\NullableInheritance\Foo $a) {}
public function test2(?\Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\NullableInheritance\Foo $a) {}
}
?>

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Rename;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Rename;
class A {
/**
@ -19,7 +19,7 @@ class B extends A {
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\Rename;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\Rename;
class A {
/**

View File

@ -1,13 +1,13 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\ArrayNativeType;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\ArrayNativeType;
/** @param array $foo */ function my_foo($foo) {}
?>
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\ArrayNativeType;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\ArrayNativeType;
/** @param array $foo */ function my_foo(array $foo) {}
?>

View File

@ -1,13 +1,13 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\ArrayOfTypes;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\ArrayOfTypes;
/** @param Foo[] $foo */ function my_foo($foo) {}
?>
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\ArrayOfTypes;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\ArrayOfTypes;
/** @param Foo[] $foo */ function my_foo(array $foo) {}
?>

View File

@ -1,13 +1,13 @@
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\CallableType;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\CallableType;
/** @param callable $foo */ function my_foo($foo) {}
?>
-----
<?php
namespace Rector\TypeDeclaration\Tests\Rector\ClassMethod\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\CallableType;
namespace Rector\TypeDeclaration\Tests\Rector\FunctionLike\ParamTypeDeclarationRector\Fixture\PhpCsFixerParam\CallableType;
/** @param callable $foo */ function my_foo(callable $foo) {}
?>

Some files were not shown because too many files have changed in this diff Show More