StringOrArrayDynamicFunctionReturnTypeExtension narrows the return type to strings. While this is true for esc_sql(), wp_slash() and wp_unslash() do not change the type of the values.
wp_slash([true]); // gives [true]
wp_unslash(1); // gives 1
esc_sql([true]); // gives ['1']
esc_sql(1); // gives '1'
For Array[] also the return type for esc_sql() is incorrect.
esc_sql([[1]]); // gives array<int,array<int,string>>
esc_sql([['key' => 1]]); // gives array<int,array<string,string>>
esc_sql(['key' => [1]]); // gives array<string,array<int,string>>
esc_sql(['key1' => ['key2' => 1]]); // gives array<string,array<string,string>>
// the extension gives either array<int,string> or array<string,string>
Currently the extension also lacks a maybe array case, ie string|array<int|string,mixed>, and a maybe string array key case, ie array<int|string,mixed>.
StringOrArrayDynamicFunctionReturnTypeExtensionnarrows the return type to strings. While this is true foresc_sql(),wp_slash()andwp_unslash()do not change the type of the values.For
Array[]also the return type foresc_sql()is incorrect.Currently the extension also lacks a maybe array case, ie
string|array<int|string,mixed>, and a maybe string array key case, iearray<int|string,mixed>.