diff --git a/src/PHPStan/WPCliRuncommandDynamicReturnTypeExtension.php b/src/PHPStan/WPCliRuncommandDynamicReturnTypeExtension.php index eacaa8b06..4a6bb613d 100644 --- a/src/PHPStan/WPCliRuncommandDynamicReturnTypeExtension.php +++ b/src/PHPStan/WPCliRuncommandDynamicReturnTypeExtension.php @@ -39,7 +39,7 @@ public function getTypeFromStaticMethodCall( ): Type { $args = $methodCall->getArgs(); - $returnOption = new ConstantBooleanType( true ); + $returnOption = new ConstantBooleanType( false ); $parseOption = new ConstantBooleanType( false ); $exitOnErrorOption = new ConstantBooleanType( true ); diff --git a/tests/data/runcommand.php b/tests/data/runcommand.php index 3f1828bbe..e7273bc8c 100644 --- a/tests/data/runcommand.php +++ b/tests/data/runcommand.php @@ -65,3 +65,14 @@ ] ); assertType( 'string', $value ); + +$value = WP_CLI::runcommand( 'plugin list' ); +assertType( 'null', $value ); + +$value = WP_CLI::runcommand( + 'plugin list', + [ + 'exit_error' => false, + ] +); +assertType( 'null', $value );