Skip to content

Support $this->assertIsString #67

Closed

Description

@amalricBzh

Hi,

I have this code :

$content = $client->getResponse()->getContent();
$this->assertIsString($content);
$this->assertJson($content);

phpstan throws an error:

Parameter #1 $actualJson of method PHPUnit\Framework\Assert::assertJson() expects string, string|false given.

I expect that phpstan understand that if assertIsString($content) passed, $content is a string, and phpstan should not throw an error.

My composer file:

"require-dev": {
    "phpstan/phpstan": "^0.11",
    "phpstan/phpstan-phpunit": "^0.11",
    [...]
}

Activity

  1. ondrejmirtes commented on Mar 31, 2020

    @ondrejmirtes
    Member

    Hi, upgrade to ^0.12, assertIsString is supported there.

    You shouldn't have any problems upgrading to the latest versions. If you don't have time to fix newly reported errors now, you can take advantage of a feature called the baseline: https://medium.com/@ondrejmirtes/phpstans-baseline-feature-lets-you-hold-new-code-to-a-higher-standard-e77d815a5dff

  2. github-actions commented on May 1, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  3. locked as resolved and limited conversation to collaborators on May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions