Update NuxeoAutomationAPI.php

Ask if is an array the parameter of NuxeoDocument. The last position of $newDocList[] is a boolean and NuxeoDocument gives a warning. 
The sentence each return the current key and value pair from an array and advance the array cursor.
In the next loop $test have an array (the previous position in the array) but current() have a boolean...