From 8e03a22cba9392d3950f8d4be7577971064d7ac8 Mon Sep 17 00:00:00 2001 From: Oleg Zhulnev Date: Mon, 2 Nov 2020 17:38:06 +0300 Subject: [PATCH] Rename @zero_iteration profile to the @loop --- devTools/phpstan-src-baseline.neon | 30 +++++++++---------- resources/schema.json | 2 +- src/Mutator/{ZeroIteration => Loop}/For_.php | 2 +- .../{ZeroIteration => Loop}/Foreach_.php | 2 +- .../{ZeroIteration => Loop}/While_.php | 2 +- src/Mutator/ProfileList.php | 20 ++++++------- .../Schema/SchemaConfigurationFactoryTest.php | 10 +++---- .../Logger/CreateMetricsCalculator.php | 2 +- tests/phpunit/Logger/JsonLoggerTest.php | 2 +- .../phpunit/Metrics/MetricsCalculatorTest.php | 2 +- .../SortableMutantExecutionResultsTest.php | 2 +- .../MutantExecutionResultFactoryTest.php | 2 +- .../Mutant/MutantExecutionResultTest.php | 2 +- .../{ZeroIteration => Loop}/For_Test.php | 2 +- .../{ZeroIteration => Loop}/Foreach_Test.php | 2 +- .../{ZeroIteration => Loop}/While_Test.php | 2 +- tests/phpunit/Mutator/MutatorResolverTest.php | 2 +- .../Factory/MutantProcessFactoryTest.php | 2 +- .../Runner/MutationTestingRunnerTest.php | 2 +- 19 files changed, 46 insertions(+), 46 deletions(-) rename src/Mutator/{ZeroIteration => Loop}/For_.php (98%) rename src/Mutator/{ZeroIteration => Loop}/Foreach_.php (98%) rename src/Mutator/{ZeroIteration => Loop}/While_.php (98%) rename tests/phpunit/Mutator/{ZeroIteration => Loop}/For_Test.php (98%) rename tests/phpunit/Mutator/{ZeroIteration => Loop}/Foreach_Test.php (98%) rename tests/phpunit/Mutator/{ZeroIteration => Loop}/While_Test.php (98%) diff --git a/devTools/phpstan-src-baseline.neon b/devTools/phpstan-src-baseline.neon index 821901df1..cd9c35ceb 100644 --- a/devTools/phpstan-src-baseline.neon +++ b/devTools/phpstan-src-baseline.neon @@ -480,6 +480,21 @@ parameters: count: 1 path: ../src/Mutator/FunctionSignature/PublicVisibility.php + - + message: "#^Parameter \\#1 \\$node \\(PhpParser\\\\Node\\\\Stmt\\\\For_\\) of method Infection\\\\Mutator\\\\Loop\\\\For_\\:\\:mutate\\(\\) should be contravariant with parameter \\$node \\(PhpParser\\\\Node\\) of method Infection\\\\Mutator\\\\Mutator\\:\\:mutate\\(\\)$#" + count: 1 + path: ../src/Mutator/Loop/For_.php + + - + message: "#^Parameter \\#1 \\$node \\(PhpParser\\\\Node\\\\Stmt\\\\Foreach_\\) of method Infection\\\\Mutator\\\\Loop\\\\Foreach_\\:\\:mutate\\(\\) should be contravariant with parameter \\$node \\(PhpParser\\\\Node\\) of method Infection\\\\Mutator\\\\Mutator\\:\\:mutate\\(\\)$#" + count: 1 + path: ../src/Mutator/Loop/Foreach_.php + + - + message: "#^Parameter \\#1 \\$node \\(PhpParser\\\\Node\\\\Stmt\\\\While_\\) of method Infection\\\\Mutator\\\\Loop\\\\While_\\:\\:mutate\\(\\) should be contravariant with parameter \\$node \\(PhpParser\\\\Node\\) of method Infection\\\\Mutator\\\\Mutator\\:\\:mutate\\(\\)$#" + count: 1 + path: ../src/Mutator/Loop/While_.php + - message: "#^Call to static method Webmozart\\\\Assert\\\\Assert\\:\\:isArray\\(\\) with array and string will always evaluate to true\\.$#" count: 1 @@ -655,21 +670,6 @@ parameters: count: 1 path: ../src/Mutator/Unwrap/AbstractUnwrapMutator.php - - - message: "#^Parameter \\#1 \\$node \\(PhpParser\\\\Node\\\\Stmt\\\\For_\\) of method Infection\\\\Mutator\\\\ZeroIteration\\\\For_\\:\\:mutate\\(\\) should be contravariant with parameter \\$node \\(PhpParser\\\\Node\\) of method Infection\\\\Mutator\\\\Mutator\\:\\:mutate\\(\\)$#" - count: 1 - path: ../src/Mutator/ZeroIteration/For_.php - - - - message: "#^Parameter \\#1 \\$node \\(PhpParser\\\\Node\\\\Stmt\\\\Foreach_\\) of method Infection\\\\Mutator\\\\ZeroIteration\\\\Foreach_\\:\\:mutate\\(\\) should be contravariant with parameter \\$node \\(PhpParser\\\\Node\\) of method Infection\\\\Mutator\\\\Mutator\\:\\:mutate\\(\\)$#" - count: 1 - path: ../src/Mutator/ZeroIteration/Foreach_.php - - - - message: "#^Parameter \\#1 \\$node \\(PhpParser\\\\Node\\\\Stmt\\\\While_\\) of method Infection\\\\Mutator\\\\ZeroIteration\\\\While_\\:\\:mutate\\(\\) should be contravariant with parameter \\$node \\(PhpParser\\\\Node\\) of method Infection\\\\Mutator\\\\Mutator\\:\\:mutate\\(\\)$#" - count: 1 - path: ../src/Mutator/ZeroIteration/While_.php - - message: "#^Call to static method Webmozart\\\\Assert\\\\Mixin\\:\\:allIsInstanceOf\\(\\) with array\\ and 'PhpParser\\\\\\\\Node' will always evaluate to true\\.$#" count: 1 diff --git a/resources/schema.json b/resources/schema.json index 726780a9a..617ba111b 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -146,7 +146,7 @@ "@removal": { "$ref": "#/definitions/default-mutator-config" }, "@return_value": { "$ref": "#/definitions/default-mutator-config" }, "@sort": { "$ref": "#/definitions/default-mutator-config" }, - "@zero_iteration": { "$ref": "#/definitions/default-mutator-config" }, + "@loop": { "$ref": "#/definitions/default-mutator-config" }, "@cast": { "$ref": "#/definitions/default-mutator-config" }, "@unwrap": { "$ref": "#/definitions/default-mutator-config" }, "@extensions": { "$ref": "#/definitions/default-mutator-config" }, diff --git a/src/Mutator/ZeroIteration/For_.php b/src/Mutator/Loop/For_.php similarity index 98% rename from src/Mutator/ZeroIteration/For_.php rename to src/Mutator/Loop/For_.php index a18a11367..9a7291104 100644 --- a/src/Mutator/ZeroIteration/For_.php +++ b/src/Mutator/Loop/For_.php @@ -33,7 +33,7 @@ declare(strict_types=1); -namespace Infection\Mutator\ZeroIteration; +namespace Infection\Mutator\Loop; use Infection\Mutator\Definition; use Infection\Mutator\GetMutatorName; diff --git a/src/Mutator/ZeroIteration/Foreach_.php b/src/Mutator/Loop/Foreach_.php similarity index 98% rename from src/Mutator/ZeroIteration/Foreach_.php rename to src/Mutator/Loop/Foreach_.php index 039380429..c40c45f4c 100644 --- a/src/Mutator/ZeroIteration/Foreach_.php +++ b/src/Mutator/Loop/Foreach_.php @@ -33,7 +33,7 @@ declare(strict_types=1); -namespace Infection\Mutator\ZeroIteration; +namespace Infection\Mutator\Loop; use Infection\Mutator\Definition; use Infection\Mutator\GetMutatorName; diff --git a/src/Mutator/ZeroIteration/While_.php b/src/Mutator/Loop/While_.php similarity index 98% rename from src/Mutator/ZeroIteration/While_.php rename to src/Mutator/Loop/While_.php index 2e79e9a46..b75521b84 100644 --- a/src/Mutator/ZeroIteration/While_.php +++ b/src/Mutator/Loop/While_.php @@ -33,7 +33,7 @@ declare(strict_types=1); -namespace Infection\Mutator\ZeroIteration; +namespace Infection\Mutator\Loop; use Infection\Mutator\Definition; use Infection\Mutator\GetMutatorName; diff --git a/src/Mutator/ProfileList.php b/src/Mutator/ProfileList.php index ae7d8fa45..0e3b95939 100644 --- a/src/Mutator/ProfileList.php +++ b/src/Mutator/ProfileList.php @@ -57,6 +57,7 @@ final class ProfileList '@extensions' => self::EXTENSIONS_PROFILE, '@function_signature' => self::FUNCTION_SIGNATURE_PROFILE, '@identical' => self::IDENTICAL_PROFILE, + '@loop' => self::LOOP_PROFILE, '@number' => self::NUMBER_PROFILE, '@operator' => self::OPERATOR_PROFILE, '@regex' => self::REGEX_PROFILE, @@ -64,7 +65,6 @@ final class ProfileList '@return_value' => self::RETURN_VALUE_PROFILE, '@sort' => self::SORT_PROFILE, '@unwrap' => self::UNWRAP_PROFILE, - '@zero_iteration' => self::ZERO_ITERATION_PROFILE, ]; public const ARITHMETIC_PROFILE = [ @@ -188,10 +188,10 @@ final class ProfileList Mutator\Sort\Spaceship::class, ]; - public const ZERO_ITERATION_PROFILE = [ - Mutator\ZeroIteration\For_::class, - Mutator\ZeroIteration\Foreach_::class, - Mutator\ZeroIteration\While_::class, + public const LOOP_PROFILE = [ + Mutator\Loop\For_::class, + Mutator\Loop\Foreach_::class, + Mutator\Loop\While_::class, ]; public const CAST_PROFILE = [ @@ -268,6 +268,7 @@ final class ProfileList '@conditional_negotiation', '@extensions', '@function_signature', + '@loop', '@number', '@operator', '@regex', @@ -275,7 +276,6 @@ final class ProfileList '@return_value', '@sort', '@unwrap', - '@zero_iteration', ]; public const ALL_MUTATORS = [ @@ -379,10 +379,10 @@ final class ProfileList // Sort 'Spaceship' => Mutator\Sort\Spaceship::class, - // Zero Iteration - 'Foreach_' => Mutator\ZeroIteration\Foreach_::class, - 'For_' => Mutator\ZeroIteration\For_::class, - 'While_' => Mutator\ZeroIteration\While_::class, + // Loop + 'Foreach_' => Mutator\Loop\Foreach_::class, + 'For_' => Mutator\Loop\For_::class, + 'While_' => Mutator\Loop\While_::class, // Cast 'CastArray' => Mutator\Cast\CastArray::class, diff --git a/tests/phpunit/Configuration/Schema/SchemaConfigurationFactoryTest.php b/tests/phpunit/Configuration/Schema/SchemaConfigurationFactoryTest.php index e20eb3b6b..e2bbaa251 100644 --- a/tests/phpunit/Configuration/Schema/SchemaConfigurationFactoryTest.php +++ b/tests/phpunit/Configuration/Schema/SchemaConfigurationFactoryTest.php @@ -82,7 +82,7 @@ final class SchemaConfigurationFactoryTest extends TestCase '@removal', '@return_value', '@sort', - '@zero_iteration', + '@loop', '@default', ]; @@ -2045,7 +2045,7 @@ public function provideRawConfig(): iterable "@removal": true, "@return_value": true, "@sort": true, - "@zero_iteration": true, + "@loop": true, "@default": true } } @@ -2066,7 +2066,7 @@ public function provideRawConfig(): iterable '@removal' => true, '@return_value' => true, '@sort' => true, - '@zero_iteration' => true, + '@loop' => true, '@default' => true, ], ]), @@ -2307,7 +2307,7 @@ public function provideRawConfig(): iterable "@removal": true, "@return_value": true, "@sort": true, - "@zero_iteration": true, + "@loop": true, "@default": true } } @@ -2521,7 +2521,7 @@ public function provideRawConfig(): iterable '@removal' => true, '@return_value' => true, '@sort' => true, - '@zero_iteration' => true, + '@loop' => true, '@default' => true, ], ]), diff --git a/tests/phpunit/Logger/CreateMetricsCalculator.php b/tests/phpunit/Logger/CreateMetricsCalculator.php index cd3afd2f0..7584b1232 100644 --- a/tests/phpunit/Logger/CreateMetricsCalculator.php +++ b/tests/phpunit/Logger/CreateMetricsCalculator.php @@ -38,8 +38,8 @@ use Infection\Metrics\MetricsCalculator; use Infection\Mutant\DetectionStatus; use Infection\Mutant\MutantExecutionResult; +use Infection\Mutator\Loop\For_; use Infection\Mutator\Regex\PregQuote; -use Infection\Mutator\ZeroIteration\For_; use Infection\Tests\Mutator\MutatorName; use function Infection\Tests\normalize_trailing_spaces; diff --git a/tests/phpunit/Logger/JsonLoggerTest.php b/tests/phpunit/Logger/JsonLoggerTest.php index 8d31bc15f..a56a7c5b2 100644 --- a/tests/phpunit/Logger/JsonLoggerTest.php +++ b/tests/phpunit/Logger/JsonLoggerTest.php @@ -38,7 +38,7 @@ use Infection\Logger\JsonLogger; use Infection\Metrics\MetricsCalculator; use Infection\Mutant\DetectionStatus; -use Infection\Mutator\ZeroIteration\For_; +use Infection\Mutator\Loop\For_; use const JSON_THROW_ON_ERROR; use const PHP_EOL; use PHPUnit\Framework\TestCase; diff --git a/tests/phpunit/Metrics/MetricsCalculatorTest.php b/tests/phpunit/Metrics/MetricsCalculatorTest.php index d85aa790f..3e94a9f6d 100644 --- a/tests/phpunit/Metrics/MetricsCalculatorTest.php +++ b/tests/phpunit/Metrics/MetricsCalculatorTest.php @@ -39,7 +39,7 @@ use Infection\Metrics\MetricsCalculator; use Infection\Mutant\DetectionStatus; use Infection\Mutant\MutantExecutionResult; -use Infection\Mutator\ZeroIteration\For_; +use Infection\Mutator\Loop\For_; use Infection\Tests\Mutator\MutatorName; use PHPUnit\Framework\TestCase; diff --git a/tests/phpunit/Metrics/SortableMutantExecutionResultsTest.php b/tests/phpunit/Metrics/SortableMutantExecutionResultsTest.php index 5b89f775e..00543ab81 100644 --- a/tests/phpunit/Metrics/SortableMutantExecutionResultsTest.php +++ b/tests/phpunit/Metrics/SortableMutantExecutionResultsTest.php @@ -38,7 +38,7 @@ use Infection\Metrics\SortableMutantExecutionResults; use Infection\Mutant\DetectionStatus; use Infection\Mutant\MutantExecutionResult; -use Infection\Mutator\ZeroIteration\For_; +use Infection\Mutator\Loop\For_; use Infection\Tests\Mutator\MutatorName; use PHPUnit\Framework\TestCase; diff --git a/tests/phpunit/Mutant/MutantExecutionResultFactoryTest.php b/tests/phpunit/Mutant/MutantExecutionResultFactoryTest.php index b1c230fb7..a78f24ee1 100644 --- a/tests/phpunit/Mutant/MutantExecutionResultFactoryTest.php +++ b/tests/phpunit/Mutant/MutantExecutionResultFactoryTest.php @@ -41,7 +41,7 @@ use Infection\Mutant\Mutant; use Infection\Mutant\MutantExecutionResultFactory; use Infection\Mutation\Mutation; -use Infection\Mutator\ZeroIteration\For_; +use Infection\Mutator\Loop\For_; use Infection\PhpParser\MutatedNode; use Infection\Process\MutantProcess; use Infection\Tests\Mutator\MutatorName; diff --git a/tests/phpunit/Mutant/MutantExecutionResultTest.php b/tests/phpunit/Mutant/MutantExecutionResultTest.php index a937aaa7a..bd30ccec6 100644 --- a/tests/phpunit/Mutant/MutantExecutionResultTest.php +++ b/tests/phpunit/Mutant/MutantExecutionResultTest.php @@ -40,7 +40,7 @@ use Infection\Mutant\Mutant; use Infection\Mutant\MutantExecutionResult; use Infection\Mutation\Mutation; -use Infection\Mutator\ZeroIteration\For_; +use Infection\Mutator\Loop\For_; use Infection\PhpParser\MutatedNode; use Infection\Tests\Mutator\MutatorName; use PhpParser\Node\Stmt\Nop; diff --git a/tests/phpunit/Mutator/ZeroIteration/For_Test.php b/tests/phpunit/Mutator/Loop/For_Test.php similarity index 98% rename from tests/phpunit/Mutator/ZeroIteration/For_Test.php rename to tests/phpunit/Mutator/Loop/For_Test.php index e5f85d7f9..2f7116391 100644 --- a/tests/phpunit/Mutator/ZeroIteration/For_Test.php +++ b/tests/phpunit/Mutator/Loop/For_Test.php @@ -33,7 +33,7 @@ declare(strict_types=1); -namespace Infection\Tests\Mutator\ZeroIteration; +namespace Infection\Tests\Mutator\Loop; use Infection\Tests\Mutator\BaseMutatorTestCase; diff --git a/tests/phpunit/Mutator/ZeroIteration/Foreach_Test.php b/tests/phpunit/Mutator/Loop/Foreach_Test.php similarity index 98% rename from tests/phpunit/Mutator/ZeroIteration/Foreach_Test.php rename to tests/phpunit/Mutator/Loop/Foreach_Test.php index 08834d320..a80550667 100644 --- a/tests/phpunit/Mutator/ZeroIteration/Foreach_Test.php +++ b/tests/phpunit/Mutator/Loop/Foreach_Test.php @@ -33,7 +33,7 @@ declare(strict_types=1); -namespace Infection\Tests\Mutator\ZeroIteration; +namespace Infection\Tests\Mutator\Loop; use Infection\Tests\Mutator\BaseMutatorTestCase; diff --git a/tests/phpunit/Mutator/ZeroIteration/While_Test.php b/tests/phpunit/Mutator/Loop/While_Test.php similarity index 98% rename from tests/phpunit/Mutator/ZeroIteration/While_Test.php rename to tests/phpunit/Mutator/Loop/While_Test.php index 5903c06a8..5b49d5637 100644 --- a/tests/phpunit/Mutator/ZeroIteration/While_Test.php +++ b/tests/phpunit/Mutator/Loop/While_Test.php @@ -33,7 +33,7 @@ declare(strict_types=1); -namespace Infection\Tests\Mutator\ZeroIteration; +namespace Infection\Tests\Mutator\Loop; use Infection\Tests\Mutator\BaseMutatorTestCase; diff --git a/tests/phpunit/Mutator/MutatorResolverTest.php b/tests/phpunit/Mutator/MutatorResolverTest.php index cf9595cda..4d547a01d 100644 --- a/tests/phpunit/Mutator/MutatorResolverTest.php +++ b/tests/phpunit/Mutator/MutatorResolverTest.php @@ -43,9 +43,9 @@ use Infection\Mutator\Boolean\IdenticalEqual; use Infection\Mutator\Boolean\NotIdenticalNotEqual; use Infection\Mutator\Boolean\TrueValue; +use Infection\Mutator\Loop\For_; use Infection\Mutator\MutatorResolver; use Infection\Mutator\ProfileList; -use Infection\Mutator\ZeroIteration\For_; use Infection\Tests\SingletonContainer; use InvalidArgumentException; use PHPUnit\Framework\TestCase; diff --git a/tests/phpunit/Process/Factory/MutantProcessFactoryTest.php b/tests/phpunit/Process/Factory/MutantProcessFactoryTest.php index 0b22d79c0..80410f320 100644 --- a/tests/phpunit/Process/Factory/MutantProcessFactoryTest.php +++ b/tests/phpunit/Process/Factory/MutantProcessFactoryTest.php @@ -43,7 +43,7 @@ use Infection\Mutant\MutantExecutionResult; use Infection\Mutant\MutantExecutionResultFactory; use Infection\Mutation\Mutation; -use Infection\Mutator\ZeroIteration\For_; +use Infection\Mutator\Loop\For_; use Infection\PhpParser\MutatedNode; use Infection\Process\Factory\MutantProcessFactory; use Infection\Tests\Fixtures\Event\EventDispatcherCollector; diff --git a/tests/phpunit/Process/Runner/MutationTestingRunnerTest.php b/tests/phpunit/Process/Runner/MutationTestingRunnerTest.php index 0ef4023a2..aeea24c38 100644 --- a/tests/phpunit/Process/Runner/MutationTestingRunnerTest.php +++ b/tests/phpunit/Process/Runner/MutationTestingRunnerTest.php @@ -48,7 +48,7 @@ use Infection\Mutant\Mutant; use Infection\Mutant\MutantFactory; use Infection\Mutation\Mutation; -use Infection\Mutator\ZeroIteration\For_; +use Infection\Mutator\Loop\For_; use Infection\PhpParser\MutatedNode; use Infection\Process\Factory\MutantProcessFactory; use Infection\Process\MutantProcess;