I came across a small issue that had me stumped for a while, I was creating a custom artisan command for Laravel and it returned this error when trying:
PHP artisan dump-autoload {"error":{"type":"ErrorException","message":"Invalid argument supplied for foreach()","file":"\/var\/www\/elections\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php","line":77}}
Try as I might I couldn’t figure it out, I removed my code bit by bit and it still came up with the error.
Then I realised that I didn’t need any options so I commented out the returning array: e.g.
protected function getOptions() { //return array( // array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null), //); }
I changed it to:
protected function getOptions() { return array( ); }
Then tried the dump-autoload again and no problems, so the solution is here in case anyone has the same issue.