From 81df07784d1fce26707a6680afd146b6c4b81c0b Mon Sep 17 00:00:00 2001 From: Dennis Koch Date: Wed, 5 Aug 2026 18:08:31 +0200 Subject: [PATCH 1/2] Transform existing `->and()` calls to `expect()` when `merge_different_variables` is false --- src/Rules/ChainExpectCallsRector.php | 88 +++++++++++++++++++ .../Fixture/existing_and_chain_split.php.inc | 20 +++++ ...ting_and_chain_split_and_rechained.php.inc | 20 +++++ .../existing_and_chain_untouched.php.inc | 7 -- 4 files changed, 128 insertions(+), 7 deletions(-) create mode 100644 tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split.php.inc create mode 100644 tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split_and_rechained.php.inc delete mode 100644 tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_untouched.php.inc diff --git a/src/Rules/ChainExpectCallsRector.php b/src/Rules/ChainExpectCallsRector.php index 83b3491..1ba32c5 100644 --- a/src/Rules/ChainExpectCallsRector.php +++ b/src/Rules/ChainExpectCallsRector.php @@ -11,6 +11,7 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\PropertyFetch; +use PhpParser\Node\Name; use PhpParser\Node\Stmt\Expression; use Rector\Contract\Rector\ConfigurableRectorInterface; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -83,6 +84,7 @@ public function getRuleDefinition(): RuleDefinition ), new ConfiguredCodeSample( <<<'CODE_SAMPLE' +// rector.php: [ChainExpectCallsRector::MERGE_DIFFERENT_VARIABLES => false] expect($a)->toBe(10); expect($a)->toBeInt(); expect($b)->toBe(10); @@ -92,6 +94,19 @@ public function getRuleDefinition(): RuleDefinition expect($a)->toBe(10) ->toBeInt(); expect($b)->toBe(10); +CODE_SAMPLE + , + [self::MERGE_DIFFERENT_VARIABLES => false] + ), + new ConfiguredCodeSample( + <<<'CODE_SAMPLE' +// rector.php: [ChainExpectCallsRector::MERGE_DIFFERENT_VARIABLES => false] +expect($a)->toBe(10)->and($b)->toBe(20); +CODE_SAMPLE + , + <<<'CODE_SAMPLE' +expect($a)->toBe(10); +expect($b)->toBe(20); CODE_SAMPLE , [self::MERGE_DIFFERENT_VARIABLES => false] @@ -145,6 +160,13 @@ public function refactor(Node $node): ?Node continue; } + if (! $this->mergeDifferentVariables && $this->splitAndChain($stmts, $key)) { + $hasChanged = true; + $changedInPass = true; + + break; + } + if (! isset($stmts[$key + 1])) { continue; } @@ -386,6 +408,72 @@ private function mergeDifferentVariableChains(array &$stmts, int $key): bool return true; } + /** + * @param array $stmts + */ + private function splitAndChain(array &$stmts, int $key): bool + { + /** @var Expression $exprStmt */ + $exprStmt = $stmts[$key]; + /** @var MethodCall $methodCall */ + $methodCall = $exprStmt->expr; + + $expectCall = $this->getExpectFuncCall($methodCall); + if (! $expectCall instanceof FuncCall) { + return false; + } + + $segments = []; + $currentBase = $expectCall; + $currentMethods = []; + + foreach ($this->collectChainMethods($methodCall) as $method) { + $nameValue = $method['name']; + $name = $nameValue instanceof Node ? $this->getName($nameValue) : $nameValue; + + if ($name !== 'and' || ! empty($method['is_property'])) { + $currentMethods[] = $method; + + continue; + } + + if (! isset($method['args'][0]) || ! $method['args'][0] instanceof Arg) { + return false; + } + + $segments[] = [$currentBase, $currentMethods]; + + $andValue = $method['args'][0]->value; + $andValue->setAttribute(AttributeKey::ORIGINAL_NODE, null); + $currentBase = new FuncCall(new Name('expect'), [new Arg($andValue)]); + $currentMethods = []; + } + + if ($segments === []) { + return false; + } + + $segments[] = [$currentBase, $currentMethods]; + + $newStmts = []; + foreach ($segments as $index => [$base, $segmentMethods]) { + $expr = $this->rebuildMethodChain($base, $segmentMethods); + + if ($index === 0) { + $exprStmt->expr = $expr; + $newStmts[] = $exprStmt; + } else { + $newStmts[] = new Expression($expr); + } + + $this->applyNewlineAttributes($expr); + } + + array_splice($stmts, $key, 1, $newStmts); + + return true; + } + private function applyNewlineAttributes(Expr $chain): void { if (! defined(AttributeKey::class.'::NEWLINE_ON_FLUENT_CALL')) { diff --git a/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split.php.inc b/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split.php.inc new file mode 100644 index 0000000..5cf4360 --- /dev/null +++ b/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split.php.inc @@ -0,0 +1,20 @@ +toBe(10)->and($b)->toBe(20); +expect($a)->toBeInt(); + +?> +----- +toBe(10); +expect($b)->toBe(20); +expect($a)->toBeInt(); + +?> diff --git a/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split_and_rechained.php.inc b/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split_and_rechained.php.inc new file mode 100644 index 0000000..d552af2 --- /dev/null +++ b/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split_and_rechained.php.inc @@ -0,0 +1,20 @@ +toBe(10)->and($b)->toBe(20)->not->toBeNull(); +expect($b)->toBeInt(); + +?> +----- +toBe(10); +expect($b)->toBe(20)->not->toBeNull() + ->toBeInt(); + +?> diff --git a/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_untouched.php.inc b/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_untouched.php.inc deleted file mode 100644 index e4f6f35..0000000 --- a/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_untouched.php.inc +++ /dev/null @@ -1,7 +0,0 @@ -toBe(10)->and($b)->toBe(20); -expect($a)->toBeInt(); From 130e0f46f119b10584b4810f7ef79b53bdd50ec5 Mon Sep 17 00:00:00 2001 From: Dennis Koch Date: Thu, 6 Aug 2026 14:27:17 +0200 Subject: [PATCH 2/2] Add `ConvertAndToExpectRector` --- docs/rules.md | 16 ++- src/AbstractRector.php | 38 ++++++ src/Rules/ChainExpectCallsRector.php | 125 ------------------ src/Rules/ConvertAndToExpectRector.php | 119 +++++++++++++++++ ...ctCallsRectorAndConvertAndToExpectTest.php | 15 +++ .../and_chain_split_and_rechained.php.inc} | 0 .../config/configured_rule.php | 14 ++ .../existing_and_chain_untouched.php.inc | 7 + .../ConvertAndToExpectRectorTest.php | 15 +++ .../Fixture/and_chain_split.php.inc} | 2 - ...ltiline_chain_formatting_preserved.php.inc | 25 ++++ .../Fixture/multiple_and_segments.php.inc | 21 +++ .../Fixture/no_and_untouched.php.inc | 5 + .../config/configured_rule.php | 10 ++ 14 files changed, 284 insertions(+), 128 deletions(-) create mode 100644 src/Rules/ConvertAndToExpectRector.php create mode 100644 tests/Rules/ChainExpectCallsRectorAndConvertAndToExpect/ChainExpectCallsRectorAndConvertAndToExpectTest.php rename tests/Rules/{ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split_and_rechained.php.inc => ChainExpectCallsRectorAndConvertAndToExpect/Fixture/and_chain_split_and_rechained.php.inc} (100%) create mode 100644 tests/Rules/ChainExpectCallsRectorAndConvertAndToExpect/config/configured_rule.php create mode 100644 tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_untouched.php.inc create mode 100644 tests/Rules/ConvertAndToExpectRector/ConvertAndToExpectRectorTest.php rename tests/Rules/{ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split.php.inc => ConvertAndToExpectRector/Fixture/and_chain_split.php.inc} (76%) create mode 100644 tests/Rules/ConvertAndToExpectRector/Fixture/multiline_chain_formatting_preserved.php.inc create mode 100644 tests/Rules/ConvertAndToExpectRector/Fixture/multiple_and_segments.php.inc create mode 100644 tests/Rules/ConvertAndToExpectRector/Fixture/no_and_untouched.php.inc create mode 100644 tests/Rules/ConvertAndToExpectRector/config/configured_rule.php diff --git a/docs/rules.md b/docs/rules.md index 653b1d9..3857101 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -1,4 +1,4 @@ -# 60 Rules Overview +# 61 Rules Overview ## ChainExpectCallsRector @@ -30,6 +30,20 @@ Chains consecutive `expect()` calls into a single chained expectation, combining
+## ConvertAndToExpectRector + +Splits `->and()` calls in `expect()` chains into separate `expect()` statements + +- class: [`Pest\Rector\Rules\ConvertAndToExpectRector`](../src/Rules/ConvertAndToExpectRector.php) + +```diff +-expect($a)->toBe(10)->and($b)->toBe(20); ++expect($a)->toBe(10); ++expect($b)->toBe(20); +``` + +
+ ## ConvertAssertToExpectRector Converts `$this->assert*()` calls to Pest `expect()` chains diff --git a/src/AbstractRector.php b/src/AbstractRector.php index 29cc379..6b374e4 100644 --- a/src/AbstractRector.php +++ b/src/AbstractRector.php @@ -29,6 +29,7 @@ use PhpParser\Node\Stmt\TryCatch; use PhpParser\Node\Stmt\While_; use PhpParser\Node\VariadicPlaceholder; +use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpParser\Enum\NodeGroup; use Rector\PhpParser\Node\FileNode; use Rector\Rector\AbstractRector as BaseAbstractRector; @@ -281,6 +282,43 @@ protected function rebuildMethodChain(Expr $base, array $methods): Expr return $result; } + protected function applyNewlineAttributes(Expr $chain): void + { + if (! defined(AttributeKey::class.'::NEWLINE_ON_FLUENT_CALL')) { + return; + } + + $current = $chain; + + while ($current instanceof MethodCall) { + $var = $current->var; + + if ($var instanceof FuncCall) { + break; + } + + if ($var instanceof PropertyFetch) { + $current = $var->var; + + continue; + } + + if (! $var instanceof MethodCall) { + break; + } + + if ($this->isName($var->name, 'and')) { + $var->setAttribute(AttributeKey::NEWLINE_ON_FLUENT_CALL, true); + $current = $var->var; + + continue; + } + + $current->setAttribute(AttributeKey::NEWLINE_ON_FLUENT_CALL, true); + $current = $var; + } + } + /** * @param array $sources */ diff --git a/src/Rules/ChainExpectCallsRector.php b/src/Rules/ChainExpectCallsRector.php index cf5b8f2..b4758c8 100644 --- a/src/Rules/ChainExpectCallsRector.php +++ b/src/Rules/ChainExpectCallsRector.php @@ -13,14 +13,12 @@ use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\ConstFetch; -use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\NullsafePropertyFetch; use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\StaticPropertyFetch; use PhpParser\Node\Expr\Variable; use PhpParser\Node\InterpolatedStringPart; -use PhpParser\Node\Name; use PhpParser\Node\Scalar; use PhpParser\Node\Scalar\InterpolatedString; use PhpParser\Node\Stmt\Expression; @@ -78,19 +76,6 @@ public function getRuleDefinition(): RuleDefinition expect($a)->toBe(10) ->toBeInt(); expect($b)->toBe(10); -CODE_SAMPLE - , - [self::MERGE_DIFFERENT_VARIABLES => false] - ), - new ConfiguredCodeSample( - <<<'CODE_SAMPLE' -// with merge_different_variables => false -expect($a)->toBe(10)->and($b)->toBe(20); -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -expect($a)->toBe(10); -expect($b)->toBe(20); CODE_SAMPLE , [self::MERGE_DIFFERENT_VARIABLES => false] @@ -144,13 +129,6 @@ public function refactor(Node $node): ?Node continue; } - if (! $this->mergeDifferentVariables && $this->splitAndChain($stmts, $key)) { - $hasChanged = true; - $changedInPass = true; - - break; - } - if (! isset($stmts[$key + 1])) { continue; } @@ -441,107 +419,4 @@ private function mergeDifferentVariableChains(array &$stmts, int $key): bool return true; } - - /** - * @param array $stmts - */ - private function splitAndChain(array &$stmts, int $key): bool - { - /** @var Expression $exprStmt */ - $exprStmt = $stmts[$key]; - /** @var MethodCall $methodCall */ - $methodCall = $exprStmt->expr; - - $expectCall = $this->getExpectFuncCall($methodCall); - if (! $expectCall instanceof FuncCall) { - return false; - } - - $segments = []; - $currentBase = $expectCall; - $currentMethods = []; - - foreach ($this->collectChainMethods($methodCall) as $method) { - $nameValue = $method['name']; - $name = $nameValue instanceof Node ? $this->getName($nameValue) : $nameValue; - - if ($name !== 'and' || ! empty($method['is_property'])) { - $currentMethods[] = $method; - - continue; - } - - if (! isset($method['args'][0]) || ! $method['args'][0] instanceof Arg) { - return false; - } - - $segments[] = [$currentBase, $currentMethods]; - - $andValue = $method['args'][0]->value; - $andValue->setAttribute(AttributeKey::ORIGINAL_NODE, null); - $currentBase = new FuncCall(new Name('expect'), [new Arg($andValue)]); - $currentMethods = []; - } - - if ($segments === []) { - return false; - } - - $segments[] = [$currentBase, $currentMethods]; - - $newStmts = []; - foreach ($segments as $index => [$base, $segmentMethods]) { - $expr = $this->rebuildMethodChain($base, $segmentMethods); - - if ($index === 0) { - $exprStmt->expr = $expr; - $newStmts[] = $exprStmt; - } else { - $newStmts[] = new Expression($expr); - } - - $this->applyNewlineAttributes($expr); - } - - array_splice($stmts, $key, 1, $newStmts); - - return true; - } - - private function applyNewlineAttributes(Expr $chain): void - { - if (! defined(AttributeKey::class.'::NEWLINE_ON_FLUENT_CALL')) { - return; - } - - $current = $chain; - - while ($current instanceof MethodCall) { - $var = $current->var; - - if ($var instanceof FuncCall) { - break; - } - - if ($var instanceof PropertyFetch) { - $current = $var->var; - - continue; - } - - if (! $var instanceof MethodCall) { - break; - } - - if ($this->isName($var->name, 'and')) { - $var->setAttribute(AttributeKey::NEWLINE_ON_FLUENT_CALL, true); - $current = $var->var; - - continue; - } - - $current->setAttribute(AttributeKey::NEWLINE_ON_FLUENT_CALL, true); - $current = $var; - } - } } diff --git a/src/Rules/ConvertAndToExpectRector.php b/src/Rules/ConvertAndToExpectRector.php new file mode 100644 index 0000000..8576ff3 --- /dev/null +++ b/src/Rules/ConvertAndToExpectRector.php @@ -0,0 +1,119 @@ +and()` calls in expect() chains into separate expect() statements', + [ + new CodeSample( + <<<'CODE_SAMPLE' +expect($a)->toBe(10)->and($b)->toBe(20); +CODE_SAMPLE + , + <<<'CODE_SAMPLE' +expect($a)->toBe(10); +expect($b)->toBe(20); +CODE_SAMPLE + ), + ] + ); + } + + // @codeCoverageIgnoreEnd + + /** + * @return array> + */ + public function getNodeTypes(): array + { + return [Expression::class]; + } + + /** + * @param Expression $node + * @return array|null + */ + public function refactor(Node $node): ?array + { + if (! $node->expr instanceof MethodCall) { + return null; + } + + if (! $this->isExpectChain($node->expr)) { + return null; + } + + $segments = []; + $segmentOutermost = $node->expr; + $current = $node->expr; + $child = null; + + while ($current instanceof MethodCall || $current instanceof PropertyFetch) { + if (! $current instanceof MethodCall || ! $this->isName($current->name, 'and')) { + $child = $current; + $current = $current->var; + + continue; + } + + if (! isset($current->args[0]) || ! $current->args[0] instanceof Arg) { + return null; + } + + $andValue = $current->args[0]->value; + $andValue->setAttribute(AttributeKey::ORIGINAL_NODE, null); + $expectCall = new FuncCall(new Name('expect'), [new Arg($andValue)]); + + if ($child === null) { + $segments[] = $expectCall; + } else { + $child->var = $expectCall; + $segments[] = $segmentOutermost; + } + + $segmentOutermost = $current->var; + $current = $current->var; + $child = null; + } + + if ($segments === []) { + return null; + } + + $segments[] = $segmentOutermost; + $segments = array_reverse($segments); + + $newStmts = []; + foreach ($segments as $index => $segmentExpr) { + if ($index === 0) { + $node->expr = $segmentExpr; + $newStmts[] = $node; + + continue; + } + + $newStmts[] = new Expression($segmentExpr); + } + + return $newStmts; + } +} diff --git a/tests/Rules/ChainExpectCallsRectorAndConvertAndToExpect/ChainExpectCallsRectorAndConvertAndToExpectTest.php b/tests/Rules/ChainExpectCallsRectorAndConvertAndToExpect/ChainExpectCallsRectorAndConvertAndToExpectTest.php new file mode 100644 index 0000000..57dd32f --- /dev/null +++ b/tests/Rules/ChainExpectCallsRectorAndConvertAndToExpect/ChainExpectCallsRectorAndConvertAndToExpectTest.php @@ -0,0 +1,15 @@ +doTestFile($filePath); +})->with( + fn (): Iterator => FixtureFileFinder::yieldDirectory(__DIR__.'/Fixture') +); diff --git a/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split_and_rechained.php.inc b/tests/Rules/ChainExpectCallsRectorAndConvertAndToExpect/Fixture/and_chain_split_and_rechained.php.inc similarity index 100% rename from tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split_and_rechained.php.inc rename to tests/Rules/ChainExpectCallsRectorAndConvertAndToExpect/Fixture/and_chain_split_and_rechained.php.inc diff --git a/tests/Rules/ChainExpectCallsRectorAndConvertAndToExpect/config/configured_rule.php b/tests/Rules/ChainExpectCallsRectorAndConvertAndToExpect/config/configured_rule.php new file mode 100644 index 0000000..33fee73 --- /dev/null +++ b/tests/Rules/ChainExpectCallsRectorAndConvertAndToExpect/config/configured_rule.php @@ -0,0 +1,14 @@ +rule(ConvertAndToExpectRector::class); + $rectorConfig->ruleWithConfiguration(ChainExpectCallsRector::class, [ + ChainExpectCallsRector::MERGE_DIFFERENT_VARIABLES => false, + ]); +}; diff --git a/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_untouched.php.inc b/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_untouched.php.inc new file mode 100644 index 0000000..e4f6f35 --- /dev/null +++ b/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_untouched.php.inc @@ -0,0 +1,7 @@ +toBe(10)->and($b)->toBe(20); +expect($a)->toBeInt(); diff --git a/tests/Rules/ConvertAndToExpectRector/ConvertAndToExpectRectorTest.php b/tests/Rules/ConvertAndToExpectRector/ConvertAndToExpectRectorTest.php new file mode 100644 index 0000000..57dd32f --- /dev/null +++ b/tests/Rules/ConvertAndToExpectRector/ConvertAndToExpectRectorTest.php @@ -0,0 +1,15 @@ +doTestFile($filePath); +})->with( + fn (): Iterator => FixtureFileFinder::yieldDirectory(__DIR__.'/Fixture') +); diff --git a/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split.php.inc b/tests/Rules/ConvertAndToExpectRector/Fixture/and_chain_split.php.inc similarity index 76% rename from tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split.php.inc rename to tests/Rules/ConvertAndToExpectRector/Fixture/and_chain_split.php.inc index 5cf4360..edcff98 100644 --- a/tests/Rules/ChainExpectCallsRectorWithoutMergeDifferentVariables/Fixture/existing_and_chain_split.php.inc +++ b/tests/Rules/ConvertAndToExpectRector/Fixture/and_chain_split.php.inc @@ -4,7 +4,6 @@ $a = 10; $b = 20; expect($a)->toBe(10)->and($b)->toBe(20); -expect($a)->toBeInt(); ?> ----- @@ -15,6 +14,5 @@ $b = 20; expect($a)->toBe(10); expect($b)->toBe(20); -expect($a)->toBeInt(); ?> diff --git a/tests/Rules/ConvertAndToExpectRector/Fixture/multiline_chain_formatting_preserved.php.inc b/tests/Rules/ConvertAndToExpectRector/Fixture/multiline_chain_formatting_preserved.php.inc new file mode 100644 index 0000000..eaba2fb --- /dev/null +++ b/tests/Rules/ConvertAndToExpectRector/Fixture/multiline_chain_formatting_preserved.php.inc @@ -0,0 +1,25 @@ +status->toBe('draft') + ->approved_at->toBeNull() + ->riskGroups->toHaveCount(2) + ->and($riskAssessment->status)->toBe('approved'); + +?> +----- +status->toBe('draft') + ->approved_at->toBeNull() + ->riskGroups->toHaveCount(2); +expect($riskAssessment->status)->toBe('approved'); + +?> diff --git a/tests/Rules/ConvertAndToExpectRector/Fixture/multiple_and_segments.php.inc b/tests/Rules/ConvertAndToExpectRector/Fixture/multiple_and_segments.php.inc new file mode 100644 index 0000000..980a370 --- /dev/null +++ b/tests/Rules/ConvertAndToExpectRector/Fixture/multiple_and_segments.php.inc @@ -0,0 +1,21 @@ +toBe(10)->toBeInt()->and($b)->toBe(20)->and($c)->not->toBeInt(); + +?> +----- +toBe(10)->toBeInt(); +expect($b)->toBe(20); +expect($c)->not->toBeInt(); + +?> diff --git a/tests/Rules/ConvertAndToExpectRector/Fixture/no_and_untouched.php.inc b/tests/Rules/ConvertAndToExpectRector/Fixture/no_and_untouched.php.inc new file mode 100644 index 0000000..1c025c7 --- /dev/null +++ b/tests/Rules/ConvertAndToExpectRector/Fixture/no_and_untouched.php.inc @@ -0,0 +1,5 @@ +toBe(10)->toBeInt(); diff --git a/tests/Rules/ConvertAndToExpectRector/config/configured_rule.php b/tests/Rules/ConvertAndToExpectRector/config/configured_rule.php new file mode 100644 index 0000000..b50d1ad --- /dev/null +++ b/tests/Rules/ConvertAndToExpectRector/config/configured_rule.php @@ -0,0 +1,10 @@ +rule(ConvertAndToExpectRector::class); +};