From d1f4faf77ca0b0f7f32ef4ab6c4e437e035e2771 Mon Sep 17 00:00:00 2001 From: Kamran Abdul Aziz Date: Sun, 1 Nov 2026 20:57:06 +0530 Subject: [PATCH] Remove redundant is_array() check flagged by PHPStan ReflectionFunctionAbstract::getStaticVariables() always returns an array, so checking its result with is_array() is redundant. PHPStan 2.3.3 and newer report it as function.alreadyNarrowedType, which fails the PHPStan check on main and on every pull request. --- bin/Handbook_Command.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/Handbook_Command.php b/bin/Handbook_Command.php index d886d316..00630d9f 100644 --- a/bin/Handbook_Command.php +++ b/bin/Handbook_Command.php @@ -693,7 +693,7 @@ private static function update_commands_data( $command, &$commands_data, $full ) $closure_reflection = new \ReflectionFunction( $closure ); // PHP stores use clause arguments of closures as static variables internally - see https://bugs.php.net/bug.php?id=71250 $static = $closure_reflection->getStaticVariables(); - if ( is_array( $static ) && isset( $static['callable'] ) ) { + if ( isset( $static['callable'] ) ) { // See `CommandFactory::create_subcommand()`. if ( is_array( $static['callable'] ) && isset( $static['callable'][0] ) ) { $reflection_class = new \ReflectionClass( $static['callable'][0] );