[Performance] [Polyfill] Move to DeadCode (#5380)

This commit is contained in:
Tomas Votruba 2021-01-30 20:56:32 +01:00 committed by GitHub
parent c8da4517ec
commit 737b6471c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 108 additions and 149 deletions

View File

@ -48,20 +48,20 @@
"symfony/finder": "^4.4.8|^5.1",
"symfony/http-kernel": "^4.4.8|^5.1",
"symfony/process": "^4.4.8|^5.1",
"symplify/astral": "^9.0.48",
"symplify/autowire-array-parameter": "^9.0.48",
"symplify/console-color-diff": "^9.0.48",
"symplify/package-builder": "^9.0.48",
"symplify/rule-doc-generator": "^9.0.48",
"symplify/set-config-resolver": "^9.0.48",
"symplify/simple-php-doc-parser": "^9.0.48",
"symplify/skipper": "^9.0.48",
"symplify/smart-file-system": "^9.0.48",
"symplify/symfony-php-config": "^9.0.48",
"symplify/astral": "^9.0.47",
"symplify/autowire-array-parameter": "^9.0.47",
"symplify/console-color-diff": "^9.0.47",
"symplify/package-builder": "^9.0.47",
"symplify/rule-doc-generator": "^9.0.47",
"symplify/set-config-resolver": "^9.0.47",
"symplify/simple-php-doc-parser": "^9.0.47",
"symplify/skipper": "^9.0.47",
"symplify/smart-file-system": "^9.0.47",
"symplify/symfony-php-config": "^9.0.47",
"webmozart/assert": "^1.9"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.17.3",
"friendsofphp/php-cs-fixer": "^2.18.2",
"nette/application": "^3.0.7",
"nette/di": "^3.0",
"nette/forms": "^3.0",
@ -72,13 +72,12 @@
"sebastian/diff": "^4.0.4",
"symfony/security-core": "^5.2",
"symfony/security-http": "^5.2",
"symplify/changelog-linker": "^9.0.48",
"symplify/coding-standard": "^9.0.48",
"symplify/easy-coding-standard": "^9.0.48",
"symplify/easy-testing": "^9.0.48",
"symplify/phpstan-extensions": "^9.0.48",
"symplify/phpstan-rules": "^9.0.48",
"tracy/tracy": "^2.7"
"symplify/changelog-linker": "^9.0.47",
"symplify/coding-standard": "^9.0.47",
"symplify/easy-coding-standard": "^9.0.47",
"symplify/easy-testing": "^9.0.47",
"symplify/phpstan-extensions": "^9.0.47",
"symplify/phpstan-rules": "^9.0.47"
},
"replace": {
"rector/rector-prefixed": "self.version"
@ -141,7 +140,6 @@
"Rector\\PHPUnitSymfony\\": "rules/phpunit-symfony/src",
"Rector\\PHPUnit\\": "rules/phpunit/src",
"Rector\\PSR4\\": "rules/psr4/src",
"Rector\\Performance\\": "rules/performance/src",
"Rector\\Php52\\": "rules/php52/src",
"Rector\\Php53\\": "rules/php53/src",
"Rector\\Php54\\": "rules/php54/src",
@ -155,7 +153,6 @@
"Rector\\Php80\\": "rules/php80/src",
"Rector\\PhpAttribute\\": "packages/php-attribute/src",
"Rector\\PhpSpecToPHPUnit\\": "rules/php-spec-to-phpunit/src",
"Rector\\Polyfill\\": "rules/polyfill/src",
"Rector\\Compiler\\": "utils/compiler/src",
"Rector\\PostRector\\": "packages/post-rector/src",
"Rector\\Visibility\\": "rules/visibility/src",
@ -268,7 +265,6 @@
"Rector\\PHPUnitSymfony\\Tests\\": "rules/phpunit-symfony/tests",
"Rector\\PHPUnit\\Tests\\": "rules/phpunit/tests",
"Rector\\PSR4\\Tests\\": "rules/psr4/tests",
"Rector\\Performance\\Tests\\": "rules/performance/tests",
"Rector\\Php52\\Tests\\": "rules/php52/tests",
"Rector\\Php53\\Tests\\": "rules/php53/tests",
"Rector\\Php54\\Tests\\": "rules/php54/tests",
@ -281,7 +277,6 @@
"Rector\\Php74\\Tests\\": "rules/php74/tests",
"Rector\\Php80\\Tests\\": "rules/php80/tests",
"Rector\\PhpSpecToPHPUnit\\Tests\\": "rules/php-spec-to-phpunit/tests",
"Rector\\Polyfill\\Tests\\": "rules/polyfill/tests",
"Rector\\Privatization\\Tests\\": "rules/privatization/tests",
"Rector\\RectorGenerator\\Tests\\": "packages/rector-generator/tests",
"Rector\\RemovingStatic\\Tests\\": "rules/removing-static/tests",
@ -340,7 +335,5 @@
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
}

