Skip to content

Commit

Permalink
[MigrateAtToConsecutiveExpectationsRector] Remove rule as too various…
Browse files Browse the repository at this point in the history
… paths to handle, better handle manually
  • Loading branch information
TomasVotruba committed Feb 2, 2022
1 parent b415159 commit 6bb2609
Show file tree
Hide file tree
Showing 31 changed files with 13 additions and 1,452 deletions.
32 changes: 11 additions & 21 deletions docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 39 Rules Overview
# 38 Rules Overview

## AddDoesNotPerformAssertionToNonAssertingTestRector

Expand Down Expand Up @@ -87,11 +87,16 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->set(ArrayArgumentToDataProviderRector::class)
->configure([
ArrayArgumentToDataProviderRector::ARRAY_ARGUMENTS_TO_DATA_PROVIDERS => ValueObjectInliner::inline([
new ArrayArgumentToDataProvider('PHPUnit\Framework\TestCase', 'doTestMultiple', 'doTestSingle', 'number'),
]),
]]);
->call('configure', [[
ArrayArgumentToDataProviderRector::ARRAY_ARGUMENTS_TO_DATA_PROVIDERS => ValueObjectInliner::inline([
new ArrayArgumentToDataProvider(
'PHPUnit\Framework\TestCase',
'doTestMultiple',
'doTestSingle',
'number'
),
]),
]]);
};
```

Expand Down Expand Up @@ -579,21 +584,6 @@ Turns getMock*() methods to `createMock()`

<br>

## MigrateAtToConsecutiveExpectationsRector

Migrates deprecated `$this->at` to `$this->withConsecutive` and `$this->willReturnOnConsecutiveCalls`

- class: [`Rector\PHPUnit\Rector\ClassMethod\MigrateAtToConsecutiveExpectationsRector`](../src/Rector/ClassMethod/MigrateAtToConsecutiveExpectationsRector.php)

```diff
$mock = $this->createMock(Foo::class);
-$mock->expects($this->at(0))->with('0')->method('someMethod')->willReturn('1');
-$mock->expects($this->at(1))->with('1')->method('someMethod')->willReturn('2');
+$mock->method('someMethod')->withConsecutive(['0'], ['1'])->willReturnOnConsecutiveCalls('1', '2');
```

<br>

## RemoveDataProviderTestPrefixRector

Data provider methods cannot start with "test" prefix
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ parameters:

# rector co-variant
- '#Parameter \#1 \$node \(PhpParser\\Node\\(.*?) of method Rector\\(.*?)\(\) should be contravariant with parameter \$node \(PhpParser\\Node\) of method Rector\\Core\\Contract\\Rector\\PhpRectorInterface\:\:refactor\(\)#'
- '#Parameter \#2 \$length of function array_chunk expects int<1, max\>, int given#'
165 changes: 0 additions & 165 deletions src/NodeAnalyzer/ExpectationAnalyzer.php

This file was deleted.

Loading

0 comments on commit 6bb2609

Please sign in to comment.