Opened 2 years ago
Last modified 11 months ago
#42918 new enhancement
Replace intval(), strval(), ... function calls with type hints
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch needs-testing |
Focuses: | performance | Cc: | |
PR Number: |
Description
PHP's intval()
, strval()
, floatval()
and boolval()
are from PHP 4 ages. PHP 5 and later has the type hinting pattern (e.g (int) $var
) that is ~6x faster than their function-call counterpart.
There are over 250 such calls, and I'll upload a patch to replace them with type hints. The patch itself is large, but because intval()
and (int)
are identical in usage, I hope you can review it. The test suit passed (https://travis-ci.org/Ayesh/wordpress-develop/builds/317469175).
I have not changed anything in third party libraries (such as random_compat).
Thank you.
Attachments (2)
Change History (5)
@
2 years ago
Please disregard the previous patch. Uploading a new one with proper WP code styling. Thanks to https://github.com/Mahjouba91 for the review and additional fixes.
#2
@
2 years ago
Travis tests for the last attached patch: https://travis-ci.org/Ayesh/wordpress-develop/builds/317731953
ONe big patch with all changes