Hi PHP developers, I'm new to the PHP development world and enjoying to learn the internals of this popular language. I'm also very interested in testing and typing.
Most if not all of the few tests in ext/ with strict_types=1 are related to bugs. Function argument parsing is done explicitly (eg with Z_PARAM_OPTIONAL or Z_PARAM_LONG) and this is prone to errors. * sodium/tests/sodium_error_001.phpt * date/tests/timezones-list-strict.phpt * mysqli/tests/bug74547.phpt * zlib/tests/zlib_wrapper_level.phpt * gettext/tests/bug73730.phpt Currently all other tests are done with strict_types=0, so coverage can be increased simply by enabling strict_types. On a pull request discussion, Nikic said that enable it would fail for many tests of invalid inputs so the signal/noise ratio would be too low. Than I modified run-tests.php to accept a -t flag that inserts "declare(strict_types=1);" in the --FILE-- section of .phpt tests. Really happened what he said, tests for invalid input failed. So a new function check_strict_types() was needed to expose ZEND_ARG_USES_STRICT_TYPES() enabling .phpt tests to check for it in the --SKIPIF-- section if needed. I suppose that a function check_strict_types() didn't existed before because had no valid use cases and maybe also avoid the user to trick the interpreter. But seems really useful to run all possible tests with strict_types=1. You can start checking the implementation correctness with: $ ./run-tests.php -t ext/date/tests/timezone_transitions_get_variation3.phpt And the implementation draft is at this repository: https://github.com/php/php-src/compare/master...pslacerda:experimental/strict_testing?diff=split My proposal is to run all tests with and without strict_types, skipping if necessary, and increasing the code coverage. Depending of you overral reception I'll create an RFC for it. PHP for president! -- Atenciosamente, Pedro Lacerda