Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MigrateAtToConsecutiveExpectationsRector] Deprecate rule as way too ambiguous paths to upgrade and breaking, better handle manually #44

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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