Hi
On 1/29/25 20:31, Rob Landers wrote:
This looks promising!
Why do we need the (void) cast? Wouldn't "@" work and avoid a BC issue?
The @
operator also suppresses any other warning or notice within the call chain. That is likely undesirable because it might hide issues one is interested in. See this example (https://3v4l.org/NDtR7):
<?php
function inner() {
var_dump($undefined);
}
function outer() {
inner();
}
outer();
outer();
@outer();
The (void)
cast makes the intent of not being interested in the return value clear. In C casting to (void)
is an established pattern of "using" a value that the compiler would otherwise consider unused. Likewise will the void
operator suppress the TypeScript-ESLint warning of not using returned Promise
: https://typescript-eslint.io/rules/no-floating-promises/#ignorevoid
Best regards
Tim Düsterhus