This repository has been archived by the owner on Nov 12, 2024. It is now read-only.
Rewrite argument type checks as assertions #30
Labels
good first issue
Good for newcomers
improvement
Improves usability or overall DX
performance
Degrading or improving performance
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 ofArrayAccess
), 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.The text was updated successfully, but these errors were encountered: