Closure not recognized
szepeviktor opened this issue · 8 comments
add_filter(
'frm_fields_in_entries_list_table',
function ( $form_cols ) {
return array_filter(
$form_cols,
function ( $form_col ) {
return 'gateway' !== $form_col->type;
}
);
}
);
Filter callback return statement is missing.
@IanDelMar What is up here??
function ( $form_cols ): array
solves the problem but this code runs on PHP 7.0.
return [];
in place of array_filter also "solves" the problem.
I think this is because the closure has no return type declared either via its signature or via a docblock.
or via a docblock.
I've tried /** @return array */
, it does not help.
I'll have a look later today.
@szepeviktor This seems to be related to issue #221. (The fix in #223 has not been released yet.) "Filter callback return statement is missing" is no longer reported from dev-master#1e3cae664d215bed28602ee7ed2c356efd11b011 onwards and is most likely not present in version 1.3.4 with PHPStan versions below 1.10.50.
and is most likely not present in version 1.3.4 with PHPStan versions below 1.10.50
I just tested this, and indeed, it is not reported.
@IanDelMar You are a treasure.
https://github.com/szepeviktor/phpstan-wordpress/releases/tag/v1.3.5