Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 23 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,19 @@
"Rector\\PSR4\\": "packages/PSR4/src",
"Rector\\PhpSpecToPHPUnit\\": "packages/PhpSpecToPHPUnit/src",
"Rector\\Php\\": "packages/Php/src",
"Rector\\Php52\\": "packages/Php52/src",
"Rector\\Php53\\": "packages/Php53/src",
"Rector\\Php54\\": "packages/Php54/src",
"Rector\\Php55\\": "packages/Php55/src",
"Rector\\Php56\\": "packages/Php56/src",
"Rector\\Php70\\": "packages/Php70/src",
"Rector\\Php71\\": "packages/Php71/src",
"Rector\\Php72\\": "packages/Php72/src",
"Rector\\Php73\\": "packages/Php73/src",
"Rector\\Php74\\": "packages/Php74/src",
"Rector\\RemovingStatic\\": "packages/RemovingStatic/src",
"Rector\\Restoration\\": "packages/Restoration/src",
"Rector\\Refactoring\\": "packages/Refactoring/src",
"Rector\\SOLID\\": "packages/SOLID/src",
"Rector\\Sensio\\": "packages/Sensio/src",
"Rector\\Shopware\\": "packages/Shopware/src",
Expand Down Expand Up @@ -115,8 +126,19 @@
"Rector\\PHPStan\\Tests\\": "packages/PHPStan/tests",
"Rector\\PHPUnitSymfony\\Tests\\": "packages/PHPUnitSymfony/tests",
"Rector\\PHPUnit\\Tests\\": "packages/PHPUnit/tests",
"Rector\\PSR4\\Tests\\": "packages/PSR4/tests",
"Rector\\PhpSpecToPHPUnit\\Tests\\": "packages/PhpSpecToPHPUnit/tests",
"Rector\\Php\\Tests\\": "packages/Php/tests",
"Rector\\Php52\\Tests\\": "packages/Php52/tests",
"Rector\\Php53\\Tests\\": "packages/Php53/tests",
"Rector\\Php54\\Tests\\": "packages/Php54/tests",
"Rector\\Php55\\Tests\\": "packages/Php55/tests",
"Rector\\Php56\\Tests\\": "packages/Php56/tests",
"Rector\\Php70\\Tests\\": "packages/Php70/tests",
"Rector\\Php71\\Tests\\": "packages/Php71/tests",
"Rector\\Php72\\Tests\\": "packages/Php72/tests",
"Rector\\Php73\\Tests\\": "packages/Php73/tests",
"Rector\\Php74\\Tests\\": "packages/Php74/tests",
"Rector\\RemovingStatic\\Tests\\": "packages/RemovingStatic/tests",
"Rector\\Restoration\\Tests\\": "packages/Restoration/tests",
"Rector\\SOLID\\Tests\\": "packages/SOLID/tests",
Expand Down Expand Up @@ -146,7 +168,7 @@
],
"files": [
"packages/DeadCode/tests/Rector/MethodCall/RemoveDefaultArgumentValueRector/Source/UserDefined.php",
"packages/Php/tests/Rector/Property/CompleteVarDocTypePropertyRector/Source/EventDispatcher.php",
"packages/TypeDeclaration/tests/Rector/Property/CompleteVarDocTypePropertyRector/Source/EventDispatcher.php",
"tests/Rector/Namespace_/PseudoNamespaceToNamespaceRector/Source/ChangeMeAnotherNamespace.php",
"packages/TypeDeclaration/tests/Rector/FunctionLike/ReturnTypeDeclarationRector/Source/MyBar.php",
"tests/Rector/Class_/RenameClassRector/Source/Twig_Extension_Sandbox.php",
Expand Down
2 changes: 1 addition & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:

Rector\:
resource: '../src'
exclude: '../src/{Node/Attribute.php,Rector/**/*Rector.php,Reporting/FileDiff.php,Testing/PHPUnit,RectorDefinition,PhpParser/Node/*Info.php,Exception/*,DependencyInjection/CompilerPass/*,DependencyInjection/Loader/*,Application/Error.php,HttpKernel/RectorKernel.php}'
exclude: '../src/{Node/Attribute.php,Rector/**/*Rector.php,Reporting/FileDiff.php,Testing/PHPUnit,RectorDefinition,PhpParser/Node/*Info.php,Exception/*,DependencyInjection/CompilerPass/*,DependencyInjection/Loader/*,Application/Error.php,HttpKernel/RectorKernel.php,ValueObject/*}'

# extra services
Rector\Symfony\Rector\Form\Helper\FormTypeStringToTypeProvider: ~
Expand Down
3 changes: 2 additions & 1 deletion config/set/celebrity/celebrity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ services:
Rector\Celebrity\Rector\FuncCall\SetTypeToCastRector: ~

# class { var $value; } → class { public $value; }
Rector\Php\Rector\Property\VarToPublicPropertyRector: ~
Rector\Php52\Rector\Property\VarToPublicPropertyRector: ~pu


# false or true → false || true
# false and true → false && true
Expand Down
2 changes: 1 addition & 1 deletion config/set/code-quality/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
Rector\CodeQuality\Rector\Return_\SimplifyUselessVariableRector: ~
Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector: ~

Rector\Php\Rector\FuncCall\RemoveExtraParametersRector: ~
Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector: ~
Rector\CodeQuality\Rector\BinaryOp\SimplifyDeMorganBinaryRector: ~
Rector\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector: ~
Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToArrayFilterRector: ~
Expand Down
2 changes: 1 addition & 1 deletion config/set/coding-style/coding-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
Rector\CodingStyle\Rector\Namespace_\ImportFullyQualifiedNamesRector: ~

# 'ClassName' → ClassName::class
Rector\Php\Rector\String_\StringClassNameToClassConstantRector: ~
Rector\Php55\Rector\String_\StringClassNameToClassConstantRector: ~
Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector: ~
Rector\CodingStyle\Rector\Include_\FollowRequireByDirRector: ~
Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector: ~
Expand Down
4 changes: 2 additions & 2 deletions config/set/php/php52.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
services:
Rector\Php\Rector\Property\VarToPublicPropertyRector: ~
Rector\Php\Rector\Switch_\ContinueToBreakInSwitchRector: ~
Rector\Php52\Rector\Property\VarToPublicPropertyRector: ~
Rector\Php52\Rector\Switch_\ContinueToBreakInSwitchRector: ~
2 changes: 1 addition & 1 deletion config/set/php/php53.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
services:
Rector\CodeQuality\Rector\Ternary\TernaryToElvisRector: ~
Rector\Php53\Rector\Ternary\TernaryToElvisRector: ~
3 changes: 2 additions & 1 deletion config/set/php/php54.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
services:
Rector\Rector\Function_\RenameFunctionRector:
mysqli_param_count: 'mysqli_stmt_param_count'
Rector\Php\Rector\FuncCall\RemoveReferenceFromCallRector: ~

Rector\Php54\Rector\FuncCall\RemoveReferenceFromCallRector: ~
2 changes: 1 addition & 1 deletion config/set/php/php55.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
services:
Rector\Php\Rector\String_\StringClassNameToClassConstantRector: ~
Rector\Php55\Rector\String_\StringClassNameToClassConstantRector: ~
4 changes: 2 additions & 2 deletions config/set/php/php56.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
services:
Rector\Php\Rector\FuncCall\PowToExpRector: ~
Rector\Php56\Rector\FuncCall\PowToExpRector: ~

Rector\Rector\Function_\RenameFunctionRector:
mcrypt_generic_end: 'mcrypt_generic_deinit'
Expand Down Expand Up @@ -39,4 +39,4 @@ services:
ocistatementtype: 'oci_statement_type'

# inspired by level in psalm - https://github.com/vimeo/psalm/blob/82e0bcafac723fdf5007a31a7ae74af1736c9f6f/tests/FileManipulationTest.php#L1063
Rector\Php\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector: ~
Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector: ~
34 changes: 17 additions & 17 deletions config/set/php/php70.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ imports:
- { resource: "../database-migration/mysql-to-mysqli.yaml" }

services:
Rector\Php\Rector\FunctionLike\Php4ConstructorRector: ~
Rector\Php\Rector\Ternary\TernaryToNullCoalescingRector: ~
Rector\Php\Rector\FuncCall\RandomFunctionRector: ~
Rector\Php\Rector\FunctionLike\ExceptionHandlerTypehintRector: ~
Rector\Php\Rector\FuncCall\MultiDirnameRector: ~
Rector\Php\Rector\List_\ListSplitStringRector: ~
Rector\Php\Rector\List_\EmptyListRector: ~
Rector\Php70\Rector\FunctionLike\Php4ConstructorRector: ~
Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector: ~
Rector\Php70\Rector\FuncCall\RandomFunctionRector: ~
Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector: ~
Rector\Php70\Rector\FuncCall\MultiDirnameRector: ~
Rector\Php70\Rector\List_\ListSplitStringRector: ~
Rector\Php70\Rector\List_\EmptyListRector: ~

# be careful, run this just once, since it can keep swapping order back and forth
Rector\Php\Rector\List_\ListSwapArrayOrderRector: ~
Rector\Php70\Rector\List_\ListSwapArrayOrderRector: ~

Rector\Php\Rector\FuncCall\CallUserMethodRector : ~
Rector\Php\Rector\FuncCall\EregToPregMatchRector: ~
Rector\Php\Rector\Switch_\ReduceMultipleDefaultSwitchRector: ~
Rector\Php\Rector\Ternary\TernaryToSpaceshipRector: ~
Rector\Php\Rector\If_\IfToSpaceshipRector: ~
Rector\Php\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector: ~
Rector\Php\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector: ~
Rector\Php70\Rector\FuncCall\CallUserMethodRector : ~
Rector\Php70\Rector\FuncCall\EregToPregMatchRector: ~
Rector\Php70\Rector\Switch_\ReduceMultipleDefaultSwitchRector: ~
Rector\Php70\Rector\Ternary\TernaryToSpaceshipRector: ~
Rector\Php70\Rector\If_\IfToSpaceshipRector: ~
Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector: ~
Rector\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector: ~

Rector\Php\Rector\Break_\BreakNotInLoopOrSwitchToReturnRector: ~
Rector\Php\Rector\FuncCall\RenameMktimeWithoutArgsToTimeRector: ~
Rector\Php70\Rector\Break_\BreakNotInLoopOrSwitchToReturnRector: ~
Rector\Php70\Rector\FuncCall\RenameMktimeWithoutArgsToTimeRector: ~
16 changes: 9 additions & 7 deletions config/set/php/php71.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
services:
Rector\Php\Rector\BinaryOp\IsIterableRector: ~
Rector\Php71\Rector\BinaryOp\IsIterableRector: ~

Rector\Php\Rector\Name\ReservedObjectRector:
Object: 'BaseObject'
$reservedKeywordsToReplacements:
Object: 'BaseObject'

Rector\Php\Rector\TryCatch\MultiExceptionCatchRector: ~
Rector\Php\Rector\Assign\AssignArrayToStringRector: ~
Rector\Php\Rector\FuncCall\CountOnNullRector: ~
Rector\Php\Rector\FuncCall\RemoveExtraParametersRector: ~
Rector\Php\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector: ~
Rector\Php71\Rector\TryCatch\MultiExceptionCatchRector: ~
Rector\Php71\Rector\Assign\AssignArrayToStringRector: ~
Rector\Php71\Rector\FuncCall\CountOnNullRector: ~
Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector: ~
Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector: ~
20 changes: 10 additions & 10 deletions config/set/php/php72.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ parameters:
enable_object_type: true

services:
Rector\Php\Rector\Each\WhileEachToForeachRector: ~
Rector\Php\Rector\Each\ListEachRector: ~
Rector\Php\Rector\Unset_\UnsetCastRector: ~
Rector\Php\Rector\ConstFetch\BarewordStringRector: ~
Rector\Php72\Rector\Each\WhileEachToForeachRector: ~
Rector\Php72\Rector\Each\ListEachRector: ~
Rector\Php72\Rector\Unset_\UnsetCastRector: ~
Rector\Php72\Rector\ConstFetch\BarewordStringRector: ~

Rector\Rector\Function_\RenameFunctionRector:
jpeg2wbmp: 'imagecreatefromjpeg' # and imagewbmp
Expand All @@ -15,9 +15,9 @@ services:
gmp_random: 'gmp_random_bits' # or gmp_random_range
read_exif_data: 'exif_read_data'

Rector\Php\Rector\FuncCall\GetClassOnNullRector: ~
Rector\Php\Rector\FuncCall\IsObjectOnIncompleteClassRector: ~
Rector\Php\Rector\FuncCall\ParseStrWithResultArgumentRector: ~
Rector\Php\Rector\FuncCall\StringsAssertNakedRector: ~
Rector\Php\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector: ~
Rector\Php\Rector\FuncCall\StringifyDefineRector: ~
Rector\Php72\Rector\FuncCall\GetClassOnNullRector: ~
Rector\Php72\Rector\FuncCall\IsObjectOnIncompleteClassRector: ~
Rector\Php72\Rector\FuncCall\ParseStrWithResultArgumentRector: ~
Rector\Php72\Rector\FuncCall\StringsAssertNakedRector: ~
Rector\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector: ~
Rector\Php72\Rector\FuncCall\StringifyDefineRector: ~
18 changes: 9 additions & 9 deletions config/set/php/php73.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
services:
Rector\Php\Rector\BinaryOp\IsCountableRector: ~
Rector\Php\Rector\FuncCall\ArrayKeyFirstLastRector: ~
Rector\Php\Rector\FuncCall\SensitiveDefineRector: ~
Rector\Php\Rector\ConstFetch\SensitiveConstantNameRector: ~
Rector\Php\Rector\String_\SensitiveHereNowDocRector: ~
Rector\Php73\Rector\BinaryOp\IsCountableRector: ~
Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector: ~
Rector\Php73\Rector\FuncCall\SensitiveDefineRector: ~
Rector\Php73\Rector\ConstFetch\SensitiveConstantNameRector: ~
Rector\Php73\Rector\String_\SensitiveHereNowDocRector: ~

# https://wiki.php.net/rfc/deprecations_php_7_3
Rector\Rector\Function_\RenameFunctionRector:
Expand All @@ -22,7 +22,7 @@ services:
mbereg_search_getregs: 'mb_ereg_search_getregs'
mbereg_search_getpos: 'mb_ereg_search_getpos'

Rector\Php\Rector\FuncCall\StringifyStrNeedlesRector: ~
Rector\Php\Rector\FuncCall\JsonThrowOnErrorRector: ~
Rector\Php\Rector\FuncCall\RegexDashEscapeRector: ~
Rector\Php\Rector\FuncCall\RemoveMissingCompactVariableRector: ~
Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector: ~
Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector: ~
Rector\Php73\Rector\FuncCall\RegexDashEscapeRector: ~
Rector\Php73\Rector\FuncCall\RemoveMissingCompactVariableRector: ~
26 changes: 13 additions & 13 deletions config/set/php/php74.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
services:
Rector\Php\Rector\Property\TypedPropertyRector: ~
Rector\Php74\Rector\Property\TypedPropertyRector: ~

Rector\Rector\Function_\RenameFunctionRector:
# https://wiki.php.net/rfc/deprecations_php_7_4#the_real_type
is_real: 'is_float'
# https://wiki.php.net/rfc/deprecations_php_7_4#apache_request_headers_function
apache_request_headers: 'getallheaders'
hebrevc: ['nl2br', 'hebrev']
Rector\Php\Rector\FuncCall\ArrayKeyExistsOnPropertyRector: ~
Rector\Php\Rector\FuncCall\FilterVarToAddSlashesRector: ~
Rector\Php\Rector\StaticCall\ExportToReflectionFunctionRector: ~
Rector\Php\Rector\MagicConstClass\ClassConstantToSelfClassRector: ~
Rector\Php\Rector\FuncCall\GetCalledClassToStaticClassRector: ~
Rector\Php\Rector\FuncCall\MbStrrposEncodingArgumentPositionRector: ~
Rector\Php\Rector\Double\RealToFloatTypeCastRector: ~
Rector\Php\Rector\Assign\NullCoalescingOperatorRector: ~
Rector\Php\Rector\Function_\ReservedFnFunctionRector: ~
Rector\Php\Rector\Closure\ClosureToArrowFunctionRector: ~
Rector\Php\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector: ~
Rector\Php\Rector\LNumber\AddLiteralSeparatorToNumberRector: ~
Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector: ~
Rector\Php74\Rector\FuncCall\FilterVarToAddSlashesRector: ~
Rector\Php74\Rector\StaticCall\ExportToReflectionFunctionRector: ~
Rector\Php74\Rector\MagicConstClass\ClassConstantToSelfClassRector: ~
Rector\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector: ~
Rector\Php74\Rector\FuncCall\MbStrrposEncodingArgumentPositionRector: ~
Rector\Php74\Rector\Double\RealToFloatTypeCastRector: ~
Rector\Php74\Rector\Assign\NullCoalescingOperatorRector: ~
Rector\Php74\Rector\Function_\ReservedFnFunctionRector: ~
Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector: ~
Rector\Php74\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector: ~
Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector: ~
8 changes: 4 additions & 4 deletions ecs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ parameters:
Symplify\CodingStandard\Fixer\Order\PrivateMethodOrderByUseFixer: ~

PhpCsFixer\Fixer\Phpdoc\PhpdocTypesFixer:
- 'packages/Php/src/Rector/Double/RealToFloatTypeCastRector.php'
- 'packages/Php74/src/Rector/Double/RealToFloatTypeCastRector.php'

Symplify\CodingStandard\Sniffs\CleanCode\ForbiddenReferenceSniff: ~

Expand Down Expand Up @@ -119,7 +119,7 @@ parameters:
- 'packages/TypeDeclaration/src/TypeInferer/ReturnTypeInferer/ReturnedNodesReturnTypeInferer.php'
- 'packages/NodeTypeResolver/src/NodeTypeResolver.php'
- 'packages/NodeTypeResolver/src/PerNodeTypeResolver/VariableTypeResolver.php'
- 'packages/Php/src/Rector/FuncCall/RemoveExtraParametersRector.php'
- 'packages/Php71/src/Rector/FuncCall/RemoveExtraParametersRector.php'
- 'packages/SOLID/src/Analyzer/ClassConstantFetchAnalyzer.php'
# tough logic
- 'packages/PHPUnit/src/Rector/Class_/ArrayArgumentInTestToDataProviderRector.php'
Expand Down Expand Up @@ -153,7 +153,7 @@ parameters:
- 'packages/Php/src/EregToPcreTransformer.php'
# dev
- 'packages/TypeDeclaration/src/Rector/FunctionLike/*TypeDeclarationRector.php'
- 'packages/Php/src/Rector/If_/IfToSpaceshipRector.php'
- 'packages/Php70/src/Rector/If_/IfToSpaceshipRector.php'

Symplify\CodingStandard\Sniffs\ControlStructure\SprintfOverContactSniff:
# respects inherited pattern for better comparing
Expand All @@ -173,7 +173,7 @@ parameters:

Symplify\CodingStandard\Sniffs\Debug\CommentedOutCodeSniff.Found:
# notes
- 'packages/Php/src/Rector/Each/ListEachRector.php'
- 'packages/Php72/src/Rector/Each/ListEachRector.php'
- 'packages/DeadCode/src/Rector/ClassMethod/RemoveOverriddenValuesRector.php'
- 'packages/PhpSpecToPHPUnit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ private function processGroupNamesBySuffix(
continue;
}

