Changed Psalm template attempt to type.
This commit is contained in:
1 parent
1e9a600096
commit
6cab9bbd6b
1 file changed
+5
-8
@@ -25,11 +25,11 @@ class Hook_Formatter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template Callback as string|object|array
|
* @psalm-type Callback = string|object|array
|
||||||
* @template AcceptedArgs as int
|
* @psalm-type AcceptedArgs = int
|
||||||
* @template Hook as array{function: Callback, accepted_args: AcceptedArgs}
|
* @psalm-type Hook = array{function: Callback, accepted_args: AcceptedArgs}
|
||||||
* @template Priority as array-key
|
* @psalm-type Priority = array-key
|
||||||
* @template Hooks as array<Priority, array<Hook>>
|
* @psalm-type Hooks = array<Priority, array<Hook>>
|
||||||
*
|
*
|
||||||
* @param \WP_Hook|array $hook Hook instance.
|
* @param \WP_Hook|array $hook Hook instance.
|
||||||
* @psalm-param \WP_Hook|Hooks $hook
|
* @psalm-param \WP_Hook|Hooks $hook
|
||||||
@@ -51,12 +51,9 @@ class Hook_Formatter {
|
|||||||
|
|
||||||
ksort( $hook );
|
ksort( $hook );
|
||||||
|
|
||||||
/** @psalm-suppress InvalidArgument */
|
|
||||||
$functions = array_merge( ...$hook );
|
$functions = array_merge( ...$hook );
|
||||||
|
|
||||||
/** @psalm-var Hook[] $functions */
|
|
||||||
foreach ( $functions as $function ) {
|
foreach ( $functions as $function ) {
|
||||||
/** @psalm-var Hook $function */
|
|
||||||
$callback = $this->get_callback_name( $function['function'], $function['accepted_args'] );
|
$callback = $this->get_callback_name( $function['function'], $function['accepted_args'] );
|
||||||
|
|
||||||
if ( false !== strpos( $callback, 'Hook_Collector' ) ) {
|
if ( false !== strpos( $callback, 'Hook_Collector' ) ) {
|
||||||
|
|||||||
Reference in new issue
Block a user