public static function withExpectedType(
        $target,
        string $method,
        int $argument,
        string $expectedType,
        $value
    ): self {
        if ('object' === $type = gettype($value)) {
            $type = get_class($value);
        }

        return new self(sprintf(
            'Method %s::%s() expects argument %d to be %s, %s given.',
            get_class($target),
            $method,
            $argument,
            $expectedType,
            $type
        ));
    }