From 191f73c0f93b3fde471a23f3275c8a480319c7ee Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 28 Apr 2013 12:40:56 +0300 Subject: [PATCH] Update GeneratorCommand.php Adds a check to prevent a foreach on an empty list of methods, which raises an Exception and stops generating the IDE Helper file. --- src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php b/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php index c7a60b1..1f8e3fe 100644 --- a/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php +++ b/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php @@ -168,10 +168,12 @@ namespace {\n\tdie('Only to be used as an helper for your IDE');\n}\n\n"; if(!in_array($alias, $onlyExtend) || $sublime) { $methods = $d->getMethods(); - - foreach ($methods as $method) + if($methods) { - $output .= $this->parseMethod($method, $root, $sublime); + foreach ($methods as $method) + { + $output .= $this->parseMethod($method, $root, $sublime); + } } } $output .= " }\n}\n\n";