View File

@ -5,8 +5,8 @@ declare(strict_types=1);
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
use Rector\CodeQualityStrict\Rector\If_\MoveOutMethodCallInsideIfConditionRector;
use Rector\CodeQualityStrict\Rector\Variable\MoveVariableDeclarationNearReferenceRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\MethodCall\UseMessageVariableForSprintfInSymfonyStyleRector;
use Rector\Performance\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {

View File

@ -1,12 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Performance\Rector\FuncCall\PreslashSimpleFunctionRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(PreslashSimpleFunctionRector::class);
};

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
use Rector\Polyfill\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {

View File

@ -11339,7 +11339,7 @@ Adds namespace to namespace-less files or correct namespace to match PSR-4 in `c
Change `count` array comparison to empty array comparison to improve performance
- class: `Rector\Performance\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector`
- class: `Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector`
```diff
-count($array) === 0;
@ -11356,7 +11356,7 @@ Change `count` array comparison to empty array comparison to improve performance
Add pre-slash to short named functions to improve performance
- class: `Rector\Performance\Rector\FuncCall\PreslashSimpleFunctionRector`
- class: `Rector\CodingStyle\Rector\FuncCall\PreslashSimpleFunctionRector`
```diff
class SomeClass
@ -13417,7 +13417,7 @@ Rename "*Spec.php" file to "*Test.php" file
Remove functions exists if with else for always existing
- class: `Rector\Polyfill\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector`
- class: `Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector`
```diff
class SomeClass
@ -13441,7 +13441,7 @@ Remove functions exists if with else for always existing
Remove php version checks if they are passed
- class: `Rector\Polyfill\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector`
- class: `Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector`
```diff
// current PHP: 7.2

View File

@ -371,11 +371,6 @@ final class SetList
*/
public const ORDER = __DIR__ . '/../../../../config/set/order.php';
/**
* @var string
*/
public const PERFORMANCE = __DIR__ . '/../../../../config/set/performance.php';
/**
* @var string
*/

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Rector\Performance\Rector\FuncCall;
namespace Rector\CodingStyle\Rector\FuncCall;
use PhpParser\Node;
use PhpParser\Node\Expr;
@ -24,7 +24,7 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\CountArrayToEmptyArrayComparisonRectorTest
* @see \Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\CountArrayToEmptyArrayComparisonRectorTest
*/
final class CountArrayToEmptyArrayComparisonRector extends AbstractRector
{

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Rector\Performance\Rector\FuncCall;
namespace Rector\CodingStyle\Rector\FuncCall;
use Nette\Utils\Strings;
use PhpParser\Node;
@ -15,7 +15,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see https://stackoverflow.com/questions/55419673/php7-adding-a-slash-to-all-standard-php-functions-php-cs-fixer-rule
*
* @see \Rector\Performance\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\PreslashSimpleFunctionRectorTest
* @see \Rector\CodingStyle\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\PreslashSimpleFunctionRectorTest
*/
final class PreslashSimpleFunctionRector extends AbstractRector
{

View File

@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Iterator;
use Rector\Performance\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureFromLocalVar
{
@ -18,7 +18,7 @@ class FixtureFromLocalVar
-----
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureFromLocalVar
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureFromMethodCall
{
@ -23,7 +23,7 @@ class FixtureFromMethodCall
-----
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureFromMethodCall
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureFromParameter
{
@ -17,7 +17,7 @@ class FixtureFromParameter
-----
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureFromParameter
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureMarkAsTruthyCheck
{
@ -21,7 +21,7 @@ class FixtureMarkAsTruthyCheck
-----
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureMarkAsTruthyCheck
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureMarkAsTruthyNegationCheck
{
@ -15,7 +15,7 @@ class FixtureMarkAsTruthyNegationCheck
-----
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureMarkAsTruthyNegationCheck
{

View File

@ -1,8 +1,8 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureMarkAsTruthyNegationCheckInsideConditional
final class FixtureMarkAsTruthyNegationCheckInsideConditional
{
public function run()
{
@ -17,9 +17,9 @@ class FixtureMarkAsTruthyNegationCheckInsideConditional
-----
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureMarkAsTruthyNegationCheckInsideConditional
final class FixtureMarkAsTruthyNegationCheckInsideConditional
{
public function run()
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureMarkAsTruthyNegationCheckInsideOrAnd
{
@ -18,7 +18,7 @@ class FixtureMarkAsTruthyNegationCheckInsideOrAnd
-----
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class FixtureMarkAsTruthyNegationCheckInsideOrAnd
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
use Countable;
@ -15,4 +15,4 @@ class SkipMarkTruthyCheckInWhile
}
}
?>
?>

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
use Countable;
@ -12,4 +12,4 @@ class SkipNotArray
}
}
?>
?>

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector\Fixture;
class SkipNotCount
{
@ -10,4 +10,4 @@ class SkipNotCount
}
}
?>
?>

View File

@ -2,11 +2,11 @@
declare(strict_types=1);
namespace Rector\Performance\Tests\Rector\FuncCall\PreslashSimpleFunctionRector;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\PreslashSimpleFunctionRector;
use Iterator;
use Rector\CodingStyle\Rector\FuncCall\PreslashSimpleFunctionRector;
use Rector\Core\Configuration\Option;
use Rector\Performance\Rector\FuncCall\PreslashSimpleFunctionRector;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\Fixture;
class Fixture
{
@ -14,7 +14,7 @@ class Fixture
-----
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\Fixture;
class Fixture
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\Fixture;
class SkipVariableName
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\FixtureAutoImport;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\FixtureAutoImport;
class AutoImportNames
{
@ -14,7 +14,7 @@ class AutoImportNames
-----
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\FixtureAutoImport;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\FixtureAutoImport;
use stdClass;
class AutoImportNames

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\FixtureAutoImport;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\FixtureAutoImport;
class DoNotAutoImportNames
{
@ -15,7 +15,7 @@ class DoNotAutoImportNames
-----
<?php
namespace Rector\Performance\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\FixtureAutoImport;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\PreslashSimpleFunctionRector\FixtureAutoImport;
use stdClass;
class DoNotAutoImportNames

View File

@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Rector\Performance\Tests\Rector\FuncCall\PreslashSimpleFunctionRector;
namespace Rector\CodingStyle\Tests\Rector\FuncCall\PreslashSimpleFunctionRector;
use Iterator;
use Rector\Performance\Rector\FuncCall\PreslashSimpleFunctionRector;
use Rector\CodingStyle\Rector\FuncCall\PreslashSimpleFunctionRector;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

View File

@ -2,16 +2,16 @@
declare(strict_types=1);
namespace Rector\Polyfill;
namespace Rector\DeadCode;
use PhpParser\Node\Expr\BinaryOp\Equal;
use PhpParser\Node\Expr\BinaryOp\Identical;
use PhpParser\Node\Expr\BinaryOp\NotEqual;
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Polyfill\Contract\ConditionInterface;
use Rector\Polyfill\ValueObject\BinaryToVersionCompareCondition;
use Rector\Polyfill\ValueObject\VersionCompareCondition;
use Rector\DeadCode\Contract\ConditionInterface;
use Rector\DeadCode\ValueObject\BinaryToVersionCompareCondition;
use Rector\DeadCode\ValueObject\VersionCompareCondition;
final class ConditionEvaluator
{
@ -68,12 +68,12 @@ final class ConditionEvaluator
if ($binaryToVersionCompareCondition->getBinaryClass() === Equal::class) {
// weak comparison on purpose
return $binaryToVersionCompareCondition->getExpectedValue() == $versionCompareResult;
return $binaryToVersionCompareCondition->getExpectedValue() === $versionCompareResult;
}
if ($binaryToVersionCompareCondition->getBinaryClass() === NotEqual::class) {
// weak comparison on purpose
return $binaryToVersionCompareCondition->getExpectedValue() != $versionCompareResult;
return $binaryToVersionCompareCondition->getExpectedValue() !== $versionCompareResult;
}
throw new ShouldNotHappenException();

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Rector\Polyfill;
namespace Rector\DeadCode;
use PhpParser\Node;
use PhpParser\Node\Expr;
@ -14,10 +14,10 @@ use PhpParser\Node\Expr\FuncCall;
use Rector\Core\Php\PhpVersionProvider;
use Rector\Core\PhpParser\Node\Value\ValueResolver;
use Rector\Core\Util\PhpVersionFactory;
use Rector\DeadCode\Contract\ConditionInterface;
use Rector\DeadCode\ValueObject\BinaryToVersionCompareCondition;
use Rector\DeadCode\ValueObject\VersionCompareCondition;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\Polyfill\Contract\ConditionInterface;
use Rector\Polyfill\ValueObject\BinaryToVersionCompareCondition;
use Rector\Polyfill\ValueObject\VersionCompareCondition;
final class ConditionResolver
{

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Rector\Polyfill\Contract;
namespace Rector\DeadCode\Contract;
interface ConditionInterface
{

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Rector\Polyfill\FeatureSupport;
namespace Rector\DeadCode\FeatureSupport;
use Rector\Core\Php\PhpVersionProvider;
use Rector\Core\ValueObject\PhpVersion;

View File

@ -2,19 +2,19 @@
declare(strict_types=1);
namespace Rector\Polyfill\Rector\If_;
namespace Rector\DeadCode\Rector\If_;
use PhpParser\Node;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Stmt\If_;
use Rector\Core\PhpParser\Node\Manipulator\IfManipulator;
use Rector\Core\Rector\AbstractRector;
use Rector\Polyfill\FeatureSupport\FunctionSupportResolver;
use Rector\DeadCode\FeatureSupport\FunctionSupportResolver;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector\UnwrapFutureCompatibleIfFunctionExistsRectorTest
* @see \Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector\UnwrapFutureCompatibleIfFunctionExistsRectorTest
*/
final class UnwrapFutureCompatibleIfFunctionExistsRector extends AbstractRector
{

View File

@ -2,21 +2,21 @@
declare(strict_types=1);
namespace Rector\Polyfill\Rector\If_;
namespace Rector\DeadCode\Rector\If_;
use PhpParser\Node;
use PhpParser\Node\Stmt\If_;
use Rector\Core\Rector\AbstractRector;
use Rector\Polyfill\ConditionEvaluator;
use Rector\Polyfill\ConditionResolver;
use Rector\Polyfill\Contract\ConditionInterface;
use Rector\DeadCode\ConditionEvaluator;
use Rector\DeadCode\ConditionResolver;
use Rector\DeadCode\Contract\ConditionInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see https://www.php.net/manual/en/function.version-compare.php
*
* @see \Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\UnwrapFutureCompatibleIfPhpVersionRectorTest
* @see \Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\UnwrapFutureCompatibleIfPhpVersionRectorTest
*/
final class UnwrapFutureCompatibleIfPhpVersionRector extends AbstractRector
{

View File

@ -2,9 +2,9 @@
declare(strict_types=1);
namespace Rector\Polyfill\ValueObject;
namespace Rector\DeadCode\ValueObject;
use Rector\Polyfill\Contract\ConditionInterface;
use Rector\DeadCode\Contract\ConditionInterface;
final class BinaryToVersionCompareCondition implements ConditionInterface
{

View File

@ -2,9 +2,9 @@
declare(strict_types=1);
namespace Rector\Polyfill\ValueObject;
namespace Rector\DeadCode\ValueObject;
use Rector\Polyfill\Contract\ConditionInterface;
use Rector\DeadCode\Contract\ConditionInterface;
final class VersionCompareCondition implements ConditionInterface
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector\Fixture;
class Fixture
{
@ -12,7 +12,7 @@ class Fixture
} else {
session_write_close();
}
// session locking trough other addons
if (function_exists('session_abort')) {
session_abort();
@ -24,7 +24,7 @@ class Fixture
-----
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector\Fixture;
class Fixture
{
@ -32,7 +32,7 @@ class Fixture
{
// session locking trough other addons
session_abort();
// session locking trough other addons
session_abort();
}

View File

@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
use Iterator;
use Rector\Polyfill\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class CompareToInteger
{
@ -19,7 +19,7 @@ class CompareToInteger
-----
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class CompareToInteger
{

View File

@ -1,13 +1,13 @@
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class CompareToIntegerInversed
{
public function run()
{
// current PHP: 10.0
if (1 == version_compare('7.2', PHP_VERSION, '<')) {
if (version_compare('7.2', PHP_VERSION, '<') == 1) {
return 'is PHP 7.1-';
} else {
return 'is PHP 7.2+';
@ -19,14 +19,14 @@ class CompareToIntegerInversed
-----
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class CompareToIntegerInversed
{
public function run()
{
// current PHP: 10.0
return 'is PHP 7.1-';
return 'is PHP 7.2+';
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class CompareToIntegerNegated
{
@ -19,7 +19,7 @@ class CompareToIntegerNegated
-----
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class CompareToIntegerNegated
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class Fixture
{
@ -19,7 +19,7 @@ class Fixture
-----
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class Fixture
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class Inversed
{
@ -19,7 +19,7 @@ class Inversed
-----
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class Inversed
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector\Fixture;
class SkipElsefis
{

View File

@ -2,10 +2,10 @@
declare(strict_types=1);
namespace Rector\Polyfill\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
namespace Rector\DeadCode\Tests\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
use Iterator;
use Rector\Polyfill\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

View File

@ -1,17 +0,0 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->defaults()
->public()
->autowire()
->autoconfigure();
$services->load('Rector\Polyfill\\', __DIR__ . '/../src')
->exclude([__DIR__ . '/../src/Rector', __DIR__ . '/../src/ValueObject']);
};