Skip to content

Commit

Permalink
Move Infection\Mutator\Mutator to a separate package (#1963)
Browse files Browse the repository at this point in the history
* Move `Infection\Mutator\Mutator` to a separate package

* Upgrade `infection/mutator`

* Fix `psalm` issues

* Fix `phpstan` errors

* Update e2e test to require `infection/mutator`. Bot, you were right

* Add `TNode` template param to `IgnoreMutator`
  • Loading branch information
maks-rafalko committed May 15, 2024
1 parent 0d5fd7e commit 18a92e9
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 243 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"infection/abstract-testframework-adapter": "^0.5.0",
"infection/extension-installer": "^0.1.0",
"infection/include-interceptor": "^0.2.5",
"infection/mutator": "^0.4",
"justinrainbow/json-schema": "^5.2.10",
"nikic/php-parser": "^5.0",
"ondram/ci-detector": "^4.1.0",
Expand Down
57 changes: 55 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<code><![CDATA[$this->converters[$name->toLowerString()]($node)]]></code>
</ImpureFunctionCall>
</file>
<file src="src/Mutator/IgnoreMutator.php">
<InvalidArgument>
<code>$node</code>
</InvalidArgument>
</file>
<file src="src/TestFramework/Coverage/JUnit/JUnitTestFileDataProvider.php">
<InvalidReturnType>
<code><![CDATA[iterable<string, string>]]></code>
Expand Down
2 changes: 1 addition & 1 deletion src/Command/DescribeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function executeCommand(IO $io): bool

Assert::subclassOf($mutatorClass, Mutator::class);

/** @var ?Definition $definition */
/** @var Definition $definition */
$definition = $mutatorClass::getDefinition();

if ($definition === null) {
Expand Down
77 changes: 0 additions & 77 deletions src/Mutator/Definition.php

This file was deleted.

2 changes: 2 additions & 0 deletions src/Mutator/IgnoreMutator.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public function canMutate(Node $node): bool
/**
* @psalm-mutation-free
*
* @param TNode $node
*
* @return iterable<int|Node|Node[]>
*/
public function mutate(Node $node): iterable
Expand Down
59 changes: 0 additions & 59 deletions src/Mutator/Mutator.php

This file was deleted.

98 changes: 0 additions & 98 deletions src/Mutator/MutatorCategory.php

This file was deleted.

3 changes: 3 additions & 0 deletions tests/e2e/Custom_Mutator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"psr-4": {
"Custom_Mutator\\Test\\": "tests/"
}
},
"require": {
"infection/mutator": "^0.4.0"
}
}
2 changes: 1 addition & 1 deletion tests/e2e/Custom_Mutator/src/Mutator/CustomMutator.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getName(): string
return end($parts);
}

public static function getDefinition(): ?Definition
public static function getDefinition(): Definition
{
return new Definition(
<<<'TXT'
Expand Down

0 comments on commit 18a92e9

Please sign in to comment.