$this->moveFile($smartFileInfo, $nodes, $groupName);
$this->moveFileToGroupName($smartFileInfo, $nodes, $groupName);
return;
}
}

/**
* @param Node[] $nodes
*/
private function moveFile(SmartFileInfo $smartFileInfo, array $nodes, string $desiredGroupName): void
private function moveFileToGroupName(SmartFileInfo $smartFileInfo, array $nodes, string $desiredGroupName): void
{
$nodesWithFileDestination = $this->fileMover->createMovedNodesAndFilePath(
$smartFileInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public function refactor(Node $node): ?Node
$valueNode = $issetNode->vars[0];

// various scenarios

/** @var Assign $firstAssign */
$firstAssign = $node->stmts[0]->expr;
/** @var Assign $secondAssign */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Rector\CodeQuality\Tests\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector\Fixture;

final class MyClass
{
public function isEmptyArray($values): bool
Expand All @@ -22,6 +24,8 @@ final class MyClass
-----
<?php

namespace Rector\CodeQuality\Tests\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector\Fixture;

final class MyClass
{
public function isEmptyArray($values): bool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?php

namespace Rector\CodeQuality\Tests\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector\Fixture;

function simplifyEmptyCheck()
{
$invalid = is_array($var) && in_array('foo', $var);
$almostValid = is_array($var) && count($var) > 0;
$invalid2 = isset($this->events[$event]) && !empty($this->events[$event]);
$completelyInvalid = !$value instanceof Foo && !$value instanceof Bar;
$completelyInvalid = !$value instanceof \Foo && !$value instanceof \Bar;

if (empty($this->orders) && empty($this->unionOrders)) {
throw new RuntimeException('You must specify an orderBy clause when using this function.');
throw new \RuntimeException('You must specify an orderBy clause when using this function.');
}

echo is_array($objects) && is_array($objects);
Expand All @@ -18,15 +20,17 @@ function simplifyEmptyCheck()
-----
<?php

namespace Rector\CodeQuality\Tests\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector\Fixture;

function simplifyEmptyCheck()
{
$invalid = is_array($var) && in_array('foo', $var);
$almostValid = is_array($var) && count($var) > 0;
$invalid2 = isset($this->events[$event]) && !empty($this->events[$event]);
$completelyInvalid = !$value instanceof Foo && !$value instanceof Bar;
$completelyInvalid = !$value instanceof \Foo && !$value instanceof \Bar;

if (empty($this->orders) && empty($this->unionOrders)) {
throw new RuntimeException('You must specify an orderBy clause when using this function.');
throw new \RuntimeException('You must specify an orderBy clause when using this function.');
}

echo is_array($objects) && is_array($objects);
Expand Down
Loading