Hi
On 8/5/24 18:06, Levi Morrison wrote:
After thinking about this several times over the course of discussion
and again now that it's in voting, I have decided to vote no. I am in
favor of this change, I just think given the concerns it's best to
wait for PHP 9.0 to do it. Maybe the concerns with control flow can be
improved by better inference/marking of functions which are
`noreturn`, at least for known functions (of which `\exit` definitely
would be).
As I've just explained in my response to Derick within the discussion
thread related to this RFC: The information is already there, it just
needs to be used.
For a test I've just added the following code snippet to
`zend_compile_call()`:
zend_type return_type = fbc->common.arg_info[-1].type;
if (ZEND_TYPE_CONTAINS_CODE(return_type, IS_NEVER)) {
printf("%s has return type never\n", ZSTR_VAL(lcname));
} else {
printf("%s doesn't have return type never\n", ZSTR_VAL(lcname));
}
and then I executed the following test script:
<?php
namespace Foo;
function a() {
\strrev('foo');
exit(new \stdClass());
}
try {
a();
} catch (\Throwable) {}
echo "executed", PHP_EOL;
when running this script, I receive the following output:
strrev doesn't have return type never
exit has return type never
executed
Best regards
Tim Düsterhus