Skip to content

must_use function #12738

@zonuexe

Description

@zonuexe

Feature request

Rust refers to functions that should not discard their return values when used on a separate line as #[must_use], regardless of whether they have side effects. Similarly, PhpStorm marks such functions with #[Pure(true)].

ob_get_contents() is clearly an impure function with state, but it doesn't make sense to write ob_get_contents(); on a separate line. #[Pure(true)] means that.

refs phpstan/phpstan-src#3867 (comment)
refs #11101

Did PHPStan help you today? Did it make you happy in any way?

Tomorrow is the last day of my two-week spring internship at the company that employs me. The intern, who didn't know PHPStan, can now teach me the inner mechanisms of it. 🥰

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