WpOrg\Requests\Exception
InvalidArgument::create()
Create a new invalid argument exception with a standardized text.
Method of the class: InvalidArgument{}
No Hooks.
Return
\WpOrg\Requests\Exception\InvalidArgument
.
Usage
$result = InvalidArgument::create( $position, $name, $expected, $received );
- $position(int) (required)
- The argument position in the function signature. 1-based.
- $name(string) (required)
- The argument name in the function signature.
- $expected(string) (required)
- The argument type expected as a string.
- $received(string) (required)
- The actual argument type received.
InvalidArgument::create() InvalidArgument::create code WP 6.6.2
public static function create($position, $name, $expected, $received) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); return new self( sprintf( '%s::%s(): Argument #%d (%s) must be of type %s, %s given', $stack[1]['class'], $stack[1]['function'], $position, $name, $expected, $received ) ); }