Skip to content

Commit

Permalink
Tweak exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
unfulvio committed Jun 24, 2024
1 parent 8f07bb8 commit 3627f10
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
36 changes: 18 additions & 18 deletions php/WP_Mock/API/function-mocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,66 +83,66 @@ function apply_filters($tag, $value)

if (! function_exists('esc_html')) {
/**
* @return string|mixed
* @throws ExpectationFailedException|Exception
* @return string
*/
function esc_html()
function esc_html() : string
{
/** @phpstan-ignore-next-line to prevent flagging the function as throwable in codebases requiring WP_Mock */
return Handler::handlePredefinedReturnFunction(__FUNCTION__, func_get_args());
}
}

if (! function_exists('esc_attr')) {
/**
* @return string|mixed
* @throws ExpectationFailedException|Exception
* @return string
*/
function esc_attr()
function esc_attr() : string
{
/** @phpstan-ignore-next-line to prevent flagging the function as throwable in codebases requiring WP_Mock */
return Handler::handlePredefinedReturnFunction(__FUNCTION__, func_get_args());
}
}

if (! function_exists('esc_url')) {
/**
* @return string|mixed
* @throws ExpectationFailedException|Exception
* @return string
*/
function esc_url()
function esc_url() : string
{
/** @phpstan-ignore-next-line to prevent flagging the function as throwable in codebases requiring WP_Mock */
return Handler::handlePredefinedReturnFunction(__FUNCTION__, func_get_args());
}
}

if (! function_exists('esc_url_raw')) {
/**
* @return string|mixed
* @throws ExpectationFailedException|Exception
* @return string
*/
function esc_url_raw()
function esc_url_raw() : string
{
/** @phpstan-ignore-next-line to prevent flagging the function as throwable in codebases requiring WP_Mock */
return Handler::handlePredefinedReturnFunction(__FUNCTION__, func_get_args());
}
}

if (! function_exists('esc_js')) {
/**
* @return string|mixed
* @throws ExpectationFailedException|Exception
* @return string
*/
function esc_js()
function esc_js() : string
{
/** @phpstan-ignore-next-line to prevent flagging the function as throwable in codebases requiring WP_Mock */
return Handler::handlePredefinedReturnFunction(__FUNCTION__, func_get_args());
}
}

if (! function_exists('esc_textarea')) {
/**
* @return string|mixed
* @throws ExpectationFailedException|Exception
* @return string
*/
function esc_textarea()
function esc_textarea() : string
{
/** @phpstan-ignore-next-line to prevent flagging the function as throwable in codebases requiring WP_Mock */
return Handler::handlePredefinedReturnFunction(__FUNCTION__, func_get_args());
}
}
Expand Down
3 changes: 2 additions & 1 deletion php/WP_Mock/Functions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static function handlePredefinedReturnFunction(string $functionName, arra
* @param string $functionName function name
* @param array<mixed> $args function arguments
* @return void
* @throws Exception|ExpectationFailedException
* @throws ExpectationFailedException
*/
public static function handlePredefinedEchoFunction(string $functionName, array $args = []): void
{
Expand All @@ -115,6 +115,7 @@ public static function handlePredefinedEchoFunction(string $functionName, array
} catch (Exception $exception) {
ob_end_clean();

/** @var ExpectationFailedException $exception */
throw $exception;
}

Expand Down

0 comments on commit 3627f10

Please sign in to comment.