Skip to content

Rewrite argument type checks as assertions #30

@ricardoboss

Description

@ricardoboss

According to https://www.php.net/manual/en/function.assert.php, the assert keyword is, since PHP 7, a language construct, which is discarded in a production runtime and executed in a development scenario. There are multiple type checks for method arguments (for example for implementations of ArrayAccess), which also help improve static analysis. The same can be achieved with assertions while improving real-world performance, since they are not evaluated if the appropriate settings are in place.

Method Elephox\Collection\ObjectSet::add already implements the desired assertion style.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersimprovementImproves usability or overall DXperformanceDegrading or improving performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions