Skip to content

Usage of asserts is incorrect? #1914

@sergekukharev

Description

@sergekukharev

It's not a secret that all asserts in PHPUnit are in fact static methods, but everyone are using them as they are not, even official documentation.

I think I understand the reasons, why they were made static in first place, probably it is related to performance (btw, do other reasons exists for that?).

But in my own opinion, if they are static, we should use them as we use other static methods to make our code cleaner.

This means using:

self::assertTrue(...);

instead of:

$this->assertTrue(...);

Can anyone give me a good reason why we shouldn't?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions