Hello. When debugging a function with a strict return type of
string, I noticed that the PHP analyzer is not enforcing that return type. It does however work for some others like
bool. The PHP extension is correctly detecting PHP version 7.4.
This function throws an exception in PHP 7.4 because the return type is expected to be string, not null. The return type hint would have to be corrected to
string|null or the returned type itself corrected to
string, but there are no static analysis errors shown. Even if the returned type is
null|string an error should be shown if the function is expected to return
string, but it is not.
This function has an error shown as expected:
Thanks for any help on this!