WiFi.begin() with three parameters has incorrect documentation

I started programming some test code using the WiFi class using the method with this signature:

WiFi.begin(ssid, keyIndex, key);

It wouldn't compile, and I receive this error message:

Arduino: 1.6.5 (Windows 8.1), Board: "Adafruit HUZZAH ESP8266, 80 MHz, 115200, 4M (3M SPIFFS)"

Using library ESP8266WiFi in folder: C:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\libraries\ESP8266WiFi

C:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -IC:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.2.0/tools/sdk/include -IC:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.2.0/tools/sdk/lwip/include -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -DF_CPU=80000000L -DARDUINO=10605 -DARDUINO_ESP8266_ESP12 -DARDUINO_ARCH_ESP8266 -DESP8266 -IC:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266 -IC:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\variants\adafruit -IC:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\libraries\ESP8266WiFi\src C:\Users\Keith\AppData\Local\Temp\build6750996651168249027.tmp\ESP8266-WEPConnect.cpp -o C:\Users\Keith\AppData\Local\Temp\build6750996651168249027.tmp\ESP8266-WEPConnect.cpp.o

ESP8266-WEPConnect.ino: In function 'void setup()':
ESP8266-WEPConnect.ino:31:35: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'char*' [-fpermissive]
In file included from C:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\libraries\ESP8266WiFi\src/ESP8266WiFi.h:34:0,
from ESP8266-WEPConnect.ino:1:
C:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:39:21: error: initializing argument 2 of 'wl_status_t ESP8266WiFiSTAClass::begin(char*, char*, int32_t, const uint8_t*, bool)' [-fpermissive]
wl_status_t begin(char* ssid, char passphrase = NULL, int32_t channel = 0, const uint8_t bssid = NULL, bool connect = true);
^
ESP8266-WEPConnect.ino:31:35: error: invalid conversion from 'const char*' to 'int32_t {aka int}' [-fpermissive]
In file included from C:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\libraries\ESP8266WiFi\src/ESP8266WiFi.h:34:0,
from ESP8266-WEPConnect.ino:1:
C:\Users\Keith\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:39:21: error: initializing argument 3 of 'wl_status_t ESP8266WiFiSTAClass::begin(char*, char*, int32_t, const uint8_t*, bool)' [-fpermissive]
wl_status_t begin(char* ssid, char passphrase = NULL, int32_t channel = 0, const uint8_t bssid = NULL, bool connect = true);
^
invalid conversion from 'uint8_t {aka unsigned char}' to 'char*' [-fpermissive]

It is obvious from the error that the method expects the SSId to be the second argument and the index to be the third. In fact when I switched them and recompiled, it worked fine.

I just thought you all would like to know so that the documentation can be updated.

The Arduino documentation is correct because it refers to the WiFi library. The problem is that you're using the WiFi library documentation for the ESP8266WiFi library and the ESP8266WiFi library is different.
WiFi.h line 70:

int begin(char* ssid, uint8_t key_idx, const char* key);

ESP8266WiFiSTA.h line 38-39:

wl_status_t begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
wl_status_t begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);

I haven't run across any documentation for the ESP8266 libraries(though I haven't looked very hard because I don't use that hardware). It seems like they expect you to figure it out from the included examples and the source code.

Duh! You are right. My bad. Thanks for your response.