Skip to content

Commit

Permalink
Updated Rector to commit d68e8fa32a27c1ddd474ef6f1b4e1f63a74e5708
Browse files Browse the repository at this point in the history
rectorphp/rector-src@d68e8fa [Cleanup] Deprecate ChangeAndIfToEarlyReturnRector as creates less readable code with inverted conditions (#6041)
  • Loading branch information
TomasVotruba committed Jun 26, 2024
1 parent 3dc474c commit a26759c
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 22 deletions.
3 changes: 1 addition & 2 deletions config/set/early-return.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
Expand All @@ -14,5 +13,5 @@
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
use Rector\EarlyReturn\Rector\StmtsAwareInterface\ReturnEarlyIfVariableRector;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rules([ChangeNestedForeachIfsToEarlyContinueRector::class, ChangeAndIfToEarlyReturnRector::class, ChangeIfElseValueAssignToEarlyReturnRector::class, ChangeNestedIfsToEarlyReturnRector::class, RemoveAlwaysElseRector::class, ChangeOrIfContinueToMultiContinueRector::class, PreparedValueToEarlyReturnRector::class, ReturnBinaryOrToEarlyReturnRector::class, ReturnEarlyIfVariableRector::class]);
$rectorConfig->rules([ChangeNestedForeachIfsToEarlyContinueRector::class, ChangeIfElseValueAssignToEarlyReturnRector::class, ChangeNestedIfsToEarlyReturnRector::class, RemoveAlwaysElseRector::class, ChangeOrIfContinueToMultiContinueRector::class, PreparedValueToEarlyReturnRector::class, ReturnBinaryOrToEarlyReturnRector::class, ReturnEarlyIfVariableRector::class]);
};
3 changes: 1 addition & 2 deletions config/set/php52.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
use Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector;
use Rector\Removing\ValueObject\RemoveFuncCallArg;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rule(VarToPublicPropertyRector::class);
$rectorConfig->rule(ContinueToBreakInSwitchRector::class);
$rectorConfig->rules([VarToPublicPropertyRector::class, ContinueToBreakInSwitchRector::class]);
$rectorConfig->ruleWithConfiguration(RemoveFuncCallArgRector::class, [
// see https://www.php.net/manual/en/function.ldap-first-attribute.php
new RemoveFuncCallArg('ldap_first_attribute', 2),
Expand Down
4 changes: 1 addition & 3 deletions config/set/php53.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
use Rector\Php53\Rector\Ternary\TernaryToElvisRector;
use Rector\Php53\Rector\Variable\ReplaceHttpServerVarsByServerRector;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rule(TernaryToElvisRector::class);
$rectorConfig->rule(DirNameFileConstantToDirConstantRector::class);
$rectorConfig->rule(ReplaceHttpServerVarsByServerRector::class);
$rectorConfig->rules([TernaryToElvisRector::class, DirNameFileConstantToDirConstantRector::class, ReplaceHttpServerVarsByServerRector::class]);
};
4 changes: 1 addition & 3 deletions config/set/php54.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
use Rector\Php54\Rector\FuncCall\RemoveReferenceFromCallRector;
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rule(LongArrayToShortArrayRector::class);
$rectorConfig->rules([LongArrayToShortArrayRector::class, RemoveReferenceFromCallRector::class, RemoveZeroBreakContinueRector::class]);
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, ['mysqli_param_count' => 'mysqli_stmt_param_count']);
$rectorConfig->rule(RemoveReferenceFromCallRector::class);
$rectorConfig->rule(RemoveZeroBreakContinueRector::class);
};
7 changes: 1 addition & 6 deletions config/set/php55.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,5 @@
use Rector\Php55\Rector\FuncCall\PregReplaceEModifierRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rule(StringClassNameToClassConstantRector::class);
$rectorConfig->rule(ClassConstantToSelfClassRector::class);
$rectorConfig->rule(PregReplaceEModifierRector::class);
$rectorConfig->rule(GetCalledClassToSelfClassRector::class);
$rectorConfig->rule(GetCalledClassToStaticClassRector::class);
$rectorConfig->rule(StaticToSelfOnFinalClassRector::class);
$rectorConfig->rules([StringClassNameToClassConstantRector::class, ClassConstantToSelfClassRector::class, PregReplaceEModifierRector::class, GetCalledClassToSelfClassRector::class, GetCalledClassToStaticClassRector::class, StaticToSelfOnFinalClassRector::class]);
};
4 changes: 1 addition & 3 deletions config/set/rector-preset.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
use Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector;
use Rector\Config\RectorConfig;
use Rector\Privatization\Rector\Class_\FinalizeTestCaseClassRector;
use Rector\TypeDeclaration\Rector\BooleanAnd\BinaryOpNullableToInstanceofRector;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
use Rector\TypeDeclaration\Rector\While_\WhileNullableToInstanceofRector;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rules([DeclareStrictTypesRector::class, BinaryOpNullableToInstanceofRector::class, WhileNullableToInstanceofRector::class, IntvalToTypeCastRector::class, StrvalToTypeCastRector::class, BoolvalToTypeCastRector::class, FloatvalToTypeCastRector::class, PostIncDecToPreIncDecRector::class, UseIncrementAssignRector::class, FinalizeTestCaseClassRector::class]);
$rectorConfig->rules([DeclareStrictTypesRector::class, IntvalToTypeCastRector::class, StrvalToTypeCastRector::class, BoolvalToTypeCastRector::class, FloatvalToTypeCastRector::class, PostIncDecToPreIncDecRector::class, UseIncrementAssignRector::class, FinalizeTestCaseClassRector::class]);
};
3 changes: 3 additions & 0 deletions rules/EarlyReturn/NodeAnalyzer/IfAndAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use PhpParser\Node\Stmt\Return_;
use Rector\PhpParser\Comparing\NodeComparator;
use Rector\PhpParser\Node\BetterNodeFinder;
/**
* @deprecated Since 1.1.2, as related rule creates inverted conditions and makes code much less readable.
*/
final class IfAndAnalyzer
{
/**
Expand Down
3 changes: 3 additions & 0 deletions rules/EarlyReturn/NodeAnalyzer/SimpleScalarAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Scalar\String_;
/**
* @deprecated Since 1.1.2, as related rule creates inverted conditions and makes code much less readable.
*/
final class SimpleScalarAnalyzer
{
public function isSimpleScalar(Expr $expr) : bool
Expand Down
3 changes: 3 additions & 0 deletions rules/EarlyReturn/NodeFactory/InvertedIfFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Rector\EarlyReturn\NodeTransformer\ConditionInverter;
use Rector\NodeNestingScope\ContextAnalyzer;
use Rector\NodeTypeResolver\Node\AttributeKey;
/**
* @deprecated Since 1.1.2, as related rule creates inverted conditions and makes code much less readable.
*/
final class InvertedIfFactory
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Tests\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector\ChangeAndIfToEarlyReturnRectorTest
* @deprecated Since 1.1.2, as this rule creates inverted conditions and makes code much less readable.
*/
final class ChangeAndIfToEarlyReturnRector extends AbstractRector
{
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'dbcc9cb871623c76b7db7b31d1cb43f8268a3bec';
public const PACKAGE_VERSION = 'd68e8fa32a27c1ddd474ef6f1b4e1f63a74e5708';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-06-26 11:05:38';
public const RELEASE_DATE = '2024-06-26 11:07:18';
/**
* @var int
*/
Expand Down
1 change: 1 addition & 0 deletions src/NodeCollector/BinaryOpConditionsCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PhpParser\Node\Expr\BinaryOp;
/**
* @see \Rector\Tests\NodeCollector\BinaryOpConditionsCollectorTest
* @deprecated Since 1.1.2, as related rule creates inverted conditions and makes code much less readable.
*/
final class BinaryOpConditionsCollector
{
Expand Down

0 comments on commit a26759c

Please sign in to comment.