Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Rewrite argument type checks as assertions #30

Open
ricardoboss opened this issue Apr 29, 2023 · 0 comments
Open

Rewrite argument type checks as assertions #30

ricardoboss opened this issue Apr 29, 2023 · 0 comments
Labels
good first issue Good for newcomers improvement Improves usability or overall DX performance Degrading or improving performance

Comments

@ricardoboss
Copy link
Member

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.

@ricardoboss ricardoboss added improvement Improves usability or overall DX performance Degrading or improving performance good first issue Good for newcomers labels Apr 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers improvement Improves usability or overall DX performance Degrading or improving performance
Projects
None yet
Development

No branches or pull requests

1 participant