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

fix: authorize string as key for datasets #233

Merged
merged 1 commit into from
Nov 30, 2020
Merged

fix: authorize string as key for datasets #233

merged 1 commit into from
Nov 30, 2020

Conversation

misaert
Copy link
Contributor

@misaert misaert commented Nov 30, 2020

Q A
Bug fix? yes
New feature? no

When using dataset with string as array key in projects, PHPStan refuses because of:

$ vendor/bin/pest

   PASS  Tests\Unit\DatasetTest
  ✓ it tests with string key for dataset with data set "with value `true`" (true)

  Tests:  1 passed
  Time:   0.04s

$ vendor/bin/phpstan analyze
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/Unit\DatasetTest.php                                                                                                                
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------- 
  12    Parameter #1 $data of method Pest\PendingObjects\TestCall::with() expects Closure|iterable<int, mixed>|string, array('with value `true`' => true) given.  
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------- 

                                                                                                                        
 [ERROR] Found 1 error

for the test below:

it('tests with string key for dataset', function (bool $expected) {
    assertTrue($expected);
})->with([
    'with value `true`' => true
]);

This PR fixes this.

@nunomaduro nunomaduro merged commit f9f6f28 into pestphp:master Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants